Skip to content

Commit 713eee8

Browse files
committed
Merge tag 'perf-tools-2020-08-14' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull more perf tools updates from Arnaldo Carvalho de Melo: "Fixes: - Fixes for 'perf bench numa'. - Always memset source before memcpy in 'perf bench mem'. - Quote CC and CXX for their arguments to fix build in environments using those variables to pass more than just the compiler names. - Fix module symbol processing, addressing regression detected via "perf test". - Allow multiple probes in record+script_probe_vfs_getname.sh 'perf test' entry. Improvements: - Add script to autogenerate socket family name id->string table from copy of kernel header, used so far in 'perf trace'. - 'perf ftrace' improvements to provide similar options for this utility so that one can go from 'perf record', 'perf trace', etc to 'perf ftrace' just by changing the name of the subcommand. - Prefer new "sched:sched_waking" trace event when it exists in 'perf sched' post processing. - Update POWER9 metrics to utilize other metrics. - Fall back to querying debuginfod if debuginfo not found locally. Miscellaneous: - Sync various kvm headers with kernel sources" * tag 'perf-tools-2020-08-14' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (40 commits) perf ftrace: Make option description initials all capital letters perf build-ids: Fall back to debuginfod query if debuginfo not found perf bench numa: Remove dead code in parse_nodes_opt() perf stat: Update POWER9 metrics to utilize other metrics perf ftrace: Add change log perf: ftrace: Add set_tracing_options() to set all trace options perf ftrace: Add option --tid to filter by thread id perf ftrace: Add option -D/--delay to delay tracing perf: ftrace: Allow set graph depth by '--graph-opts' perf ftrace: Add support for trace option tracing_thresh perf ftrace: Add option 'verbose' to show more info for graph tracer perf ftrace: Add support for tracing option 'irq-info' perf ftrace: Add support for trace option funcgraph-irqs perf ftrace: Add support for trace option sleep-time perf ftrace: Add support for tracing option 'func_stack_trace' perf tools: Add general function to parse sublevel options perf ftrace: Add option '--inherit' to trace children processes perf ftrace: Show trace column header perf ftrace: Add option '-m/--buffer-size' to set per-cpu buffer size perf ftrace: Factor out function write_tracing_file_int() ...
2 parents 50f6c7d + 492e4ed commit 713eee8

37 files changed

+1253
-247
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13566,6 +13566,7 @@ F: arch/*/kernel/perf_event*.c
1356613566
F: include/linux/perf_event.h
1356713567
F: include/uapi/linux/perf_event.h
1356813568
F: kernel/events/*
13569+
F: tools/lib/perf/
1356913570
F: tools/perf/
1357013571

1357113572
PERFORMANCE EVENTS SUBSYSTEM ARM64 PMU EVENTS

tools/arch/s390/include/uapi/asm/kvm.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,13 @@ struct kvm_guest_debug_arch {
231231
#define KVM_SYNC_GSCB (1UL << 9)
232232
#define KVM_SYNC_BPBC (1UL << 10)
233233
#define KVM_SYNC_ETOKEN (1UL << 11)
234+
#define KVM_SYNC_DIAG318 (1UL << 12)
234235

235236
#define KVM_SYNC_S390_VALID_FIELDS \
236237
(KVM_SYNC_PREFIX | KVM_SYNC_GPRS | KVM_SYNC_ACRS | KVM_SYNC_CRS | \
237238
KVM_SYNC_ARCH0 | KVM_SYNC_PFAULT | KVM_SYNC_VRS | KVM_SYNC_RICCB | \
238-
KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN)
239+
KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN | \
240+
KVM_SYNC_DIAG318)
239241

240242
/* length and alignment of the sdnx as a power of two */
241243
#define SDNXC 8
@@ -264,7 +266,8 @@ struct kvm_sync_regs {
264266
__u8 reserved2 : 7;
265267
__u8 padding1[51]; /* riccb needs to be 64byte aligned */
266268
__u8 riccb[64]; /* runtime instrumentation controls block */
267-
__u8 padding2[192]; /* sdnx needs to be 256byte aligned */
269+
__u64 diag318; /* diagnose 0x318 info */
270+
__u8 padding2[184]; /* sdnx needs to be 256byte aligned */
268271
union {
269272
__u8 sdnx[SDNXL]; /* state description annex */
270273
struct {

tools/build/Makefile.feature

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ endif
88

99
feature_check = $(eval $(feature_check_code))
1010
define feature_check_code
11-
feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CC=$(CC) CXX=$(CXX) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
11+
feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CC="$(CC)" CXX="$(CXX)" CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
1212
endef
1313

1414
feature_set = $(eval $(feature_set_code))
@@ -98,7 +98,8 @@ FEATURE_TESTS_EXTRA := \
9898
llvm-version \
9999
clang \
100100
libbpf \
101-
libpfm4
101+
libpfm4 \
102+
libdebuginfod
102103

103104
FEATURE_TESTS ?= $(FEATURE_TESTS_BASIC)
104105

tools/build/feature/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ FILES= \
2626
test-libelf-gelf_getnote.bin \
2727
test-libelf-getshdrstrndx.bin \
2828
test-libelf-mmap.bin \
29+
test-libdebuginfod.bin \
2930
test-libnuma.bin \
3031
test-numa_num_possible_cpus.bin \
3132
test-libperl.bin \
@@ -157,6 +158,9 @@ $(OUTPUT)test-libelf-gelf_getnote.bin:
157158
$(OUTPUT)test-libelf-getshdrstrndx.bin:
158159
$(BUILD) -lelf
159160

161+
$(OUTPUT)test-libdebuginfod.bin:
162+
$(BUILD) -ldebuginfod
163+
160164
$(OUTPUT)test-libnuma.bin:
161165
$(BUILD) -lnuma
162166

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#include <elfutils/debuginfod.h>
3+
4+
int main(void)
5+
{
6+
debuginfod_client* c = debuginfod_begin();
7+
return (long)c;
8+
}

tools/include/uapi/linux/kvm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ struct kvm_run {
289289
/* KVM_EXIT_FAIL_ENTRY */
290290
struct {
291291
__u64 hardware_entry_failure_reason;
292+
__u32 cpu;
292293
} fail_entry;
293294
/* KVM_EXIT_EXCEPTION */
294295
struct {
@@ -1031,6 +1032,9 @@ struct kvm_ppc_resize_hpt {
10311032
#define KVM_CAP_PPC_SECURE_GUEST 181
10321033
#define KVM_CAP_HALT_POLL 182
10331034
#define KVM_CAP_ASYNC_PF_INT 183
1035+
#define KVM_CAP_LAST_CPU 184
1036+
#define KVM_CAP_SMALLER_MAXPHYADDR 185
1037+
#define KVM_CAP_S390_DIAG318 186
10341038

10351039
#ifdef KVM_CAP_IRQ_ROUTING
10361040

tools/include/uapi/linux/vhost.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191

9292
/* Use message type V2 */
9393
#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
94+
/* IOTLB can accept batching hints */
95+
#define VHOST_BACKEND_F_IOTLB_BATCH 0x2
9496

9597
#define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
9698
#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)

tools/lib/perf/Documentation/libperf-counting.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ libperf-counting - counting interface
77

88
DESCRIPTION
99
-----------
10-
The counting interface provides API to meassure and get count for specific perf events.
10+
The counting interface provides API to measure and get count for specific perf events.
1111

1212
The following test tries to explain count on `counting.c` example.
1313

1414
It is by no means complete guide to counting, but shows libperf basic API for counting.
1515

16-
The `counting.c` comes with libbperf package and can be compiled and run like:
16+
The `counting.c` comes with libperf package and can be compiled and run like:
1717

1818
[source,bash]
1919
--
@@ -26,7 +26,8 @@ count 176242, enabled 176242, run 176242
2626
It requires root access, because of the `PERF_COUNT_SW_CPU_CLOCK` event,
2727
which is available only for root.
2828

29-
The `counting.c` example monitors two events on the current process and displays their count, in a nutshel it:
29+
The `counting.c` example monitors two events on the current process and displays
30+
their count, in a nutshell it:
3031

3132
* creates events
3233
* adds them to the event list
@@ -152,7 +153,7 @@ Configure event list with the thread map and open events:
152153
--
153154

154155
Both events are created as disabled (note the `disabled = 1` assignment above),
155-
so we need to enable the whole list explicitely (both events).
156+
so we need to enable the whole list explicitly (both events).
156157

157158
From this moment events are counting and we can do our workload.
158159

@@ -167,7 +168,8 @@ When we are done we disable the events list.
167168
79 perf_evlist__disable(evlist);
168169
--
169170

170-
Now we need to get the counts from events, following code iterates throught the events list and read counts:
171+
Now we need to get the counts from events, following code iterates through the
172+
events list and read counts:
171173

172174
[source,c]
173175
--
@@ -178,7 +180,7 @@ Now we need to get the counts from events, following code iterates throught the
178180
85 }
179181
--
180182

181-
And finaly cleanup.
183+
And finally cleanup.
182184

183185
We close the whole events list (both events) and remove it together with the threads map:
184186

tools/lib/perf/Documentation/libperf-sampling.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ libperf-sampling - sampling interface
88

99
DESCRIPTION
1010
-----------
11-
The sampling interface provides API to meassure and get count for specific perf events.
11+
The sampling interface provides API to measure and get count for specific perf events.
1212

1313
The following test tries to explain count on `sampling.c` example.
1414

1515
It is by no means complete guide to sampling, but shows libperf basic API for sampling.
1616

17-
The `sampling.c` comes with libbperf package and can be compiled and run like:
17+
The `sampling.c` comes with libperf package and can be compiled and run like:
1818

1919
[source,bash]
2020
--
@@ -33,7 +33,8 @@ cpu 0, pid 4465, tid 4470, ip 7f84fe0ebebf, period 176
3333

3434
It requires root access, because it uses hardware cycles event.
3535

36-
The `sampling.c` example profiles/samples all CPUs with hardware cycles, in a nutshel it:
36+
The `sampling.c` example profiles/samples all CPUs with hardware cycles, in a
37+
nutshell it:
3738

3839
- creates events
3940
- adds them to the event list
@@ -90,7 +91,7 @@ Once the setup is complete we start by defining cycles event using the `struct p
9091
36 };
9192
--
9293

93-
Next step is to prepare cpus map.
94+
Next step is to prepare CPUs map.
9495

9596
In this case we will monitor all the available CPUs:
9697

@@ -152,7 +153,7 @@ Once the events list is open, we can create memory maps AKA perf ring buffers:
152153
--
153154

154155
The event is created as disabled (note the `disabled = 1` assignment above),
155-
so we need to enable the events list explicitely.
156+
so we need to enable the events list explicitly.
156157

157158
From this moment the cycles event is sampling.
158159

@@ -212,7 +213,7 @@ Each sample needs to get parsed:
212213
106 cpu, pid, tid, ip, period);
213214
--
214215

215-
And finaly cleanup.
216+
And finally cleanup.
216217

217218
We close the whole events list (both events) and remove it together with the threads map:
218219

tools/lib/perf/Documentation/libperf.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SYNOPSIS
2929
void libperf_init(libperf_print_fn_t fn);
3030
--
3131

32-
*API to handle cpu maps:*
32+
*API to handle CPU maps:*
3333

3434
[source,c]
3535
--
@@ -217,7 +217,7 @@ Following objects are key to the libperf interface:
217217

218218
[horizontal]
219219

220-
struct perf_cpu_map:: Provides a cpu list abstraction.
220+
struct perf_cpu_map:: Provides a CPU list abstraction.
221221

222222
struct perf_thread_map:: Provides a thread list abstraction.
223223

tools/perf/Documentation/perf-config.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,9 @@ trace.*::
614614

615615
ftrace.*::
616616
ftrace.tracer::
617-
Can be used to select the default tracer. Possible values are
618-
'function' and 'function_graph'.
617+
Can be used to select the default tracer when neither -G nor
618+
-F option is not specified. Possible values are 'function' and
619+
'function_graph'.
619620

620621
llvm.*::
621622
llvm.clang-path::

tools/perf/Documentation/perf-ftrace.txt

Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,28 @@ OPTIONS
2424

2525
-t::
2626
--tracer=::
27-
Tracer to use: function_graph or function.
27+
Tracer to use when neither -G nor -F option is not
28+
specified: function_graph or function.
2829

2930
-v::
3031
--verbose=::
3132
Verbosity level.
3233

34+
-F::
35+
--funcs::
36+
List all available functions to trace.
37+
3338
-p::
3439
--pid=::
3540
Trace on existing process id (comma separated list).
3641

42+
--tid=::
43+
Trace on existing thread id (comma separated list).
44+
45+
-D::
46+
--delay::
47+
Time (ms) to wait before starting tracing after program start.
48+
3749
-a::
3850
--all-cpus::
3951
Force system-wide collection. Scripts run without a <command>
@@ -48,39 +60,58 @@ OPTIONS
4860
Ranges of CPUs are specified with -: 0-2.
4961
Default is to trace on all online CPUs.
5062

63+
-m::
64+
--buffer-size::
65+
Set the size of per-cpu tracing buffer, <size> is expected to
66+
be a number with appended unit character - B/K/M/G.
67+
68+
--inherit::
69+
Trace children processes spawned by our target.
70+
5171
-T::
5272
--trace-funcs=::
53-
Only trace functions given by the argument. Multiple functions
54-
can be given by using this option more than once. The function
55-
argument also can be a glob pattern. It will be passed to
56-
'set_ftrace_filter' in tracefs.
73+
Select function tracer and set function filter on the given
74+
function (or a glob pattern). Multiple functions can be given
75+
by using this option more than once. The function argument also
76+
can be a glob pattern. It will be passed to 'set_ftrace_filter'
77+
in tracefs.
5778

5879
-N::
5980
--notrace-funcs=::
60-
Do not trace functions given by the argument. Like -T option,
61-
this can be used more than once to specify multiple functions
62-
(or glob patterns). It will be passed to 'set_ftrace_notrace'
63-
in tracefs.
81+
Select function tracer and do not trace functions given by the
82+
argument. Like -T option, this can be used more than once to
83+
specify multiple functions (or glob patterns). It will be
84+
passed to 'set_ftrace_notrace' in tracefs.
85+
86+
--func-opts::
87+
List of options allowed to set:
88+
call-graph - Display kernel stack trace for function tracer.
89+
irq-info - Display irq context info for function tracer.
6490

6591
-G::
6692
--graph-funcs=::
67-
Set graph filter on the given function (or a glob pattern).
68-
This is useful for the function_graph tracer only and enables
69-
tracing for functions executed from the given function.
70-
This can be used more than once to specify multiple functions.
71-
It will be passed to 'set_graph_function' in tracefs.
93+
Select function_graph tracer and set graph filter on the given
94+
function (or a glob pattern). This is useful to trace for
95+
functions executed from the given function. This can be used more
96+
than once to specify multiple functions. It will be passed to
97+
'set_graph_function' in tracefs.
7298

7399
-g::
74100
--nograph-funcs=::
75-
Set graph notrace filter on the given function (or a glob pattern).
76-
Like -G option, this is useful for the function_graph tracer only
77-
and disables tracing for function executed from the given function.
78-
This can be used more than once to specify multiple functions.
79-
It will be passed to 'set_graph_notrace' in tracefs.
101+
Select function_graph tracer and set graph notrace filter on the
102+
given function (or a glob pattern). Like -G option, this is useful
103+
for the function_graph tracer only and disables tracing for function
104+
executed from the given function. This can be used more than once to
105+
specify multiple functions. It will be passed to 'set_graph_notrace'
106+
in tracefs.
80107

81-
-D::
82-
--graph-depth=::
83-
Set max depth for function graph tracer to follow
108+
--graph-opts::
109+
List of options allowed to set:
110+
nosleep-time - Measure on-CPU time only for function_graph tracer.
111+
noirqs - Ignore functions that happen inside interrupt.
112+
verbose - Show process names, PIDs, timestamps, etc.
113+
thresh=<n> - Setup trace duration threshold in microseconds.
114+
depth=<n> - Set max depth for function graph tracer to follow.
84115

85116
SEE ALSO
86117
--------

tools/perf/Makefile.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,14 @@ ifndef NO_LIBELF
501501
CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
502502
endif
503503

504+
ifndef NO_LIBDEBUGINFOD
505+
$(call feature_check,libdebuginfod)
506+
ifeq ($(feature-libdebuginfod), 1)
507+
CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT
508+
EXTLIBS += -ldebuginfod
509+
endif
510+
endif
511+
504512
ifndef NO_DWARF
505513
ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
506514
msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);

0 commit comments

Comments
 (0)