Skip to content

Commit 7685b33

Browse files
committed
Merge tag 'perf-tools-for-v6.14-2025-01-21' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf-tools updates from Namhyung Kim: "There are a lot of changes in the perf tools in this cycle. build: - Use generic syscall table to generate syscall numbers on supported archs - This also enables to get rid of libaudit which was used for syscall numbers - Remove python2 support as it's deprecated for years - Fix issues on static build with libzstd perf record: - Intel-PT supports "aux-action" config term to pause or resume tracing in the aux-buffer. Users can start the intel_pt event as "started-paused" and configure other events to control the Intel-PT tracing: # perf record --kcore -e intel_pt/aux-action=start-paused/ \ -e syscalls:sys_enter_newuname/aux-action=resume/ \ -e syscalls:sys_exit_newuname/aux-action=pause/ -- uname This requires kernel support (which was added in v6.13) perf lock: - 'perf lock contention' command has an ability to symbolize locks in dynamically allocated objects using slab cache name when it runs with BPF. Those dynamic locks would have "&" prefix in the name to distinguish them from ordinary (static) locks # perf lock con -abl -E 5 sleep 1 contended total wait max wait avg wait address symbol 2 1.95 us 1.77 us 975 ns ffff9d5e852d3498 &task_struct (mutex) 1 1.18 us 1.18 us 1.18 us ffff9d5e852d3538 &task_struct (mutex) 4 1.12 us 354 ns 279 ns ffff9d5e841ca800 &kmalloc-cg-512 (mutex) 2 859 ns 617 ns 429 ns ffffffffa41c3620 delayed_uprobe_lock (mutex) 3 691 ns 388 ns 230 ns ffffffffa41c0940 pack_mutex (mutex) This also requires kernel/BPF support (which was added in v6.13) perf ftrace: - 'perf ftrace latency' command gets a couple of options to support linear buckets instead of exponential. Also it's possible to specify max and min latency for the linear buckets: # perf ftrace latency -abn -T switch_mm_irqs_off --bucket-range=100 \ --min-latency=200 --max-latency=800 -- sleep 1 # DURATION | COUNT | GRAPH | 0 - 200 ns | 186 | ### | 200 - 300 ns | 256 | ##### | 300 - 400 ns | 364 | ####### | 400 - 500 ns | 223 | #### | 500 - 600 ns | 111 | ## | 600 - 700 ns | 41 | | 700 - 800 ns | 141 | ## | 800 - ... ns | 169 | ### | # statistics (in nsec) total time: 2162212 avg time: 967 max time: 16817 min time: 132 count: 2236 - As you can see in the above example, it nows shows the statistics at the end so that users can see the avg/max/min latencies easily - 'perf ftrace profile' command has --graph-opts option like 'perf ftrace trace' so that it can control the tracing behaviors in the same way. For example, it can limit the function call depth or threshold perf script: - Improve physical memory resolution in 'mem-phys-addr' script by parsing /proc/iomem file # perf script mem-phys-addr -- find / ... Event: mem_inst_retired.all_loads:P Memory type count percentage ---------------------------------------- ---------- ---------- 100000000-85f7fffff : System RAM 8929 69.7 547600000-54785d23f : Kernel data 1240 9.7 546a00000-5474bdfff : Kernel rodata 490 3.8 5480ce000-5485fffff : Kernel bss 121 0.9 0-fff : Reserved 3860 30.1 100000-89c01fff : System RAM 18 0.1 8a22c000-8df6efff : System RAM 5 0.0 Others: - 'perf test' gets --runs-per-test option to run the test cases repeatedly. This would be helpful to see if it's flaky - Add 'parse_events' method to Python perf extension module, so that users can use the same event parsing logic in the python code. One more step towards implementing perf tools in Python. :) - Support opening tracepoint events without libtraceevent. This will be helpful if it won't use the tracing data like in 'perf stat' - Update ARM Neoverse N2/V2 JSON events and metrics" * tag 'perf-tools-for-v6.14-2025-01-21' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: (176 commits) perf test: Update event_groups test to use instructions perf bench: Fix undefined behavior in cmpworker() perf annotate: Prefer passing evsel to evsel->core.idx perf lock: Rename fields in lock_type_table perf lock: Add percpu-rwsem for type filter perf lock: Fix parse_lock_type which only retrieve one lock flag perf lock: Fix return code for functions in __cmd_contention perf hist: Fix width calculation in hpp__fmt() perf hist: Fix bogus profiles when filters are enabled perf hist: Deduplicate cmp/sort/collapse code perf test: Improve verbose documentation perf test: Add a runs-per-test flag perf test: Fix parallel/sequential option documentation perf test: Send list output to stdout rather than stderr perf test: Rename functions and variables for better clarity perf tools: Expose quiet/verbose variables in Makefile.perf perf config: Add a function to set one variable in .perfconfig perf test perftool_testsuite: Return correct value for skipping perf test perftool_testsuite: Add missing description perf test record+probe_libc_inet_pton: Make test resilient ...
2 parents bc8198d + 91b7747 commit 7685b33

File tree

293 files changed

+11043
-2975
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+11043
-2975
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
What: /sys/bus/event_source/devices/<pmu>
2+
Date: 2014/02/24
3+
Contact: Linux kernel mailing list <[email protected]>
4+
Description: Performance Monitoring Unit (<pmu>)
5+
6+
Each <pmu> directory, for a PMU device, is a name
7+
optionally followed by an underscore and then either a
8+
decimal or hexadecimal number. For example, cpu is a
9+
PMU name without a suffix as is intel_bts,
10+
uncore_imc_0 is a PMU name with a 0 numeric suffix,
11+
ddr_pmu_87e1b0000000 is a PMU name with a hex
12+
suffix. The hex suffix must be more than two
13+
characters long to avoid ambiguity with PMUs like the
14+
S390 cpum_cf.
15+
16+
Tools can treat PMUs with the same name that differ by
17+
suffix as instances of the same PMU for the sake of,
18+
for example, opening an event. For example, the PMUs
19+
uncore_imc_free_running_0 and
20+
uncore_imc_free_running_1 have an event data_read;
21+
opening the data_read event on a PMU specified as
22+
uncore_imc_free_running should be treated as opening
23+
the data_read event on PMU uncore_imc_free_running_0
24+
and PMU uncore_imc_free_running_1.

Documentation/ABI/testing/sysfs-bus-event_source-devices-events

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ Description: Per-pmu performance monitoring events specific to the running syste
3737
performance monitoring event supported by the <pmu>. The name
3838
of the file is the name of the event.
3939

40-
As performance monitoring event names are case
41-
insensitive in the perf tool, the perf tool only looks
42-
for lower or upper case event names in sysfs to avoid
40+
As performance monitoring event names are case insensitive
41+
in the perf tool, the perf tool only looks for all lower
42+
case or all upper case event names in sysfs to avoid
4343
scanning the directory. It is therefore required the
44-
name of the event here is either lower or upper case.
44+
name of the event here is either completely lower or upper
45+
case, with no mixed-case characters. Numbers, '.', '_', and
46+
'-' are also allowed.
4547

4648
File contents:
4749

Documentation/admin-guide/workload-tracing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ scripts/ver_linux is a good way to check if your system already has
8383
the necessary tools::
8484

8585
sudo apt-get build-essentials flex bison yacc
86-
sudo apt install libelf-dev systemtap-sdt-dev libaudit-dev libslang2-dev libperl-dev libdw-dev
86+
sudo apt install libelf-dev systemtap-sdt-dev libslang2-dev libperl-dev libdw-dev
8787

8888
cscope is a good tool to browse kernel sources. Let's install it now::
8989

tools/bpf/bpftool/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ FEATURE_TESTS += libbfd-liberty
106106
FEATURE_TESTS += libbfd-liberty-z
107107
FEATURE_TESTS += disassembler-four-args
108108
FEATURE_TESTS += disassembler-init-styled
109+
FEATURE_TESTS += libelf-zstd
109110

110111
FEATURE_DISPLAY := clang-bpf-co-re
111112
FEATURE_DISPLAY += llvm
@@ -132,6 +133,12 @@ endif
132133

133134
LIBS = $(LIBBPF) -lelf -lz
134135
LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
136+
137+
ifeq ($(feature-libelf-zstd),1)
138+
LIBS += -lzstd
139+
LIBS_BOOTSTRAP += -lzstd
140+
endif
141+
135142
ifeq ($(feature-libcap), 1)
136143
CFLAGS += -DUSE_LIBCAP
137144
LIBS += -lcap

tools/build/Build.include

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
comma := ,
1414
squote := '
1515
pound := \#
16+
empty :=
17+
space := $(empty) $(empty)
1618

1719
###
1820
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o

tools/build/Makefile.build

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@
1212
PHONY := __build
1313
__build:
1414

15-
ifeq ($(V),1)
16-
quiet =
17-
Q =
18-
else
19-
quiet=quiet_
20-
Q=@
21-
endif
22-
23-
# If the user is running make -s (silent mode), suppress echoing of commands
24-
# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
25-
ifeq ($(filter 3.%,$(MAKE_VERSION)),)
26-
short-opts := $(firstword -$(MAKEFLAGS))
27-
else
28-
short-opts := $(filter-out --%,$(MAKEFLAGS))
29-
endif
30-
31-
ifneq ($(findstring s,$(short-opts)),)
32-
quiet=silent_
33-
endif
34-
3515
build-dir := $(srctree)/tools/build
3616

3717
# Define $(fixdep) for dep-cmd function

tools/build/Makefile.feature

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,41 @@ endef
2828
# the rule that uses them - an example for that is the 'bionic'
2929
# feature check. ]
3030
#
31+
# These + the ones in FEATURE_TESTS_EXTRA are included in
32+
# tools/build/feature/test-all.c and we try to build it all together
33+
# then setting all those features to '1' meaning they are all enabled.
34+
#
35+
# There are things like fortify-source that will be set to 1 because test-all
36+
# is built with the flags needed to test if its enabled, resulting in
37+
#
38+
# $ rm -rf /tmp/b ; mkdir /tmp/b ; make -C tools/perf O=/tmp/b feature-dump
39+
# $ grep fortify-source /tmp/b/FEATURE-DUMP
40+
# feature-fortify-source=1
41+
# $
42+
#
43+
# All the others should have lines in tools/build/feature/test-all.c like:
44+
#
45+
# #define main main_test_disassembler_init_styled
46+
# # include "test-disassembler-init-styled.c"
47+
# #undef main
48+
#
49+
# #define main main_test_libzstd
50+
# # include "test-libzstd.c"
51+
# #undef main
52+
#
53+
# int main(int argc, char *argv[])
54+
# {
55+
# main_test_disassembler_four_args();
56+
# main_test_libzstd();
57+
# return 0;
58+
# }
59+
#
60+
# If the sample above works, then we end up with these lines in the FEATURE-DUMP
61+
# file:
62+
#
63+
# feature-disassembler-four-args=1
64+
# feature-libzstd=1
65+
#
3166
FEATURE_TESTS_BASIC := \
3267
backtrace \
3368
libdw \
@@ -38,17 +73,16 @@ FEATURE_TESTS_BASIC := \
3873
glibc \
3974
libbfd \
4075
libbfd-buildid \
41-
libcap \
4276
libelf \
4377
libelf-getphdrnum \
4478
libelf-gelf_getnote \
4579
libelf-getshdrstrndx \
80+
libelf-zstd \
4681
libnuma \
4782
numa_num_possible_cpus \
4883
libperl \
4984
libpython \
5085
libslang \
51-
libslang-include-subdir \
5286
libtraceevent \
5387
libtracefs \
5488
libcpupower \
@@ -89,13 +123,6 @@ FEATURE_TESTS_EXTRA := \
89123
libbfd-liberty \
90124
libbfd-liberty-z \
91125
libopencsd \
92-
libunwind-x86 \
93-
libunwind-x86_64 \
94-
libunwind-arm \
95-
libunwind-aarch64 \
96-
libunwind-debug-frame \
97-
libunwind-debug-frame-arm \
98-
libunwind-debug-frame-aarch64 \
99126
cxx \
100127
llvm \
101128
clang \
@@ -122,7 +149,6 @@ FEATURE_DISPLAY ?= \
122149
glibc \
123150
libbfd \
124151
libbfd-buildid \
125-
libcap \
126152
libelf \
127153
libnuma \
128154
numa_num_possible_cpus \

tools/build/feature/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ FILES= \
1313
test-gtk2.bin \
1414
test-gtk2-infobar.bin \
1515
test-hello.bin \
16-
test-libaudit.bin \
1716
test-libbfd.bin \
1817
test-libbfd-buildid.bin \
1918
test-disassembler-four-args.bin \
@@ -28,6 +27,7 @@ FILES= \
2827
test-libelf-getphdrnum.bin \
2928
test-libelf-gelf_getnote.bin \
3029
test-libelf-getshdrstrndx.bin \
30+
test-libelf-zstd.bin \
3131
test-libdebuginfod.bin \
3232
test-libnuma.bin \
3333
test-numa_num_possible_cpus.bin \
@@ -110,7 +110,7 @@ all: $(FILES)
110110
__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
111111
BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
112112
BUILD_BFD = $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
113-
BUILD_ALL = $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd -lcap
113+
BUILD_ALL = $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd
114114

115115
__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
116116
BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
@@ -196,6 +196,9 @@ $(OUTPUT)test-libelf-gelf_getnote.bin:
196196
$(OUTPUT)test-libelf-getshdrstrndx.bin:
197197
$(BUILD) -lelf
198198

199+
$(OUTPUT)test-libelf-zstd.bin:
200+
$(BUILD) -lelf -lz -lzstd
201+
199202
$(OUTPUT)test-libdebuginfod.bin:
200203
$(BUILD) -ldebuginfod
201204

@@ -228,9 +231,6 @@ $(OUTPUT)test-libunwind-debug-frame-arm.bin:
228231
$(OUTPUT)test-libunwind-debug-frame-aarch64.bin:
229232
$(BUILD) -lelf -llzma -lunwind-aarch64
230233

231-
$(OUTPUT)test-libaudit.bin:
232-
$(BUILD) -laudit
233-
234234
$(OUTPUT)test-libslang.bin:
235235
$(BUILD) -lslang
236236

tools/build/feature/test-all.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
# include "test-libelf-getshdrstrndx.c"
5959
#undef main
6060

61-
#define main main_test_libunwind
62-
# include "test-libunwind.c"
61+
#define main main_test_libelf_zstd
62+
# include "test-libelf-zstd.c"
6363
#undef main
6464

6565
#define main main_test_libslang
@@ -170,6 +170,14 @@
170170
# include "test-libzstd.c"
171171
#undef main
172172

173+
#define main main_test_libtraceevent
174+
# include "test-libtraceevent.c"
175+
#undef main
176+
177+
#define main main_test_libtracefs
178+
# include "test-libtracefs.c"
179+
#undef main
180+
173181
int main(int argc, char *argv[])
174182
{
175183
main_test_libpython();
@@ -184,7 +192,6 @@ int main(int argc, char *argv[])
184192
main_test_libelf_getphdrnum();
185193
main_test_libelf_gelf_getnote();
186194
main_test_libelf_getshdrstrndx();
187-
main_test_libunwind();
188195
main_test_libslang();
189196
main_test_libbfd();
190197
main_test_libbfd_buildid();
@@ -208,6 +215,8 @@ int main(int argc, char *argv[])
208215
main_test_reallocarray();
209216
main_test_disassembler_four_args();
210217
main_test_libzstd();
218+
main_test_libtraceevent();
219+
main_test_libtracefs();
211220

212221
return 0;
213222
}

tools/build/feature/test-libaudit.c

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)