Skip to content

Commit 754fe00

Browse files
author
Ingo Molnar
committed
Merge tag 'perf-core-for-mingo-4.15-20171117' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: - Optimize sample parsing for ordering events, where we don't need to parse all the PERF_SAMPLE_ bits, just the ones leading to the timestamp needed to reorder events (Jiri Olsa) - Use a dummy event to ask for PERF_RECORD_{MMAP,COMM,EXEC} with 'perf record --delay', when the events asked by the user will only be enabled after the workload is started and the requested delay passes, so we need to add the dummy event and have it .enabled_on_exec. This then allows us to resolve symbols for the DSO executable MMAPs setup while we wait for the delay (Arnaldo Carvalho de Melo) - Synchronize kcmp.h and prctl.h ABI headers wrt SPDX tags (Arnaldo Carvalho de Melo) - Generalize the annotation code to support other source information besides objdump/DWARF obtained ones, starting with python scripts, that will is slated to be merged soon (Jiri Olsa) - Advance the source code lines to right after the column with the address in asm lines (Jiri Olsa) - Fix terminal dimensions resizing signal handling in 'perf top --stdio' (Jiri Olsa) - Improve error messages for PMU events (Kim Phillips) - Fix 'perf record' -c/-F options for cpu event aliases (Andi Kleen) - Enable type checking for perf_evsel_config_term types (Andi Kleen) - Call machine__exit() at 'perf trace' exit, so as to remove temporary files related to VDSO (Andrei Vagin) - Add "reject" option to parse-events.l, fixing the build with newer flex releases. Noticed with flex 2.6.4 on Alpine Linux 3.6 and Edge (Jiri Olsa) - Document some missing perf.data headers (Andi Kleen) - Allow printing period for non freq mod groups (Andi Kleen) - Do not warn the user about kernel.kptr_restrict when not sampling the kernel (Arnaldo Carvalho de Melo) - Fix bug in 'perf help' introduced during conversion to strstart() (Namhyung Kim) - Do not truncate ASM instruction mnemonics at 6 characters in the annotation output, PowerPC has long ones (Ravi Bangoria) - Document some missing command line options (Sihyeon Jang) - Update POWER9 vendor event tables (Sukadev Bhattiprolu) - Fix 'perf test' shell entries on s390x, where the 'openat' syscall is used instead of 'open' in one of the tests and - No need to use overwrite mmap mode in 'perf test', those tests do not generate massive amount of events to fill the ring buffer (Wang Nan) - Add missing command line options (mostly --force/-f) to the man pages (Sihyeon Jang) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
2 parents b29c6ef + 05d3f1a commit 754fe00

Some content is hidden

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

52 files changed

+1028
-920
lines changed

kernel/events/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6640,6 +6640,7 @@ static void perf_event_namespaces_output(struct perf_event *event,
66406640
struct perf_namespaces_event *namespaces_event = data;
66416641
struct perf_output_handle handle;
66426642
struct perf_sample_data sample;
6643+
u16 header_size = namespaces_event->event_id.header.size;
66436644
int ret;
66446645

66456646
if (!perf_event_namespaces_match(event))
@@ -6650,7 +6651,7 @@ static void perf_event_namespaces_output(struct perf_event *event,
66506651
ret = perf_output_begin(&handle, event,
66516652
namespaces_event->event_id.header.size);
66526653
if (ret)
6653-
return;
6654+
goto out;
66546655

66556656
namespaces_event->event_id.pid = perf_event_pid(event,
66566657
namespaces_event->task);
@@ -6662,6 +6663,8 @@ static void perf_event_namespaces_output(struct perf_event *event,
66626663
perf_event__output_id_sample(event, &handle, &sample);
66636664

66646665
perf_output_end(&handle);
6666+
out:
6667+
namespaces_event->event_id.header.size = header_size;
66656668
}
66666669

66676670
static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,

tools/include/uapi/linux/kcmp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12
#ifndef _UAPI_LINUX_KCMP_H
23
#define _UAPI_LINUX_KCMP_H
34

tools/include/uapi/linux/prctl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12
#ifndef _LINUX_PRCTL_H
23
#define _LINUX_PRCTL_H
34

tools/perf/Documentation/perf-buildid-cache.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ OPTIONS
2424
-a::
2525
--add=::
2626
Add specified file to the cache.
27+
-f::
28+
--force::
29+
Don't complain, do it.
2730
-k::
2831
--kcore::
2932
Add specified kcore file to the cache. For the current host that is

tools/perf/Documentation/perf-evlist.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ OPTIONS
2020
--input=::
2121
Input file name. (default: perf.data unless stdin is a fifo)
2222

23+
-f::
24+
--force::
25+
Don't complain, do it.
26+
2327
-F::
2428
--freq=::
2529
Show just the sample frequency used for each event.

tools/perf/Documentation/perf-inject.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ include::itrace.txt[]
6060
found in the jitdumps files captured in the input perf.data file. Use this option
6161
if you are monitoring environment using JIT runtimes, such as Java, DART or V8.
6262

63+
-f::
64+
--force::
65+
Don't complain, do it.
66+
6367
SEE ALSO
6468
--------
6569
linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-archive[1]

tools/perf/Documentation/perf-lock.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ COMMON OPTIONS
4242
--dump-raw-trace::
4343
Dump raw trace in ASCII.
4444

45+
-f::
46+
--force::
47+
Don't complan, do it.
48+
4549
REPORT OPTIONS
4650
--------------
4751

tools/perf/Documentation/perf-sched.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ OPTIONS
7474
--dump-raw-trace=::
7575
Display verbose dump of the sched data.
7676

77+
-f::
78+
--force::
79+
Don't complain, do it.
80+
7781
OPTIONS for 'perf sched map'
7882
----------------------------
7983

tools/perf/Documentation/perf-timechart.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ TIMECHART OPTIONS
5050
-p::
5151
--process::
5252
Select the processes to display, by name or PID
53-
53+
-f::
54+
--force::
55+
Don't complain, do it.
5456
--symfs=<directory>::
5557
Look for files with symbols relative to this directory.
5658
-n::

tools/perf/Documentation/perf-top.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ INTERACTIVE PROMPTING KEYS
268268
[S]::
269269
Stop annotation, return to full profile display.
270270

271+
[K]::
272+
Hide kernel symbols.
273+
274+
[U]::
275+
Hide user symbols.
276+
271277
[z]::
272278
Toggle event count zeroing across display updates.
273279

tools/perf/Documentation/perf-trace.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-
8686
In per-thread mode with inheritance mode on (default), Events are captured only when
8787
the thread executes on the designated CPUs. Default is to monitor all CPUs.
8888

89-
--duration:
89+
--duration::
9090
Show only events that had a duration greater than N.M ms.
9191

92-
--sched:
92+
--sched::
9393
Accrue thread runtime and provide a summary at the end of the session.
9494

95-
-i
96-
--input
95+
-i::
96+
--input::
9797
Process events from a given perf data file.
9898

99-
-T
100-
--time
99+
-T::
100+
--time::
101101
Print full timestamp rather time relative to first sample.
102102

103103
--comm::
@@ -117,6 +117,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
117117
Show tool stats such as number of times fd->pathname was discovered thru
118118
hooking the open syscall return + vfs_getname or via reading /proc/pid/fd, etc.
119119

120+
-f::
121+
--force::
122+
Don't complain, do it.
123+
120124
-F=[all|min|maj]::
121125
--pf=[all|min|maj]::
122126
Trace pagefaults. Optionally, you can specify whether you want minor,

tools/perf/Documentation/perf.data-file-format.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,29 @@ struct auxtrace_index {
238238
struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
239239
};
240240

241+
HEADER_STAT = 19,
242+
243+
This is merely a flag signifying that the data section contains data
244+
recorded from perf stat record.
245+
246+
HEADER_CACHE = 20,
247+
248+
Description of the cache hierarchy. Based on the Linux sysfs format
249+
in /sys/devices/system/cpu/cpu*/cache/
250+
251+
u32 version Currently always 1
252+
u32 number_of_cache_levels
253+
254+
struct {
255+
u32 level;
256+
u32 line_size;
257+
u32 sets;
258+
u32 ways;
259+
struct perf_header_string type;
260+
struct perf_header_string size;
261+
struct perf_header_string map;
262+
}[number_of_cache_levels];
263+
241264
other bits are reserved and should ignored for now
242265
HEADER_FEAT_BITS = 256,
243266

tools/perf/Makefile.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ else
579579
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
580580
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
581581
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
582-
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
582+
PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
583583
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
584584

585585
ifneq ($(feature-libperl), 1)

tools/perf/builtin-buildid-cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ int cmd_buildid_cache(int argc, const char **argv)
325325
"file", "kcore file to add"),
326326
OPT_STRING('r', "remove", &remove_name_list_str, "file list",
327327
"file(s) to remove"),
328-
OPT_STRING('p', "purge", &purge_name_list_str, "path list",
329-
"path(s) to remove (remove old caches too)"),
328+
OPT_STRING('p', "purge", &purge_name_list_str, "file list",
329+
"file(s) to remove (remove old caches too)"),
330330
OPT_STRING('M', "missing", &missing_filename, "file",
331331
"to find missing build ids in the cache"),
332332
OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),

tools/perf/builtin-c2c.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,9 +2224,9 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
22242224
struct hist_browser *browser;
22252225
int key = -1;
22262226
const char help[] =
2227-
" ENTER Togle callchains (if present) \n"
2228-
" n Togle Node details info \n"
2229-
" s Togle full lenght of symbol and source line columns \n"
2227+
" ENTER Toggle callchains (if present) \n"
2228+
" n Toggle Node details info \n"
2229+
" s Toggle full length of symbol and source line columns \n"
22302230
" q Return back to cacheline list \n";
22312231

22322232
/* Display compact version first. */
@@ -2303,7 +2303,7 @@ static int perf_c2c__hists_browse(struct hists *hists)
23032303
int key = -1;
23042304
const char help[] =
23052305
" d Display cacheline details \n"
2306-
" ENTER Togle callchains (if present) \n"
2306+
" ENTER Toggle callchains (if present) \n"
23072307
" q Quit \n";
23082308

23092309
browser = perf_c2c_browser__new(hists);

tools/perf/builtin-help.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static int perf_help_config(const char *var, const char *value, void *cb)
284284
add_man_viewer(value);
285285
return 0;
286286
}
287-
if (!strstarts(var, "man."))
287+
if (strstarts(var, "man."))
288288
return add_man_viewer_info(var, value);
289289

290290
return 0;
@@ -314,7 +314,7 @@ static const char *cmd_to_page(const char *perf_cmd)
314314

315315
if (!perf_cmd)
316316
return "perf";
317-
else if (!strstarts(perf_cmd, "perf"))
317+
else if (strstarts(perf_cmd, "perf"))
318318
return perf_cmd;
319319

320320
return asprintf(&s, "perf-%s", perf_cmd) < 0 ? NULL : s;

tools/perf/builtin-kvm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,20 +741,20 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
741741
u64 *mmap_time)
742742
{
743743
union perf_event *event;
744-
struct perf_sample sample;
744+
u64 timestamp;
745745
s64 n = 0;
746746
int err;
747747

748748
*mmap_time = ULLONG_MAX;
749749
while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) {
750-
err = perf_evlist__parse_sample(kvm->evlist, event, &sample);
750+
err = perf_evlist__parse_sample_timestamp(kvm->evlist, event, &timestamp);
751751
if (err) {
752752
perf_evlist__mmap_consume(kvm->evlist, idx);
753753
pr_err("Failed to parse sample\n");
754754
return -1;
755755
}
756756

757-
err = perf_session__queue_event(kvm->session, event, &sample, 0);
757+
err = perf_session__queue_event(kvm->session, event, timestamp, 0);
758758
/*
759759
* FIXME: Here we can't consume the event, as perf_session__queue_event will
760760
* point to it, and it'll get possibly overwritten by the kernel.
@@ -768,7 +768,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
768768

769769
/* save time stamp of our first sample for this mmap */
770770
if (n == 0)
771-
*mmap_time = sample.time;
771+
*mmap_time = timestamp;
772772

773773
/* limit events per mmap handled all at once */
774774
n++;

tools/perf/builtin-record.c

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,22 @@ static int record__open(struct record *rec)
339339
struct perf_evsel_config_term *err_term;
340340
int rc = 0;
341341

342+
/*
343+
* For initial_delay we need to add a dummy event so that we can track
344+
* PERF_RECORD_MMAP while we wait for the initial delay to enable the
345+
* real events, the ones asked by the user.
346+
*/
347+
if (opts->initial_delay) {
348+
if (perf_evlist__add_dummy(evlist))
349+
return -ENOMEM;
350+
351+
pos = perf_evlist__first(evlist);
352+
pos->tracking = 0;
353+
pos = perf_evlist__last(evlist);
354+
pos->tracking = 1;
355+
pos->attr.enable_on_exec = 1;
356+
}
357+
342358
perf_evlist__config(evlist, opts, &callchain_param);
343359

344360
evlist__for_each_entry(evlist, pos) {
@@ -749,17 +765,19 @@ static int record__synthesize(struct record *rec, bool tail)
749765
goto out;
750766
}
751767

752-
err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
753-
machine);
754-
WARN_ONCE(err < 0, "Couldn't record kernel reference relocation symbol\n"
755-
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
756-
"Check /proc/kallsyms permission or run as root.\n");
757-
758-
err = perf_event__synthesize_modules(tool, process_synthesized_event,
759-
machine);
760-
WARN_ONCE(err < 0, "Couldn't record kernel module information.\n"
761-
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
762-
"Check /proc/modules permission or run as root.\n");
768+
if (!perf_evlist__exclude_kernel(rec->evlist)) {
769+
err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
770+
machine);
771+
WARN_ONCE(err < 0, "Couldn't record kernel reference relocation symbol\n"
772+
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
773+
"Check /proc/kallsyms permission or run as root.\n");
774+
775+
err = perf_event__synthesize_modules(tool, process_synthesized_event,
776+
machine);
777+
WARN_ONCE(err < 0, "Couldn't record kernel module information.\n"
778+
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
779+
"Check /proc/modules permission or run as root.\n");
780+
}
763781

764782
if (perf_guest) {
765783
machines__process_guests(&session->machines,
@@ -1693,7 +1711,7 @@ int cmd_record(int argc, const char **argv)
16931711

16941712
err = -ENOMEM;
16951713

1696-
if (symbol_conf.kptr_restrict)
1714+
if (symbol_conf.kptr_restrict && !perf_evlist__exclude_kernel(rec->evlist))
16971715
pr_warning(
16981716
"WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,\n"
16991717
"check /proc/sys/kernel/kptr_restrict.\n\n"

tools/perf/builtin-report.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ static void report__warn_kptr_restrict(const struct report *rep)
441441
struct map *kernel_map = machine__kernel_map(&rep->session->machines.host);
442442
struct kmap *kernel_kmap = kernel_map ? map__kmap(kernel_map) : NULL;
443443

444+
if (perf_evlist__exclude_kernel(rep->session->evlist))
445+
return;
446+
444447
if (kernel_map == NULL ||
445448
(kernel_map->dso->hit &&
446449
(kernel_kmap->ref_reloc_sym == NULL ||

0 commit comments

Comments
 (0)