Ian Rogers and Arnaldo Carvalho de Melo
f637bb2eed
perf tests: build-test coverage for NO_JEVENTS=1
...
Leo reported 'perf stat' being broken and this highlighted that the
'make NO_JEVENTS=1' variant is missing from 'make -C tools/perf
build-test', add it.
Closes: https://lore.kernel.org/linux-perf-users/20260205175250.GC3529712@e132581.arm.com/
Reported-by: Leo Yan <leo.yan@arm.com >
Reviewed-by: Leo Yan <leo.yan@arm.com >
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2026-02-06 11:56:54 -03:00
Ian Rogers and Arnaldo Carvalho de Melo
b5c9bcde61
perf capstone: Support for dlopen-ing libcapstone.so
...
If perf is built with LIBCAPSTONE_DLOPEN=1, support dlopen-ing
libcapstone.so and then calling the necessary functions by looking them
up using dlsym.
The types come from capstone.h which means the libcapstone feature check
needs to pass, and NO_CAPSTONE=1 hasn't been defined. This will cause
the definition of HAVE_LIBCAPSTONE_SUPPORT.
Earlier versions of this code tried to declare the necessary
capstone.h constants and structs, but they weren't stable and caused
breakages across libcapstone releases.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Bill Wendling <morbo@google.com >
Cc: Charlie Jenkins <charlie@rivosinc.com >
Cc: Collin Funk <collin.funk1@gmail.com >
Cc: Dmitriy Vyukov <dvyukov@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Justin Stitt <justinstitt@google.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nathan Chancellor <nathan@kernel.org >
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2026-02-03 11:34:02 -03:00
Ian Rogers and Arnaldo Carvalho de Melo
169343cc8f
perf build: Remove NO_LIBCAP that controls nothing
...
Using libcap was removed in commit e25ebda78e ("perf cap: Tidy up
and improve capability testing") and improve capability testing"),
however, some build documentation and a use of the NO_LIBCAP=1 were
lingering.
Remove these left over bits.
Fixes: e25ebda78e ("perf cap: Tidy up and improve capability testing")
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2026-02-03 11:32:16 -03:00
Ian Rogers and Arnaldo Carvalho de Melo
2e9191573a
perf build: Remove NO_LIBDW_DWARF_UNWIND option
...
Libdw unwinding support is present for every architecture that has a
perf_regs.h - perf registers are needed for the initial frame to
unwind.
Elfutils also supports SPARC, ARC and m68k but there is no support in
the Linux kernel for perf registers on these architectures.
As the perf supported DWARF unwinding architectures are a subset of the
elfutils ones, remove NO_LIBDW_DWARF_UNWIND as there isn't a case of
elfutils lacking the support need for perf.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Alexandre Ghiti <alex@ghiti.fr >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Athira Rajeev <atrajeev@linux.ibm.com >
Cc: Chun-Tse Shao <ctshao@google.com >
Cc: Dmitriy Vyukov <dvyukov@google.com >
Cc: Dr. David Alan Gilbert <linux@treblig.org >
Cc: Guo Ren <guoren@kernel.org >
Cc: Haibo Xu <haibo1.xu@intel.com >
Cc: Howard Chu <howardchu95@gmail.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.g.garry@oracle.com >
Cc: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com >
Cc: Leo Yan <leo.yan@linux.dev >
Cc: Mark Wielaard <mark@klomp.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <pjw@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Sergei Trofimovich <slyich@gmail.com >
Cc: Shimin Guo <shimin.guo@skydio.com >
Cc: Stephen Brennan <stephen.s.brennan@oracle.com >
Cc: Thomas Falcon <thomas.falcon@intel.com >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2026-01-20 15:43:56 -03:00
James Clark and Arnaldo Carvalho de Melo
523471c516
perf build: Skip nondistro build test if libbfd is old
...
Non distro builds now require a new version of libbfd, so skip the test
if the library is too old.
The grep test isn't a strong as the feature test in
test-libbfd-threadsafe.c, but there seems to be precedent for feature
testing this way here and it's good enough for the build-test rule. If
the function exists but returns an error it will be picked up by the
feature test when attempting the build.
Signed-off-by: James Clark <james.clark@linaro.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Bill Wendling <morbo@google.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Justin Stitt <justinstitt@google.com >
Cc: Leo Yan <leo.yan@arm.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nathan Chancellor <nathan@kernel.org >
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2026-01-06 19:15:49 -03:00
Ian Rogers and Namhyung Kim
754187ad73
perf build: Remove NO_AUXTRACE build option
...
The NO_AUXTRACE build option was used when the __get_cpuid feature
test failed or if it was provided on the command line. The option no
longer avoids a dependency on a library and so having the option is
just adding complexity to the code base. Remove the option
CONFIG_AUXTRACE from Build files and HAVE_AUXTRACE_SUPPORT by assuming
it is always defined.
Signed-off-by: Ian Rogers <irogers@google.com >
Reviewed-by: James Clark <james.clark@linaro.org >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
2025-11-13 23:03:11 -08:00
Ian Rogers and Arnaldo Carvalho de Melo
5519b69183
tools build: Make libperl opt-in rather than opt-out, deprecate
...
If libperl is installed then the perf tool build will build against
it. There appears to be limited interest in the scripting support for
perl so let's make it opt-in and deprecate it.
With this patch applied you need to add LIBPERL=1 to get libperl
support in perf - there is no warning if libperl is missing, but
building will fail if libperl is missing and the build has LIBPERL=1.
The perf version output is changed to:
```
$ perf version --build-options
perf version 6.17.rc3.g8eca69269947
aio: [ on ] # HAVE_AIO_SUPPORT
bpf: [ on ] # HAVE_LIBBPF_SUPPORT
bpf_skeletons: [ on ] # HAVE_BPF_SKEL
debuginfod: [ on ] # HAVE_DEBUGINFOD_SUPPORT
dwarf: [ on ] # HAVE_LIBDW_SUPPORT
dwarf_getlocations: [ on ] # HAVE_LIBDW_SUPPORT
dwarf-unwind: [ on ] # HAVE_DWARF_UNWIND_SUPPORT
auxtrace: [ on ] # HAVE_AUXTRACE_SUPPORT
libbfd: [ OFF ] # HAVE_LIBBFD_SUPPORT ( tip: Deprecated, license incompatibility, use BUILD_NONDISTRO=1 and install binutils-dev[el] )
libbpf-strings: [ on ] # HAVE_LIBBPF_STRINGS_SUPPORT
libcapstone: [ on ] # HAVE_LIBCAPSTONE_SUPPORT
libdw-dwarf-unwind: [ on ] # HAVE_LIBDW_SUPPORT
libelf: [ on ] # HAVE_LIBELF_SUPPORT
libnuma: [ on ] # HAVE_LIBNUMA_SUPPORT
libopencsd: [ OFF ] # HAVE_CSTRACE_SUPPORT
libperl: [ OFF ] # HAVE_LIBPERL_SUPPORT ( tip:
Deprecated, use LIBPERL=1 and install libperl-dev to build with it )
libpfm4: [ on ] # HAVE_LIBPFM
libpython: [ on ] # HAVE_LIBPYTHON_SUPPORT
libslang: [ on ] # HAVE_SLANG_SUPPORT
libtraceevent: [ on ] # HAVE_LIBTRACEEVENT
libunwind: [ OFF ] # HAVE_LIBUNWIND_SUPPORT ( tip:
Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build
with it )
lzma: [ on ] # HAVE_LZMA_SUPPORT
numa_num_possible_cpus: [ on ] # HAVE_LIBNUMA_SUPPORT
zlib: [ on ] # HAVE_ZLIB_SUPPORT
zstd: [ on ] # HAVE_ZSTD_SUPPORT
```
i.e. there is a tip saying about deprecation and how to get support
back.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Charlie Jenkins <charlie@rivosinc.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@arm.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Quentin Monnet <qmo@kernel.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Tomas Glozar <tglozar@redhat.com >
Cc: Yuzhuo Jing <yuzhuo@google.com >
Link: https://lore.kernel.org/lkml/aMrk03gigBlGcYLK@x1/
Link: https://lore.kernel.org/lkml/CAP-5=fVX+bLBRJCiziDi_hBySgv2NFtDoghtpheSSxVAvvETGw@mail.gmail.com
[ Keep the pre-existing perl-ExtUtils-Embed hint for Fedora/RHEL systems ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2025-09-19 16:07:21 -03:00
Ian Rogers and Namhyung Kim
8081ca8d6b
perf tests make: Add NO_LIBDW=1 to minimal and add standalone test
...
Missing testing coverage of NO_LIBDW=1 and add NO_LIBDW=1 to the
minimal test configuration.
Signed-off-by: Ian Rogers <irogers@google.com >
Link: https://lore.kernel.org/r/20250703053622.3141424-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
2025-07-03 11:22:48 -07:00
Yuzhuo Jing and Namhyung Kim
8e63fd1e00
tools: Remove libcrypto dependency
...
Remove all occurrence of libcrypto in the build system.
Signed-off-by: Yuzhuo Jing <yuzhuo@google.com >
Signed-off-by: Eric Biggers <ebiggers@kernel.org >
Reviewed-by: Ian Rogers <irogers@google.com >
Link: https://lore.kernel.org/r/20250625202311.23244-5-ebiggers@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
2025-06-26 10:51:41 -07:00
Charlie Jenkins and Arnaldo Carvalho de Melo
3cc550f5bb
perf tools: Remove dependency on libaudit
...
All architectures now support HAVE_SYSCALL_TABLE_SUPPORT, so the flag is
no longer needed. With the removal of the flag, the related
GENERIC_SYSCALL_TABLE can also be removed.
libaudit was only used as a fallback for when HAVE_SYSCALL_TABLE_SUPPORT
was not defined, so libaudit is also no longer needed for any
architecture.
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Christian Brauner <brauner@kernel.org >
Cc: Guo Ren <guoren@kernel.org >
Cc: Günther Noack <gnoack@google.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.g.garry@oracle.com >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Leo Yan <leo.yan@linux.dev >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mickaël Salaün <mic@digikod.net >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Will Deacon <will@kernel.org >
Link: https://lore.kernel.org/r/20250108-perf_syscalltbl-v6-16-7543b5293098@rivosinc.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2025-01-10 10:59:42 -03:00
Ian Rogers and Namhyung Kim
13e17c9ff4
perf build: Make libunwind opt-in rather than opt-out
...
Having multiple unwinding libraries makes the perf code harder to
understand and we have unused/untested code paths.
Perf made BPF support an opt-out rather than opt-in feature. As libbpf
has a libelf dependency, elfutils that provides libelf will also
provide libdw. When libdw is present perf will use libdw unwinding
rather than libunwind unwinding even if libunwind support is compiled
in.
Rather than have libunwind built into perf and never used, explicitly
disable the support and make it opt-in.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Link: https://lore.kernel.org/r/20241028193619.247727-1-irogers@google.com
Closes: https://lore.kernel.org/linux-perf-users/CAP-5=fUXkp-d7gkzX4eF+nbjb2978dZsiHZ9abGHN=BN1qAcbg@mail.gmail.com/
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
2024-11-04 11:32:35 -08:00
Steinar H. Gunderson and Arnaldo Carvalho de Melo
c3f8644c21
perf report: Support LLVM for addr2line()
...
In addition to the existing support for libbfd and calling out to
an external addr2line command, add support for using libllvm directly.
This is both faster than libbfd, and can be enabled in distro builds
(the LLVM license has an explicit provision for GPLv2 compatibility).
Thus, it is set as the primary choice if available.
As an example, running 'perf report' on a medium-size profile with
DWARF-based backtraces took 58 seconds with LLVM, 78 seconds with
libbfd, 153 seconds with external llvm-addr2line, and I got tired and
aborted the test after waiting for 55 minutes with external bfd
addr2line (which is the default for perf as compiled by distributions
today).
Evidently, for this case, the bfd addr2line process needs 18 seconds (on
a 5.2 GHz Zen 3) to load the .debug ELF in question, hits the 1-second
timeout and gets killed during initialization, getting restarted anew
every time. Having an in-process addr2line makes this much more robust.
As future extensions, libllvm can be used in many other places where
we currently use libbfd or other libraries:
- Symbol enumeration (in particular, for PE binaries).
- Demangling (including non-Itanium demangling, e.g. Microsoft
or Rust).
- Disassembling (perf annotate).
However, these are much less pressing; most people don't profile PE
binaries, and perf has non-bfd paths for ELF. The same with demangling;
the default _cxa_demangle path works fine for most users, and while bfd
objdump can be slow on large binaries, it is possible to use
--objdump=llvm-objdump to get the speed benefits. (It appears
LLVM-based demangling is very simple, should we want that.)
Tested with LLVM 14, 15, 16, 18 and 19. For some reason, LLVM 12 was not
correctly detected using feature_check, and thus was not tested.
Committer notes:
Added the name and a __maybe_unused to address:
1 13.50 almalinux:8 : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-22) (GCC)
util/srcline.c: In function 'dso__free_a2l':
util/srcline.c:184:20: error: parameter name omitted
void dso__free_a2l(struct dso *)
^~~~~~~~~~~~
make[3]: *** [/git/perf-6.11.0-rc3/tools/build/Makefile.build:158: util] Error 2
Signed-off-by: Steinar H. Gunderson <sesse@google.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Ian Rogers <irogers@google.com >
Link: https://lore.kernel.org/r/20240803152008.2818485-1-sesse@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2024-09-03 10:15:16 -03:00
Ian Rogers and Arnaldo Carvalho de Melo
2576b20abd
perf test: Add build test for JEVENTS_ARCH=all
...
Building with JEVENTS_ARCH=all builds all CPU types and allows things
like assertions to check the validity of the input JSON.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Albert Ou <aou@eecs.berkeley.edu >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Atish Patra <atishp@rivosinc.com >
Cc: Changbin Du <changbin.du@huawei.com >
Cc: Charles Ci-Jyun Wu <dminus@andestech.com >
Cc: Eric Lin <eric.lin@sifive.com >
Cc: Greentime Hu <greentime.hu@sifive.com >
Cc: Guilherme Amadio <amadio@gentoo.org >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Inochi Amaoto <inochiama@outlook.com >
Cc: James Clark <james.clark@linaro.org >
Cc: Ji Sheng Teoh <jisheng.teoh@starfivetech.com >
Cc: Jing Zhang <renyu.zj@linux.alibaba.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.g.garry@oracle.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linux.dev >
Cc: Locus Wei-Han Chen <locus84@andestech.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Palmer Dabbelt <palmer@dabbelt.com >
Cc: Paul Walmsley <paul.walmsley@sifive.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Samuel Holland <samuel.holland@sifive.com >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Vincent Chen <vincent.chen@sifive.com >
Cc: Will Deacon <will@kernel.org >
Cc: Xu Yang <xu.yang_2@nxp.com >
Link: https://lore.kernel.org/r/20240805194424.597244-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2024-08-06 10:35:27 -03:00
Changbin Du and Namhyung Kim
8b767db330
perf: build: introduce the libcapstone
...
Later we will use libcapstone to disassemble instructions of samples.
Signed-off-by: Changbin Du <changbin.du@huawei.com >
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com >
Cc: changbin.du@gmail.com
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Andi Kleen <ak@linux.intel.com >
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
Link: https://lore.kernel.org/r/20240217074046.4100789-2-changbin.du@huawei.com
2024-02-20 18:06:25 -08:00
Arnaldo Carvalho de Melo
c8e3ade38b
perf tests make: Remove the last egrep call, use 'grep -E' instead
...
One last case, caught while testing with amazonlinux:2, centos:stream,
etc:
4 7.28 amazonlinux:2 : FAIL egrep: warning: egrep is obsolescent; using grep -E
gcc version 7.3.1 20180712 (Red Hat 7.3.1-17) (GCC)
8 13.87 centos:stream : FAIL egrep: warning: egrep is obsolescent; using grep -E
Reviewed-by: Guilherme Amadio <amadio@gentoo.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lore.kernel.org/lkml/ZUEdtblE8qDAQkBK@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-11-03 12:25:53 -03:00
Ian Rogers and Namhyung Kim
c2ac838ef7
perf test: Ensure EXTRA_TESTS is covered in build test
...
Add to run variable.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Namhyung Kim <namhyung@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Nick Terrell <terrelln@fb.com >
Cc: Patrice Duroux <patrice.duroux@gmail.com >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Andrii Nakryiko <andrii@kernel.org >
Cc: Nathan Chancellor <nathan@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com >
Cc: Tiezhu Yang <yangtiezhu@loongson.cn >
Cc: Tom Rix <trix@redhat.com >
Cc: llvm@lists.linux.dev
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230914211948.814999-5-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
2023-09-18 16:46:53 -07:00
Ian Rogers and Namhyung Kim
c67c631d52
perf test: Update build test for changed BPF skeleton defaults
...
Fix a target name and set BUILD_BPF_SKEL to 0 rather than 1.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Namhyung Kim <namhyung@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Nick Terrell <terrelln@fb.com >
Cc: Patrice Duroux <patrice.duroux@gmail.com >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Andrii Nakryiko <andrii@kernel.org >
Cc: Nathan Chancellor <nathan@kernel.org >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com >
Cc: Tiezhu Yang <yangtiezhu@loongson.cn >
Cc: Tom Rix <trix@redhat.com >
Cc: llvm@lists.linux.dev
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230914211948.814999-4-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
2023-09-18 16:46:45 -07:00
Ian Rogers and Arnaldo Carvalho de Melo
56b11a2126
perf bpf: Remove support for embedding clang for compiling BPF events (-e foo.c)
...
This never was in the default build for perf, is difficult to maintain
as it uses clang/llvm internals so ditch it, keeping, for now, the
external compilation of .c BPF into .o bytecode and its subsequent
loading, that is also going to be removed, do it separately to help
bisection and to properly document what is being removed and why.
Committer notes:
Extracted from a larger patch and removed some leftovers, namely
deleting these now unused feature tests:
tools/build/feature/test-clang.cpp
tools/build/feature/test-cxx.cpp
tools/build/feature/test-llvm-version.cpp
tools/build/feature/test-llvm.cpp
Testing the use of BPF events after applying this patch:
To use the external clang/llvm toolchain to compile a .c event and then
use libbpf to load it, to get the syscalls:sys_enter_open* tracepoints
and read the filename pointer, putting it into the ring buffer right
after the usual tracepoint payload for 'perf trace' to then print it:
[root@quaco ~]# perf trace -e /home/acme/git/perf-tools-next/tools/perf/examples/bpf/augmented_raw_syscalls.c,open* --max-events=10
0.000 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
0.083 abrt-dump-jour/1453 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.063 abrt-dump-jour/1454 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.082 abrt-dump-jour/1455 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
250.124 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
250.521 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/memory.pressure", flags: RDONLY|CLOEXEC) = 12
251.047 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/memory.current", flags: RDONLY|CLOEXEC) = 12
251.162 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/memory.min", flags: RDONLY|CLOEXEC) = 12
251.242 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/memory.low", flags: RDONLY|CLOEXEC) = 12
251.353 systemd-oomd/959 openat(dfd: CWD, filename: "/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/memory.swap.current", flags: RDONLY|CLOEXEC) = 12
[root@quaco ~]#
Same thing, but with a prebuilt .o BPF bytecode:
[root@quaco ~]# perf trace -e /home/acme/git/perf-tools-next/tools/perf/examples/bpf/augmented_raw_syscalls.o,open* --max-events=10
0.000 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
0.083 abrt-dump-jour/1453 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.083 abrt-dump-jour/1455 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
0.062 abrt-dump-jour/1454 openat(dfd: CWD, filename: "/var/log/journal/d6a97235307247e09f13f326fb607e3c/system.journal", flags: RDONLY|CLOEXEC|NONBLOCK) = 4
249.985 systemd-oomd/959 openat(dfd: CWD, filename: "/proc/meminfo", flags: RDONLY|CLOEXEC) = 12
466.763 thermald/1234 openat(dfd: CWD, filename: "/sys/class/powercap/intel-rapl/intel-rapl:0/intel-rapl:0:2/energy_uj") = 13
467.145 thermald/1234 openat(dfd: CWD, filename: "/sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj") = 13
467.311 thermald/1234 openat(dfd: CWD, filename: "/sys/class/thermal/thermal_zone2/temp") = 13
500.040 cgroupify/24006 openat(dfd: 4, filename: ".", flags: RDONLY|CLOEXEC|DIRECTORY|NONBLOCK) = 5
500.295 cgroupify/24006 openat(dfd: 4, filename: "24616/cgroup.procs") = 5
[root@quaco ~]#
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Carsten Haitzler <carsten.haitzler@arm.com>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Fangrui Song <maskray@google.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Tom Rix <trix@redhat.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Wang ShaoBo <bobo.shaobowang@huawei.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/lkml/ZNZWsAXg2px1sm2h@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-08-15 16:41:48 -03:00
Ian Rogers and Namhyung Kim
06c39e742d
perf test: Add build tests for BUILD_BPF_SKEL
...
Add tests with and without generating vmlinux.h.
Signed-off-by: Ian Rogers <irogers@google.com >
Acked-by: Andrii Nakryiko <andrii@kernel.org >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: James Clark <james.clark@arm.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Yang Jihong <yangjihong1@huawei.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Arnaldo Carvalho de Melo <acme@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Tiezhu Yang <yangtiezhu@loongson.cn >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230623041405.4039475-4-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org >
2023-06-23 21:35:46 -07:00
Adrian Hunter and Arnaldo Carvalho de Melo
d436373a75
perf tests: Make x86 new instructions test optional at build time
...
The "x86 instruction decoder - new instructions" test takes up space but
is only really useful to developers. Make it optional at build time.
Add variable EXTRA_TESTS which must be defined in order to build perf
with the test.
Example:
Before:
$ make -C tools/perf clean >/dev/null
$ make -C tools/perf >/dev/null
Makefile.config:650: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
Makefile.config:1149: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev
PERF_VERSION = 6.4.rc3.gd15b8c76c964
$ readelf -SW tools/perf/perf | grep '\.rela.dyn\|.rodata\|\.data.rel.ro'
[10] .rela.dyn RELA 000000000002fcb0 02fcb0 0748b0 18 A 6 0 8
[18] .rodata PROGBITS 00000000002eb000 2eb000 6bac00 00 A 0 0 32
[25] .data.rel.ro PROGBITS 00000000009ea180 9e9180 04b540 00 WA 0 0 32
After:
$ make -C tools/perf clean >/dev/null
$ make -C tools/perf >/dev/null
Makefile.config:650: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
Makefile.config:1154: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev
PERF_VERSION = 6.4.rc3.g4ea9c1569ea4
$ readelf -SW tools/perf/perf | grep '\.rela.dyn\|.rodata\|\.data.rel.ro'
[10] .rela.dyn RELA 000000000002f3c8 02f3c8 036d68 18 A 6 0 8
[18] .rodata PROGBITS 00000000002ac000 2ac000 68da80 00 A 0 0 32
[25] .data.rel.ro PROGBITS 000000000097d440 97c440 022280 00 WA 0 0 32
Committer notes:
Build with 'make EXTRA_TESTS=1 -C tools/perf O=/tmp/build/perf" and
reproduced the ELF section size differences.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com >
Acked-by: Ian Rogers <irogers@google.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/683fea7c-f5e9-fa20-f96b-f6233ed5d2a7@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-06-13 23:40:32 -03:00
James Clark and Arnaldo Carvalho de Melo
d199226143
perf build: Fix unescaped # in perf build-test
...
With the following bash and make versions:
$ make --version
GNU Make 4.2.1
Built for aarch64-unknown-linux-gnu
$ bash --version
GNU bash, version 5.0.17(1)-release (aarch64-unknown-linux-gnu)
This error is encountered when running the build-test target:
$ make -C tools/perf build-test
tests/make:181: *** unterminated call to function 'shell': missing ')'. Stop.
make: *** [Makefile:103: build-test] Error 2
Fix it by escaping the # which was causing make to interpret the rest of
the line as a comment leaving the unclosed opening bracket.
Fixes: 56d5229471 ("tools build: Pass libbpf feature only if libbpf 1.0+")
Signed-off-by: James Clark <james.clark@arm.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230425104414.1723571-1-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-05-02 08:36:14 -03:00
Arnaldo Carvalho de Melo
686c511866
perf build: Test the refcnt check build
...
Make sure we test build the currently added REFCNT_CHECKING
infrastructure.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-04-19 13:47:03 -03:00
Ian Rogers and Arnaldo Carvalho de Melo
8d98ca5c02
perf build: Error if no libelf and NO_LIBELF isn't set
...
Building without libelf support is going disable a lot of
functionality. Require that the NO_LIBELF=1 build option is passed if
this is intentional.
Committer notes:
Add NO_LIBELF=1 to the 'make_static' target in tools/perf/tests/make so
that 'make -C tools/perf build-test' works.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andres Freund <andres@anarazel.de >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Martin Liška <mliska@suse.cz >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nathan Chancellor <nathan@kernel.org >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Pavithra Gurushankar <gpavithrasha@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Quentin Monnet <quentin@isovalent.com >
Cc: Roberto Sassu <roberto.sassu@huawei.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Tiezhu Yang <yangtiezhu@loongson.cn >
Cc: Tom Rix <trix@redhat.com >
Cc: Yang Jihong <yangjihong1@huawei.com >
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-03-14 08:29:46 -03:00
Ian Rogers and Arnaldo Carvalho de Melo
f1925bd588
perf build: Remove redundant NO_NEWT build option
...
The option controlled nothing and no code depends, conditional or
otherwise, on libnewt.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andres Freund <andres@anarazel.de >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Martin Liška <mliska@suse.cz >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nathan Chancellor <nathan@kernel.org >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Pavithra Gurushankar <gpavithrasha@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Quentin Monnet <quentin@isovalent.com >
Cc: Roberto Sassu <roberto.sassu@huawei.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Tiezhu Yang <yangtiezhu@loongson.cn >
Cc: Tom Rix <trix@redhat.com >
Cc: Yang Jihong <yangjihong1@huawei.com >
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-03-14 08:29:46 -03:00
Ian Rogers and Arnaldo Carvalho de Melo
6898e60f70
perf build: If libtraceevent isn't present error the build
...
If libtraceevent isn't present, the build will warn and continue. This
disables a number of features and so isn't desirable. This change
makes the build error for this case. The build can still be made to
happen by adding NO_LIBTRACEEVENT=1.
Committer notes:
Add NO_LIBTRACEEVENT=1 to the 'make_static' target in
tools/perf/tests/make so that 'make -C tools/perf build-test' works.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andres Freund <andres@anarazel.de >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Martin Liška <mliska@suse.cz >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nathan Chancellor <nathan@kernel.org >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Pavithra Gurushankar <gpavithrasha@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Quentin Monnet <quentin@isovalent.com >
Cc: Roberto Sassu <roberto.sassu@huawei.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Tiezhu Yang <yangtiezhu@loongson.cn >
Cc: Tom Rix <trix@redhat.com >
Cc: Yang Jihong <yangjihong1@huawei.com >
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-03-14 08:29:46 -03:00