Ian Rogers
83c338369a
libperf cpumap: Make index and nr types unsigned
...
The index into the cpumap array and the number of entries within the
array can never be negative, so let's make them unsigned. This is
prompted by reports that gcc 13 with -O6 is giving a
alloc-size-larger-than errors. The change makes the cpumap changes and
then updates the declaration of index variables throughout perf and
libperf to be unsigned. The two things are hard to separate as
compiler warnings about mixing signed and unsigned types breaks the
build.
Reported-by: Chingbin Li <[email protected] >
Closes: https://lore.kernel.org/lkml/[email protected] /
Tested-by: Chingbin Li <[email protected] >
Signed-off-by: Ian Rogers <[email protected] >
Signed-off-by: Namhyung Kim <[email protected] >
2026-04-01 14:50:53 -07:00
Sean Christopherson
75d7ba32f9
perf tools: Use dedicated non-atomic clear/set bit helpers
...
Use the dedicated non-atomic helpers for {clear,set}_bit() and their
test variants, i.e. the double-underscore versions. Depsite being
defined in atomic.h, and despite the kernel versions being atomic in the
kernel, tools' {clear,set}_bit() helpers aren't actually atomic. Move
to the double-underscore versions so that the versions that are expected
to be atomic (for kernel developers) can be made atomic without affecting
users that don't want atomic operations.
No functional change intended.
Signed-off-by: Sean Christopherson <[email protected] >
Acked-by: Namhyung Kim <[email protected] >
Message-Id: <[email protected] >
Signed-off-by: Paolo Bonzini <[email protected] >
2022-12-02 13:22:33 -05:00
Ian Rogers
4402869939
perf cpumap: Migrate to libperf cpumap api
...
Switch from directly accessing the perf_cpu_map to using the appropriate
libperf API when possible. Using the API simplifies the job of
refactoring use of perf_cpu_map.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Adrian Hunter <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexey Bayduraev <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Andrew Morton <[email protected] >
Cc: André Almeida <[email protected] >
Cc: Andy Shevchenko <[email protected] >
Cc: Darren Hart <[email protected] >
Cc: Davidlohr Bueso <[email protected] >
Cc: Dmitriy Vyukov <[email protected] >
Cc: Eric Dumazet <[email protected] >
Cc: German Gomez <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jin Yao <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: John Garry <[email protected] >
Cc: Kajol Jain <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: Madhavan Srinivasan <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Masami Hiramatsu <[email protected] >
Cc: Miaoqian Lin <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Riccardo Mancini <[email protected] >
Cc: Shunsuke Nakamura <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Stephen Brennan <[email protected] >
Cc: Steven Rostedt (VMware) <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Thomas Richter <[email protected] >
Cc: Yury Norov <[email protected] >
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-01-22 17:08:42 -03:00
Ian Rogers
6d18804b96
perf cpumap: Give CPUs their own type
...
A common problem is confusing CPU map indices with the CPU, by wrapping
the CPU with a struct then this is avoided. This approach is similar to
atomic_t.
Committer notes:
To make it build with BUILD_BPF_SKEL=1 these files needed the
conversions to 'struct perf_cpu' usage:
tools/perf/util/bpf_counter.c
tools/perf/util/bpf_counter_cgroup.c
tools/perf/util/bpf_ftrace.c
Also perf_env__get_cpu() was removed back in "perf cpumap: Switch
cpu_map__build_map to cpu function".
Additionally these needed to be fixed for the ARM builds to complete:
tools/perf/arch/arm/util/cs-etm.c
tools/perf/arch/arm64/util/pmu.c
Suggested-by: John Garry <[email protected] >
Signed-off-by: Ian Rogers <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Kajol Jain <[email protected] >
Cc: Kan Liang <[email protected] >
Cc: Leo Yan <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Mathieu Poirier <[email protected] >
Cc: Mike Leach <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Clarke <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Riccardo Mancini <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Suzuki Poulouse <[email protected] >
Cc: Vineet Singh <[email protected] >
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-01-12 14:28:23 -03:00
Ian Rogers
33f44bfd3c
perf test: Rename struct test to test_suite
...
This is to align with kunit's terminology.
Signed-off-by: Ian Rogers <[email protected] >
Tested-by: Sohaib Mohamed <[email protected] >
Acked-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Brendan Higgins <[email protected] >
Cc: Daniel Latypov <[email protected] >
Cc: David Gow <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jin Yao <[email protected] >
Cc: John Garry <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Clarke <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2021-11-13 10:32:22 -03:00
Ian Rogers
d68f036508
perf test: Move each test suite struct to its test
...
Rather than export test functions, export the test struct. Rename with a
suite__ prefix to avoid name collisions.
Committer notes:
Its '&suite__vectors_page', not '&suite__vectors_pages', noticed when
cross building to arm (32-bit).
Signed-off-by: Ian Rogers <[email protected] >
Tested-by: Sohaib Mohamed <[email protected] >
Acked-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Brendan Higgins <[email protected] >
Cc: Daniel Latypov <[email protected] >
Cc: David Gow <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jin Yao <[email protected] >
Cc: John Garry <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Paul Clarke <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2021-11-13 10:30:58 -03:00
Andy Shevchenko
7fc5b57132
tools: rename bitmap_alloc() to bitmap_zalloc()
...
Rename bitmap_alloc() to bitmap_zalloc() in tools to follow the bitmap API
in the kernel.
No functional changes intended.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected] >
Signed-off-by: Yury Norov <[email protected] >
Suggested-by: Yury Norov <[email protected] >
Acked-by: Yury Norov <[email protected] >
Tested-by: Wolfram Sang <[email protected] >
Acked-by: Jiri Olsa <[email protected] >
Cc: Alexander Lobakin <[email protected] >
Cc: Alexey Klimov <[email protected] >
Cc: Dennis Zhou <[email protected] >
Cc: Ulf Hansson <[email protected] >
Cc: Will Deacon <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2021-09-08 11:50:27 -07:00
Arnaldo Carvalho de Melo
87ffb6c640
perf env: Remove needless cpumap.h header
...
Only a 'struct perf_cmp_map' forward allocation is necessary, fix the
places that need the header but were getting it indirectly, by luck,
from env.h.
Cc: Adrian Hunter <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-09-20 09:19:21 -03:00
Arnaldo Carvalho de Melo
b6b5574b80
perf env: Remove env.h from other headers where just a fwd decl is needed
...
And fixup the fallout of c files not building due to now missing
headers.
Cc: Adrian Hunter <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-08-31 19:10:40 -03:00
Arnaldo Carvalho de Melo
5e51b0bb24
perf cpumap: Remove needless includes from cpumap.h
...
The util/cpumap.h file doesn't use anything in refcount.h not in
debug.h, it needs just a forward reference to 'struct cpu_map_data',
that is defined in util/event.h and cpumap.h was getting indirectly via,
of all things, debug.h
Cc: Adrian Hunter <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-08-22 17:16:57 -03:00
Jiri Olsa
9c3516d1b8
libperf: Add perf_cpu_map__new()/perf_cpu_map__read() functions
...
Moving the following functions from tools/perf:
cpu_map__new()
cpu_map__read()
to libperf with the following names:
perf_cpu_map__new()
perf_cpu_map__read()
Committer notes:
Fixed up this one:
tools/perf/arch/arm/util/cs-etm.c
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexey Budankov <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-07-29 18:34:45 -03:00
Jiri Olsa
38f01d8da1
libperf: Add perf_cpu_map__get()/perf_cpu_map__put()
...
Moving the following functions:
cpu_map__get()
cpu_map__put()
to libperf with following names:
perf_cpu_map__get()
perf_cpu_map__put()
Committer notes:
Added fixes for arm/arm64
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexey Budankov <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-07-29 18:34:44 -03:00
Jiri Olsa
f854839ba2
perf cpu_map: Rename struct cpu_map to struct perf_cpu_map
...
Rename struct cpu_map to struct perf_cpu_map, so it could be part of
libperf.
Committer notes:
Added fixes for arm64, provided by Jiri.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexey Budankov <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-07-29 18:34:42 -03:00
Arnaldo Carvalho de Melo
d8f9da2404
perf tools: Use zfree() where applicable
...
In places where the equivalent was already being done, i.e.:
free(a);
a = NULL;
And in placs where struct members are being freed so that if we have
some erroneous reference to its struct, then accesses to freed members
will result in segfaults, which we can detect faster than use after free
to areas that may still have something seemingly valid.
Cc: Adrian Hunter <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-07-09 10:13:27 -03:00
Arnaldo Carvalho de Melo
5875cf4cd3
perf tests: Add missing SPDX headers
...
Cc: Adrian Hunter <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Wang Nan <[email protected] >
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2019-06-17 15:57:19 -03:00
Yury Norov
3c8b818640
perf tools: Drop unneeded bitmap_zero() calls
...
bitmap_zero() is called after bitmap_alloc() in perf code. But
bitmap_alloc() internally uses calloc() which guarantees that allocated
area is zeroed. So following bitmap_zero is unneeded. Drop it.
This happened because of confusing name for bitmap allocator. It
should has name bitmap_zalloc instead of bitmap_alloc.
This series:
https://lkml.org/lkml/2018/6/18/841
introduces a new API for bitmap allocations in kernel, and functions
there are named correctly. Following patch propogates the API to tools,
and fixes naming issue.
Signed-off-by: Yury Norov <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andi Kleen <[email protected] >
Cc: Andrew Morton <[email protected] >
Cc: Andriy Shevchenko <[email protected] >
Cc: David Ahern <[email protected] >
Cc: David Carrillo-Cisneros <[email protected] >
Cc: Dmitry Torokhov <[email protected] >
Cc: Jin Yao <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Kate Stewart <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Mike Snitzer <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Philippe Ombredanne <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2018-08-08 15:55:44 -03:00
Jiri Olsa
8185850ad6
perf tests: Add mem2node object test
...
Adding mem2node object automated test.
The test prepares few artificial nodes - memory maps and verifies the
mem2node object returns proper node values to given addresses.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: David Ahern <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2018-03-16 13:52:48 -03:00