Ian Rogers
da885a0e5e
perf cpumap: Add reference count checking
...
Enabled when REFCNT_CHECKING is defined. The change adds a memory
allocated pointer that is interposed between the reference counted cpu
map at a get and freed by a put. The pointer replaces the original
perf_cpu_map struct, so use of the perf_cpu_map via APIs remains
unchanged. Any use of the cpu map without the API requires two versions,
handled via the RC_CHK_ACCESS macro.
This change is intended to catch:
- use after put: using a cpumap after you have put it will cause a
segv.
- unbalanced puts: two puts for a get will result in a double free
that can be captured and reported by tools like address sanitizer,
including with the associated stack traces of allocation and frees.
- missing puts: if a put is missing then the get turns into a memory
leak that can be reported by leak sanitizer, including the stack
trace at the point the get occurs.
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: 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: Hao Luo <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: James Clark <[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: 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: https://lore.kernel.org/lkml/[email protected]
[ Extracted from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2023-04-17 16:50:02 -03:00
Alexander Gordeev
4ff17c448a
libperf: Fix install_pkgconfig target
...
Commit 47e02b94a4 ("tools lib perf: Add dependency test to install_headers")
misses the notion of $(DESTDIR_SQ) for install_pkgconfig target, which leads to
error:
install: cannot create regular file '/usr/lib64/pkgconfig/libperf.pc': Permission denied
make: *** [Makefile:210: install_pkgconfig] Error 1
Signed-off-by: Alexander Gordeev <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Ian Rogers <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Josh Poimboeuf <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Masahiro Yamada <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Nicolas Schier <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Tom Rix <[email protected] >
Cc: [email protected]
Cc: [email protected]
Link: http://lore.kernel.org/lkml/Y5w/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-12-16 10:04:06 -03:00
Ian Rogers
47e02b94a4
tools lib perf: Add dependency test to install_headers
...
Compute the headers to be installed from their source headers and make
each have its own build target to install it. Using dependencies
avoids headers being reinstalled and getting a new timestamp which
then causes files that depend on the header to be rebuilt.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Josh Poimboeuf <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Masahiro Yamada <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nathan Chancellor <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Nicolas Schier <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Tom Rix <[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-12-14 11:16:12 -03:00
Ian Rogers
e8951bfb4c
tools lib perf: Make install_headers clearer
...
Add libperf to the name so that this install_headers build appears
different to similar targets in different libraries.
Signed-off-by: Ian Rogers <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Alexei Starovoitov <[email protected] >
Cc: Andrii Nakryiko <[email protected] >
Cc: Daniel Borkmann <[email protected] >
Cc: Hao Luo <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: John Fastabend <[email protected] >
Cc: KP Singh <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Martin KaFai Lau <[email protected] >
Cc: Masahiro Yamada <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Nicolas Schier <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Song Liu <[email protected] >
Cc: Stanislav Fomichev <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: Yonghong Song <[email protected] >
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-11-20 11:32:23 -03:00
Ian Rogers
a6e8caf5db
tools lib perf: Add missing install headers
...
Headers necessary for the perf build. Note, internal headers are also
installed as these are necessary for the build.
Signed-off-by: Ian Rogers <[email protected] >
Acked-by: Namhyung Kim <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Andrii Nakryiko <[email protected] >
Cc: Jiri Olsa <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Masahiro Yamada <[email protected] >
Cc: Nick Desaulniers <[email protected] >
Cc: Nicolas Schier <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Stephane Eranian <[email protected] >
Cc: [email protected]
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2022-11-16 12:17:15 -03:00
Masahiro Yamada
5c8166419a
kbuild: replace $(if A,A,B) with $(or A,B)
...
$(or ...) is available since GNU Make 3.81, and useful to shorten the
code in some places.
Covert as follows:
$(if A,A,B) --> $(or A,B)
This patch also converts:
$(if A, A, B) --> $(or A, B)
Strictly speaking, the latter is not an equivalent conversion because
GNU Make keeps spaces after commas; if A is not empty, $(if A, A, B)
expands to " A", while $(or A, B) expands to "A".
Anyway, preceding spaces are not significant in the code hunks I touched.
Signed-off-by: Masahiro Yamada <[email protected] >
Reviewed-by: Nicolas Schier <[email protected] >
2022-02-15 12:25:56 +09:00
Jiri Olsa
3d970601da
libperf: Change tests to single static and shared binaries
...
Make tests to be two binaries 'tests_static' and 'tests_shared', so the
maintenance is easier.
Adding tests under libperf build system, so we define all the flags just
once.
Adding make-tests tule to just compile tests without running them.
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Ian Rogers <[email protected] >
Cc: Mark Rutland <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Shunsuke Nakamura <[email protected] >
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2021-07-07 11:41:58 -03:00
Jiri Olsa
81de3bf37a
libperf: Add man pages
...
Change the man page generation to asciidoc, because it's easier to use
and has been more commonly used in related projects. Remove the current
rst pages.
Add 3 man pages to have a base for more additions:
libperf.3 - overall description
libperf-counting.7 - counting basics explained on simple example
libperf-sampling.7 - sampling basics explained on simple example
The plan is to add more man pages to cover the basic API.
The build generates html and man pages:
$ cd tools/lib/perf/Documentation
$ make
ASCIIDOC libperf.xml
XMLTO libperf.3
ASCIIDOC libperf-counting.xml
XMLTO libperf-counting.7
ASCIIDOC libperf-sampling.xml
XMLTO libperf-sampling.7
ASCIIDOC libperf.html
ASCIIDOC libperf-counting.html
ASCIIDOC libperf-sampling.html
Add the following install targets:
install-man - man pages
install-html - html version of man pages
install-examples - examples mentioned in the man pages
Signed-off-by: Jiri Olsa <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2020-01-06 11:46:09 -03:00
Jiri Olsa
3ce311afb5
libperf: Move to tools/lib/perf
...
Move libperf from its current location under tools/perf to a separate
directory under tools/lib/.
Also change various paths (mainly includes) to reflect the libperf move
to a separate directory and add a new directory under MANIFEST.
Signed-off-by: Jiri Olsa <[email protected] >
Tested-by: Arnaldo Carvalho de Melo <[email protected] >
Cc: Alexander Shishkin <[email protected] >
Cc: Michael Petlan <[email protected] >
Cc: Namhyung Kim <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected] >
2020-01-06 11:46:09 -03:00