Skip to content

Commit 891e8ab

Browse files
committed
Merge tag 'perf-tools-for-v6.12-1-2024-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools updates from Arnaldo Carvalho de Melo: - Use BPF + BTF to collect and pretty print syscall and tracepoint arguments in 'perf trace', done as an GSoC activity - Data-type profiling improvements: - Cache debuginfo to speed up data type resolution - Add the 'typecln' sort order, to show which cacheline in a target is hot or cold. The following shows members in the cfs_rq's first cache line: $ perf report -s type,typecln,typeoff -H ... - 2.67% struct cfs_rq + 1.23% struct cfs_rq: cache-line 2 + 0.57% struct cfs_rq: cache-line 4 + 0.46% struct cfs_rq: cache-line 6 - 0.41% struct cfs_rq: cache-line 0 0.39% struct cfs_rq +0x14 (h_nr_running) 0.02% struct cfs_rq +0x38 (tasks_timeline.rb_leftmost) - When a typedef resolves to a unnamed struct, use the typedef name - When a struct has just one basic type field (int, etc), resolve the type sort order to the name of the struct, not the type of the field - Support type folding/unfolding in the data-type annotation TUI - Fix bitfields offsets and sizes - Initial support for PowerPC, using libcapstone and the usual objdump disassembly parsing routines - Add support for disassembling and addr2line using the LLVM libraries, speeding up those operations - Support --addr2line option in 'perf script' as with other tools - Intel branch counters (LBR event logging) support, only available in recent Intel processors, for instance, the new "brcntr" field can be asked from 'perf script' to print the information collected from this feature: $ perf script -F +brstackinsn,+brcntr # Branch counter abbr list: # branch-instructions:ppp = A # branch-misses = B # '-' No event occurs # '+' Event occurrences may be lost due to branch counter saturated tchain_edit 332203 3366329.405674: 53030 branch-instructions:ppp: 401781 f3+0x2c (home/sdp/test/tchain_edit) f3+31: 0000000000401774 insn: eb 04 br_cntr: AA # PRED 5 cycles [5] 000000000040177a insn: 81 7d fc 0f 27 00 00 0000000000401781 insn: 7e e3 br_cntr: A # PRED 1 cycles [6] 2.00 IPC 0000000000401766 insn: 8b 45 fc 0000000000401769 insn: 83 e0 01 000000000040176c insn: 85 c0 000000000040176e insn: 74 06 br_cntr: A # PRED 1 cycles [7] 4.00 IPC 0000000000401776 insn: 83 45 fc 01 000000000040177a insn: 81 7d fc 0f 27 00 00 0000000000401781 insn: 7e e3 br_cntr: A # PRED 7 cycles [14] 0.43 IPC - Support Timed PEBS (Precise Event-Based Sampling), a recent hardware feature in Intel processors - Add 'perf ftrace profile' subcommand, using ftrace's function-graph tracer so that users can see the total, average, max execution time as well as the number of invocations easily, for instance: $ sudo perf ftrace profile -G __x64_sys_perf_event_open -- \ perf stat -e cycles -C1 true 2> /dev/null | head # Total (us) Avg (us) Max (us) Count Function 65.611 65.611 65.611 1 __x64_sys_perf_event_open 30.527 30.527 30.527 1 anon_inode_getfile 30.260 30.260 30.260 1 __anon_inode_getfile 29.700 29.700 29.700 1 alloc_file_pseudo 17.578 17.578 17.578 1 d_alloc_pseudo 17.382 17.382 17.382 1 __d_alloc 16.738 16.738 16.738 1 kmem_cache_alloc_lru 15.686 15.686 15.686 1 perf_event_alloc 14.012 7.006 11.264 2 obj_cgroup_charge - 'perf sched timehist' improvements, including the addition of priority showing/filtering command line options - Varios improvements to the 'perf probe', including 'perf test' regression testings - Introduce the 'perf check', initially to check if some feature is in place, using it in 'perf test' - Various fixes for 32-bit systems - Address more leak sanitizer failures - Fix memory leaks (LBR, disasm lock ops, etc) - More reference counting fixes (branch_info, etc) - Constify 'struct perf_tool' parameters to improve code generation and reduce the chances of having its internals changed, which isn't expected - More constifications in various other places - Add more build tests, including for JEVENTS - Add more 'perf test' entries ('perf record LBR', pipe/inject, --setup-filter, 'perf ftrace', 'cgroup sampling', etc) - Inject build ids for all entries in a call chain in 'perf inject', not just for the main sample - Improve the BPF based sample filter, allowing root to setup filters in bpffs that then can be used by non-root users - Allow filtering by cgroups with the BPF based sample filter - Allow a more compact way for 'perf mem report' using the -T/--type-profile and also provide a --sort option similar to the one in 'perf report', 'perf top', to setup the sort order manually - Fix --group behavior in 'perf annotate' when leader has no samples, where it was not showing anything even when other events in the group had samples - Fix spinlock and rwlock accounting in 'perf lock contention' - Fix libsubcmd fixdep Makefile dependencies - Improve 'perf ftrace' error message when ftrace isn't available - Update various Intel JSON vendor event files - ARM64 CoreSight hardware tracing infrastructure improvements, mostly not visible to users - Update power10 JSON events * tag 'perf-tools-for-v6.12-1-2024-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: (310 commits) perf trace: Mark the 'head' arg in the set_robust_list syscall as coming from user space perf trace: Mark the 'rseq' arg in the rseq syscall as coming from user space perf env: Find correct branch counter info on hybrid perf evlist: Print hint for group tools: Drop nonsensical -O6 perf pmu: To info add event_type_desc perf evsel: Add accessor for tool_event perf pmus: Fake PMU clean up perf list: Avoid potential out of bounds memory read perf help: Fix a typo ("bellow") perf ftrace: Detect whether ftrace is enabled on system perf test shell probe_vfs_getname: Remove extraneous '=' from probe line number regex perf build: Require at least clang 16.0.6 to build BPF skeletons perf trace: If a syscall arg is marked as 'const', assume it is coming _from_ userspace perf parse-events: Remove duplicated include in parse-events.c perf callchain: Allow symbols to be optional when resolving a callchain perf inject: Lazy build-id mmap2 event insertion perf inject: Add new mmap2-buildid-all option perf inject: Fix build ID injection perf annotate-data: Add pr_debug_scope() ...
2 parents 673a500 + 1de5b5d commit 891e8ab

File tree

290 files changed

+15177
-4249
lines changed

Some content is hidden

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

290 files changed

+15177
-4249
lines changed

tools/build/Build

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

tools/build/Makefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,5 @@ ifneq ($(wildcard $(TMP_O)),)
4343
$(Q)$(MAKE) -C feature OUTPUT=$(TMP_O) clean >/dev/null
4444
endif
4545

46-
$(OUTPUT)fixdep-in.o: FORCE
47-
$(Q)$(MAKE) $(build)=fixdep
48-
49-
$(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o
50-
$(QUIET_LINK)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ $<
51-
52-
FORCE:
53-
54-
.PHONY: FORCE
46+
$(OUTPUT)fixdep: $(srctree)/tools/build/fixdep.c
47+
$(QUIET_CC)$(HOSTCC) $(KBUILD_HOSTCFLAGS) $(KBUILD_HOSTLDFLAGS) -o $@ $<

tools/build/Makefile.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ FEATURE_TESTS_EXTRA := \
100100
libunwind-debug-frame-aarch64 \
101101
cxx \
102102
llvm \
103-
llvm-version \
104103
clang \
105104
libbpf \
106105
libbpf-btf__load_from_kernel_by_id \
@@ -136,6 +135,7 @@ FEATURE_DISPLAY ?= \
136135
libunwind \
137136
libdw-dwarf-unwind \
138137
libcapstone \
138+
llvm-perf \
139139
zlib \
140140
lzma \
141141
get_cpuid \

tools/build/Makefile.include

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
33

4+
# More than just $(Q), we sometimes want to suppress all command output from a
5+
# recursive make -- even the 'up to date' printout.
6+
ifeq ($(V),1)
7+
Q ?=
8+
SILENT_MAKE = +$(Q)$(MAKE)
9+
else
10+
Q ?= @
11+
SILENT_MAKE = +$(Q)$(MAKE) --silent
12+
endif
13+
414
fixdep:
5-
$(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep
15+
$(SILENT_MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep
616

717
fixdep-clean:
818
$(Q)$(MAKE) -C $(srctree)/tools/build clean

tools/build/feature/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ FILES= \
7373
test-libopencsd.bin \
7474
test-clang.bin \
7575
test-llvm.bin \
76-
test-llvm-version.bin \
76+
test-llvm-perf.bin \
7777
test-libaio.bin \
7878
test-libzstd.bin \
7979
test-clang-bpf-co-re.bin \
@@ -388,9 +388,12 @@ $(OUTPUT)test-llvm.bin:
388388
$(shell $(LLVM_CONFIG) --system-libs) \
389389
> $(@:.bin=.make.output) 2>&1
390390

391-
$(OUTPUT)test-llvm-version.bin:
392-
$(BUILDXX) -std=gnu++17 \
393-
-I$(shell $(LLVM_CONFIG) --includedir) \
391+
$(OUTPUT)test-llvm-perf.bin:
392+
$(BUILDXX) -std=gnu++17 \
393+
-I$(shell $(LLVM_CONFIG) --includedir) \
394+
-L$(shell $(LLVM_CONFIG) --libdir) \
395+
$(shell $(LLVM_CONFIG) --libs Core BPF) \
396+
$(shell $(LLVM_CONFIG) --system-libs) \
394397
> $(@:.bin=.make.output) 2>&1
395398

396399
$(OUTPUT)test-clang.bin:

tools/build/feature/test-all.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@
134134
#undef main
135135
#endif
136136

137-
#define main main_test_libcapstone
138-
# include "test-libcapstone.c"
139-
#undef main
140-
141137
#define main main_test_lzma
142138
# include "test-lzma.c"
143139
#undef main
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#include "llvm/Support/ManagedStatic.h"
3+
#include "llvm/Support/raw_ostream.h"
4+
5+
#if LLVM_VERSION_MAJOR < 13
6+
# error "Perf requires llvm-devel/llvm-dev version 13 or greater"
7+
#endif
8+
9+
int main()
10+
{
11+
llvm::errs() << "Hello World!\n";
12+
llvm::llvm_shutdown();
13+
return 0;
14+
}

tools/include/linux/coresight-pmu.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,21 @@
4949
* Interpretation of the PERF_RECORD_AUX_OUTPUT_HW_ID payload.
5050
* Used to associate a CPU with the CoreSight Trace ID.
5151
* [07:00] - Trace ID - uses 8 bits to make value easy to read in file.
52-
* [59:08] - Unused (SBZ)
53-
* [63:60] - Version
52+
* [39:08] - Sink ID - as reported in /sys/bus/event_source/devices/cs_etm/sinks/
53+
* Added in minor version 1.
54+
* [55:40] - Unused (SBZ)
55+
* [59:56] - Minor Version - previously existing fields are compatible with
56+
* all minor versions.
57+
* [63:60] - Major Version - previously existing fields mean different things
58+
* in new major versions.
5459
*/
5560
#define CS_AUX_HW_ID_TRACE_ID_MASK GENMASK_ULL(7, 0)
56-
#define CS_AUX_HW_ID_VERSION_MASK GENMASK_ULL(63, 60)
61+
#define CS_AUX_HW_ID_SINK_ID_MASK GENMASK_ULL(39, 8)
5762

58-
#define CS_AUX_HW_ID_CURR_VERSION 0
63+
#define CS_AUX_HW_ID_MINOR_VERSION_MASK GENMASK_ULL(59, 56)
64+
#define CS_AUX_HW_ID_MAJOR_VERSION_MASK GENMASK_ULL(63, 60)
65+
66+
#define CS_AUX_HW_ID_MAJOR_VERSION 0
67+
#define CS_AUX_HW_ID_MINOR_VERSION 1
5968

6069
#endif

tools/include/linux/string.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ extern char * __must_check skip_spaces(const char *);
4646

4747
extern char *strim(char *);
4848

49+
extern void remove_spaces(char *s);
50+
4951
extern void *memchr_inv(const void *start, int c, size_t bytes);
5052
#endif /* _TOOLS_LINUX_STRING_H_ */

tools/lib/api/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
3131
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC
3232

3333
ifeq ($(DEBUG),0)
34-
ifeq ($(CC_NO_CLANG), 0)
3534
CFLAGS += -O3
36-
else
37-
CFLAGS += -O6
38-
endif
3935
endif
4036

4137
ifeq ($(DEBUG),0)

0 commit comments

Comments
 (0)