perf/urgent fixes and improvements
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling, this took longer than I expected
due to the syscall rename fallout :-\
- Arnaldo
The following changes since commit 5c8dad48e4f53d6fd0a7e4f95d7c1c983374de88:
trace_kprobe: Remove warning message "Could not insert probe at..." (2018-04-17 07:54:57 +0200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo-4.17-20180420
for you to fetch changes up to 8a9fd8323087e794f1d3cd4850b393ced048bc73:
coresight: Move to SPDX identifier (2018-04-19 12:29:41 -0300)
----------------------------------------------------------------
perf/urgent fixes and improvements:
- Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE].
The percentage of preempting and non-preempting context switches help understanding the nature of workloads (CPU or IO bound) that are running on a machine. This adds the kernel facility and userspace changes needed to show this information in 'perf script' and 'perf report -D' (Alexey Budankov)
- Remove old error messages about things that unlikely to be the root cause in modern systems (Andi Kleen)
- Synchronize kernel ABI headers, v4.17-rc1 (Ingo Molnar)
- Support MAP_FIXED_NOREPLACE, noticed when updating the tools/include/ copies (Arnaldo Carvalho de Melo)
- Fixup BPF test using epoll_pwait syscall function probe, to cope with
the syscall routines renames performed in this development cycle (Arnaldo Carvalho de Melo)
- Fix sample_max_stack maximum check and do not proceed when an error has been detect, return them to avoid misidentifying errors (Jiri Olsa)
- Add '\n' at the end of parse-options error messages (Ravi Bangoria)
- Add s390 support for detailed/verbose PMU event description (Thomas Richter)
----------------------------------------------------------------
Alexey Budankov (3):
perf/core: Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE] perf report: Extend raw dump (-D) out with switch out event type perf script: Extend misc field decoding with switch out event type
Andi Kleen (4):
perf mem: Allow all record/report options perf hists browser: Clarify top/report browser help perf record: Remove misleading error suggestion perf record: Remove suggestion to enable APIC
Arnaldo Carvalho de Melo (3):
perf trace: Support MAP_FIXED_NOREPLACE
perf tests mmap: Show which tracepoint is failing
perf test BPF: Fixup BPF test using epoll_pwait syscall function probe
Ingo Molnar (1):
tools/headers: Synchronize kernel ABI headers, v4.17-rc1
Jiri Olsa (3):
perf: Return proper values for user stack errors
perf: Fix sample_max_stack maximum check
perf: Remove superfluous allocation error check
Mathieu Poirier (1):
coresight: Move to SPDX identifier
Ravi Bangoria (1):
perf tools: Add '\n' at the end of parse-options error messages
Thomas Richter (1):
perf list: Add s390 support for detailed/verbose PMU event description
include/linux/coresight-pmu.h | 13 +- include/uapi/linux/perf_event.h | 18 +- kernel/events/callchain.c | 25 +- kernel/events/core.c | 8 +- tools/arch/arm/include/uapi/asm/kvm.h | 9 + tools/arch/x86/include/asm/required-features.h | 8 +- tools/arch/x86/include/uapi/asm/kvm.h | 19 +- tools/include/linux/coresight-pmu.h | 13 +- tools/include/uapi/asm-generic/mman-common.h | 3 + tools/include/uapi/linux/bpf.h | 1 + tools/include/uapi/linux/if_link.h | 39 ++ tools/include/uapi/linux/kvm.h | 21 +- tools/include/uapi/linux/perf_event.h | 18 +- tools/include/uapi/sound/asound.h | 1 + tools/lib/subcmd/parse-options.c | 6 +- tools/perf/Documentation/perf-mem.txt | 3 + tools/perf/Documentation/perf-script.txt | 17 +- tools/perf/arch/arm/util/auxtrace.c | 13 +- tools/perf/arch/arm/util/cs-etm.c | 13 +- tools/perf/arch/arm/util/cs-etm.h | 13 +- tools/perf/arch/arm/util/pmu.c | 13 +- tools/perf/arch/x86/Makefile | 2 +- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 712 +++++++++++----------- tools/perf/builtin-mem.c | 4 +- tools/perf/builtin-script.c | 5 +- tools/perf/tests/bpf-script-example.c | 2 +- tools/perf/tests/mmap-basic.c | 2 +- tools/perf/trace/beauty/mmap.c | 3 + tools/perf/ui/browsers/hists.c | 2 +- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 3 +- tools/perf/util/cs-etm.c | 3 +- tools/perf/util/cs-etm.h | 13 +- tools/perf/util/event.c | 4 +- tools/perf/util/evsel.c | 6 +- tools/perf/util/pmu.c | 6 + 35 files changed, 545 insertions(+), 496 deletions(-)
Arnaldo Carvalho de Melo
maintainerPATCH 2/17 perf/core: Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE]
From: Alexey Budankov <[email protected]>
Store preempting context switch out event into Perf trace as a part of PERF_RECORD_SWITCH[_CPU_WIDE] record.
Percentage of preempting and non-preempting context switches help understanding the nature of workloads (CPU or IO bound) that are running on a machine;
The event is treated as preemption one when task->state value of the thread being switched out is TASK_RUNNING. Event type encoding is implemented using PERF_RECORD_MISC_SWITCH_OUT_PREEMPT bit;
--- include/uapi/linux/perf_event.h | 18 +++++++++++++++--- kernel/events/core.c | 4 ++++ tools/include/uapi/linux/perf_event.h | 18 +++++++++++++++--- 3 files changed, 34 insertions(+), 6 deletions(-)
include/uapi/linux/perf_event.h +15 -3
@@ -650,11 +650,23 @@ struct perf_event_mmap_page {#define PERF_RECORD_MISC_COMM_EXEC (1 << 13)#define PERF_RECORD_MISC_SWITCH_OUT (1 << 13)/* -* Indicates that the content of PERF_SAMPLE_IP points to -* the actual instruction that triggered the event. See also -* perf_event_attr::precise_ip. +* These PERF_RECORD_MISC_* flags below are safely reused +* for the following events: +* +* PERF_RECORD_MISC_EXACT_IP - PERF_RECORD_SAMPLE of precise events +* PERF_RECORD_MISC_SWITCH_OUT_PREEMPT - PERF_RECORD_SWITCH* events +* +* +* PERF_RECORD_MISC_EXACT_IP: +* Indicates that the content of PERF_SAMPLE_IP points to +* the actual instruction that triggered the event. See also +* perf_event_attr::precise_ip. +* +* PERF_RECORD_MISC_SWITCH_OUT_PREEMPT: +* Indicates that thread was preempted in TASK_RUNNING state. */ #define PERF_RECORD_MISC_EXACT_IP (1 << 14) +#define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT (1 << 14)/* * Reserve the last bit to indicate some extended misc field */
kernel/events/core.c +4 -0
@@ -7587,6 +7587,10 @@ static void perf_event_switch(struct task_struct *task, }, }; +if (!sched_in && task->state ==TASK_RUNNING ) + switch_event.event_id.header.misc |= +PERF_RECORD_MISC_SWITCH_OUT_PREEMPT ; +perf_iterate_sb (perf_event_switch_output, &switch_event,NULL );
tools/include/uapi/linux/perf_event.h +15 -3
@@ -650,11 +650,23 @@ struct perf_event_mmap_page {#define PERF_RECORD_MISC_COMM_EXEC (1 << 13)#define PERF_RECORD_MISC_SWITCH_OUT (1 << 13)/* -* Indicates that the content of PERF_SAMPLE_IP points to -* the actual instruction that triggered the event. See also -* perf_event_attr::precise_ip. +* These PERF_RECORD_MISC_* flags below are safely reused +* for the following events: +* +* PERF_RECORD_MISC_EXACT_IP - PERF_RECORD_SAMPLE of precise events +* PERF_RECORD_MISC_SWITCH_OUT_PREEMPT - PERF_RECORD_SWITCH* events +* +* +* PERF_RECORD_MISC_EXACT_IP: +* Indicates that the content of PERF_SAMPLE_IP points to +* the actual instruction that triggered the event. See also +* perf_event_attr::precise_ip. +* +* PERF_RECORD_MISC_SWITCH_OUT_PREEMPT: +* Indicates that thread was preempted in TASK_RUNNING state. */ #define PERF_RECORD_MISC_EXACT_IP (1 << 14) +#define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT (1 << 14)/* * Reserve the last bit to indicate some extended misc field */
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 3/17 perf report: Extend raw dump (-D) out with switch out event type
In reply to Arnaldo Carvalho de MeloFrom: Alexey Budankov <[email protected]>
Print additional 'preempt' tag for PERF_RECORD_SWITCH[_CPU_WIDE] OUT records when event header misc field contains PERF_RECORD_MISC_SWITCH_OUT_PREEMPT bit set designating preemption context switch out event:
tools/perf/perf report -D -i perf.data | grep _SWITCH
0 768361415226 0x27f076 [0x28]: PERF_RECORD_SWITCH_CPU_WIDE IN prev pid/tid: 8/8 4 768362216813 0x28f45e [0x28]: PERF_RECORD_SWITCH_CPU_WIDE OUT next pid/tid: 0/0 4 768362217824 0x28f486 [0x28]: PERF_RECORD_SWITCH_CPU_WIDE IN prev pid/tid: 4073/4073 0 768362414027 0x27f0ce [0x28]: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt next pid/tid: 8/8 0 768362414367 0x27f0f6 [0x28]: PERF_RECORD_SWITCH_CPU_WIDE IN prev pid/tid: 0/0
--- tools/perf/util/event.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/event.c +3 -1
@@ -1421,7 +1421,9 @@ size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp)size_t perf_event__fprintf_switch (union perf_event *event,FILE *fp) {bool out = event->header.misc &PERF_RECORD_MISC_SWITCH_OUT ; -const char *in_out = out ?"OUT" :"IN " ; +const char *in_out = !out ?"IN " : + !(event->header.misc &PERF_RECORD_MISC_SWITCH_OUT_PREEMPT ) ? +"OUT " :"OUT preempt" ;if (event->header.type ==PERF_RECORD_SWITCH )return fprintf (fp," %s\n" , in_out);
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 4/17 perf script: Extend misc field decoding with switch out event type
In reply to Arnaldo Carvalho de MeloFrom: Alexey Budankov <[email protected]>
Append 'p' sign to 'S' tag designating the type of context switch out event so 'Sp' means preemption context switch. Documentation is extended to cover new presentation changes.
$ perf script --show-switch-events -F +misc -I -i perf.data:
hdparm 4073 [004] U 762.198265: 380194 cycles:ppp: 7faf727f5a23 strchr (/usr/lib64/ld-2.26.so)
hdparm 4073 [004] K 762.198366: 441572 cycles:ppp: ffffffffb9218435 alloc_set_pte (/lib/modules/4.16.0-rc6+/build/vmlinux)
hdparm 4073 [004] S 762.198391: PERF_RECORD_SWITCH_CPU_WIDE OUT next pid/tid: 0/0
swapper 0 [004] 762.198392: PERF_RECORD_SWITCH_CPU_WIDE IN prev pid/tid: 4073/4073
swapper 0 [004] Sp 762.198477: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt next pid/tid: 4073/4073
hdparm 4073 [004] 762.198478: PERF_RECORD_SWITCH_CPU_WIDE IN prev pid/tid: 0/0
swapper 0 [007] K 762.198514: 2303073 cycles:ppp: ffffffffb98b0c66 intel_idle (/lib/modules/4.16.0-rc6+/build/vmlinux)
swapper 0 [007] Sp 762.198561: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt next pid/tid: 1134/1134
kworker/u16:18 1134 [007] 762.198562: PERF_RECORD_SWITCH_CPU_WIDE IN prev pid/tid: 0/0
kworker/u16:18 1134 [007] S 762.198567: PERF_RECORD_SWITCH_CPU_WIDE OUT next pid/tid: 0/0--- tools/perf/Documentation/perf-script.txt | 17 +++++++++-------- tools/perf/builtin-script.c | 5 ++++- 2 files changed, 13 insertions(+), 9 deletions(-)
tools/perf/Documentation/perf-script.txt +9 -8
@@ -228,14 +228,15 @@ OPTIONS For sample events it's possible to display misc field with -F +misc option, following letters are displayed for each bit: - PERF_RECORD_MISC_KERNEL K - PERF_RECORD_MISC_USER U - PERF_RECORD_MISC_HYPERVISOR H - PERF_RECORD_MISC_GUEST_KERNEL G - PERF_RECORD_MISC_GUEST_USER g - PERF_RECORD_MISC_MMAP_DATA* M - PERF_RECORD_MISC_COMM_EXEC E - PERF_RECORD_MISC_SWITCH_OUT S + PERF_RECORD_MISC_KERNEL K + PERF_RECORD_MISC_USER U + PERF_RECORD_MISC_HYPERVISOR H + PERF_RECORD_MISC_GUEST_KERNEL G + PERF_RECORD_MISC_GUEST_USER g + PERF_RECORD_MISC_MMAP_DATA* M + PERF_RECORD_MISC_COMM_EXEC E + PERF_RECORD_MISC_SWITCH_OUT S + PERF_RECORD_MISC_SWITCH_OUT_PREEMPT Sp $ perf script -F +misc ... sched-messaging 1414 K 28690.636582: 4590 cycles ...
tools/perf/builtin-script.c +4 -1
@@ -657,8 +657,11 @@ static int perf_sample__fprintf_start(struct perf_sample *sample,break ;case PERF_RECORD_SWITCH :case PERF_RECORD_SWITCH_CPU_WIDE : -if (has (SWITCH_OUT )) +if (has (SWITCH_OUT )) { ret +=fprintf (fp,"S" ); +if (sample->misc &PERF_RECORD_MISC_SWITCH_OUT_PREEMPT ) + ret +=fprintf (fp,"p" ); + }default :break ; }
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 5/17 perf list: Add s390 support for detailed/verbose PMU event description
In reply to Arnaldo Carvalho de MeloFrom: Thomas Richter <[email protected]>
'perf list' with flags -d and -v print a description (-d) or a very verbose explanation (-v) of CPU specific counter events. These descriptions are provided with the json files in directory pmu-events/arch/s390/*.json.
Display of these descriptions on s390 requires the corresponding json files.
On s390 this does not work because function is_pmu_core() does not detect the s390 directory name where the CPU specific events are listed. On x86 it is:
/sys/bus/event_source/devices/cpu
whereas on s390 it is:
/sys/bus/event_source/devices/cpum_cf
/sys/bus/event_source/devices/cpum_sf
Fix this by adding s390 directory name testing to function is_pmu_core(). This is the same approach as taken for the ARM platform.
Output before:
[root@s35lp76 perf]# ./perf list -d pmu
List of pre-defined events (to be used in -e):
cpum_cf/AES_BLOCKED_CYCLES/ [Kernel PMU event] cpum_cf/AES_BLOCKED_FUNCTIONS/ [Kernel PMU event] cpum_cf/AES_CYCLES/ [Kernel PMU event] cpum_cf/AES_FUNCTIONS/ [Kernel PMU event] .... cpum_cf/TX_NC_TEND/ [Kernel PMU event] cpum_cf/VX_BCD_EXECUTION_SLOTS/ [Kernel PMU event] cpum_sf/SF_CYCLES_BASIC/ [Kernel PMU event]
Output after:
[root@s35lp76 perf]# ./perf list -d pmu
List of pre-defined events (to be used in -e):
cpum_cf/AES_BLOCKED_CYCLES/ [Kernel PMU event] cpum_cf/AES_BLOCKED_FUNCTIONS/ [Kernel PMU event] cpum_cf/AES_CYCLES/ [Kernel PMU event] cpum_cf/AES_FUNCTIONS/ [Kernel PMU event] .... cpum_cf/TX_NC_TEND/ [Kernel PMU event] cpum_cf/VX_BCD_EXECUTION_SLOTS/ [Kernel PMU event] cpum_sf/SF_CYCLES_BASIC/ [Kernel PMU event]
3906:
bcd_dfp_execution_slots
[BCD DFP Execution Slots]
decimal_instructions
[Decimal Instructions]
dtlb2_gpage_writes
[DTLB2 GPAGE Writes]
dtlb2_hpage_writes
[DTLB2 HPAGE Writes]
dtlb2_misses
[DTLB2 Misses]
dtlb2_writes
[DTLB2 Writes]
itlb2_misses
[ITLB2 Misses]
itlb2_writes
[ITLB2 Writes]
l1c_tlb2_misses
[L1C TLB2 Misses]
.....
cfvn 3:
cpu_cycles
[CPU Cycles]
instructions
[Instructions]
l1d_dir_writes
[L1D Directory Writes]
l1d_penalty_cycles
[L1D Penalty Cycles]
l1i_dir_writes
[L1I Directory Writes]
l1i_penalty_cycles
[L1I Penalty Cycles]
problem_state_cpu_cycles
[Problem State CPU Cycles]
problem_state_instructions
[Problem State Instructions]
....
csvn generic:
aes_blocked_cycles
[AES Blocked Cycles]
aes_blocked_functions
[AES Blocked Functions]
aes_cycles
[AES Cycles]
aes_functions
[AES Functions]
dea_blocked_cycles
[DEA Blocked Cycles]
dea_blocked_functions
[DEA Blocked Functions]
....
--- tools/perf/util/pmu.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/util/pmu.c +6 -0
@@ -562,6 +562,12 @@ static int is_pmu_core(const char *name)if (stat (path, &st) ==0 )return 1 ; +/* Look for cpu sysfs (specific to s390) */ +scnprintf (path,PATH_MAX ,"%s/bus/event_source/devices/%s" , + sysfs, name); +if (stat (path, &st) ==0 && !strncmp (name,"cpum_" ,5 )) +return 1 ; +return 0 ; }
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 6/17 perf: Return proper values for user stack errors
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Return immediately when we find issue in the user stack checks. The error value could get overwritten by following check for PERF_SAMPLE_REGS_INTR.
--- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/events/core.c +2 -2
@@ -10209,9 +10209,9 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,* __u16 sample size limit. */ if (attr->sample_stack_user >=USHRT_MAX ) - ret = -EINVAL ; +return -EINVAL ;else if (!IS_ALIGNED (attr->sample_stack_user,sizeof (u64))) - ret = -EINVAL ; +return -EINVAL ; }if (!attr->sample_max_stack)
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 7/17 perf: Fix sample_max_stack maximum check
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
The syzbot hit KASAN bug in perf_callchain_store having the entry stored behind the allocated bounds [1].
We miss the sample_max_stack check for the initial event that allocates callchain buffers. This missing check allows to create an event with sample_max_stack value bigger than the global sysctl maximum:
# sysctl -a | grep perf_event_max_stack kernel.perf_event_max_stack = 127
# perf record -vv -C 1 -e cycles/max-stack=256/ kill
...
perf_event_attr:
size 112
...
sample_max_stack 256
------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 1 group_fd -1 flags 0x8 = 4Note the '-C 1', which forces perf record to create just single event. Otherwise it opens event for every cpu, then the sample_max_stack check fails on the second event and all's fine.
The fix is to run the sample_max_stack check also for the first event with callchains.
[1] https://marc.info/?l=linux-kernel&m=152352732920874&w=2
--- kernel/events/callchain.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
kernel/events/callchain.c +12 -9
@@ -119,19 +119,22 @@ int get_callchain_buffers(int event_max_stack) goto exit; } +/* +* If requesting per event more than the global cap, +* return a different error to help userspace figure +* this out. +* +* And also do it here so that we have &callchain_mutex held. +*/ +if (event_max_stack > sysctl_perf_event_max_stack) { + err = -EOVERFLOW ; + goto exit; + } +if (count >1 ) {/* If the allocation failed, give up */ if (!callchain_cpus_entries) err = -ENOMEM ; -/* -* If requesting per event more than the global cap, -* return a different error to help userspace figure -* this out. -* -* And also do it here so that we have &callchain_mutex held. -*/ -if (event_max_stack > sysctl_perf_event_max_stack) - err = -EOVERFLOW ; goto exit; }
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 8/17 perf: Remove superfluous allocation error check
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
If the get_callchain_buffers fails to allocate the buffer it will decrease the nr_callchain_events right away.
There's no point of checking the allocation error for nr_callchain_events > 1. Removing that check.
--- kernel/events/callchain.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
kernel/events/callchain.c +2 -8
@@ -131,14 +131,8 @@ int get_callchain_buffers(int event_max_stack) goto exit; } -if (count >1 ) { -/* If the allocation failed, give up */ -if (!callchain_cpus_entries) - err = -ENOMEM ; - goto exit; - } - - err =alloc_callchain_buffers (); +if (count ==1 ) + err =alloc_callchain_buffers (); exit:if (err)atomic_dec (&nr_callchain_events);
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 9/17 perf trace: Support MAP_FIXED_NOREPLACE
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Introduced in a4ff8e8620d3 ("mm: introduce MAP_FIXED_NOREPLACE"), and now that we have that define in the just syncronized tools/arch/*/include/uapi/asm/mman.h files, add support for it.
This should really transition to autogeneration of string tables as done for various other things:
$ ls /tmp/build/perf/trace/beauty/generated/*.c
arch_errno_name_array.c kcmp_type_array.c madvise_behavior_array.c
pkey_alloc_access_rights_array.c prctl_option_array.c
$ head /tmp/build/perf/trace/beauty/generated/madvise_behavior_array.c
static const char *madvise_advices[] = {
[0] = "NORMAL",
[1] = "RANDOM",
[2] = "SEQUENTIAL",
[3] = "WILLNEED",
[4] = "DONTNEED",
[8] = "FREE",
[9] = "REMOVE",
[10] = "DONTFORK",
[11] = "DOFORK",
$Till then, add support for this the old way.
Also it has to be ifdef'ed, because arches like mips still don't define it. The proper solution will be to have per-arch tables for these values to support cross-analysis.
--- tools/perf/trace/beauty/mmap.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/trace/beauty/mmap.c +3 -0
@@ -54,6 +54,9 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,P_MMAP_FLAG (EXECUTABLE );P_MMAP_FLAG (FILE );P_MMAP_FLAG (FIXED ); +#ifdef MAP_FIXED_NOREPLACE +P_MMAP_FLAG (FIXED_NOREPLACE ); +#endif P_MMAP_FLAG (GROWSDOWN );P_MMAP_FLAG (HUGETLB );P_MMAP_FLAG (LOCKED );
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 10/17 perf mem: Allow all record/report options
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
For perf mem report / perf mem record, pass all unknown options through to the underlying report/record commands. This makes things like
perf mem record -a sleep 1
work. Matches how c2c and other tools work.
--- tools/perf/Documentation/perf-mem.txt | 3 +++ tools/perf/builtin-mem.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-mem.txt +3 -0
@@ -67,6 +67,9 @@ OPTIONS --phys-data:: Record/Report sample physical addresses +In addition, for report all perf report options are valid, and for record +all perf record options. + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/builtin-mem.c +2 -2
@@ -83,7 +83,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem) }; argc =parse_options (argc, argv, options, record_mem_usage, -PARSE_OPT_STOP_AT_NON_OPTION ); +PARSE_OPT_KEEP_UNKNOWN ); rec_argc = argc +9 ;/* max number of arguments */ rec_argv =calloc (rec_argc +1 ,sizeof (char *));
@@ -436,7 +436,7 @@ int cmd_mem(int argc, const char **argv) } argc =parse_options_subcommand (argc, argv, mem_options, mem_subcommands, - mem_usage,PARSE_OPT_STOP_AT_NON_OPTION ); + mem_usage,PARSE_OPT_KEEP_UNKNOWN );if (!argc || !(strncmp (argv[0 ],"rec" ,3 ) || mem.operation))usage_with_options (mem_usage, mem_options);
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 11/17 perf hists browser: Clarify top/report browser help
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Clarify in the browser help that ESC in tui mode may go back to the previous screen instead of just exiting (was not clear to me)
--- tools/perf/ui/browsers/hists.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +1 -1
@@ -2714,7 +2714,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,"h/?/F1 Show this window\n" \"UP/DOWN/PGUP\n" \"PGDN/SPACE Navigate\n" \ -"q/ESC/CTRL+C Exit browser\n\n" \ +"q/ESC/CTRL+C Exit browser or go back to previous screen\n\n" \"For multiple event sessions:\n\n" \"TAB/UNTAB Switch events\n\n" \"For symbolic views (--sort has sym):\n\n" \
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 12/17 perf record: Remove misleading error suggestion
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
When perf record encounters an error setting up an event it suggests to enable CONFIG_PERF_EVENTS. This is misleading because:
- Usually it is enabled (it is really hard to disable on x86)
- The problem is usually somewhere else, e.g. the CPU is not supported or an invalid configuration has been used.
Remove the misleading suggestion.
--- tools/perf/util/evsel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -2
@@ -2894,8 +2894,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,return scnprintf (msg, size,"The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n" -"/bin/dmesg may provide additional information.\n" -"No CONFIG_PERF_EVENTS=y kernel support configured?" , +"/bin/dmesg | grep -i perf may provide additional information.\n" , err,str_error_r (err, sbuf,sizeof (sbuf)),perf_evsel__name (evsel)); }
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 13/17 perf record: Remove suggestion to enable APIC
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
'perf record' suggests to enable the APIC on errors.
APIC is practically always used today and the problem is usually somewhere else.
Just remove the outdated suggestion.
--- tools/perf/util/evsel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/evsel.c +1 -2
@@ -2870,8 +2870,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,#if defined(__i386__) || defined(__x86_64__)if (evsel->attr.type ==PERF_TYPE_HARDWARE )return scnprintf (msg, size,"%s" , -"No hardware sampling interrupt available.\n" -"No APIC? If so then you can boot the kernel with the \"lapic\" boot parameter to force-enable it." ); +"No hardware sampling interrupt available.\n" );#endif break ;case EBUSY :
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 14/17 perf tools: Add '\n' at the end of parse-options error messages
In reply to Arnaldo Carvalho de MeloFrom: Ravi Bangoria <[email protected]>
Few error messages does not have '\n' at the end and thus next prompt gets printed in the same line. Ex,
linux~$ perf buildid-cache -verbose --add ./a.out
Error: did you mean --verbose (with two dashes ?)linux~$
Fix it.
--- tools/lib/subcmd/parse-options.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/lib/subcmd/parse-options.c +3 -3
@@ -433,7 +433,7 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,if (ambiguous_option) { fprintf(stderr, - " Error: Ambiguous option: %s (could be --%s%s or --%s%s)", + " Error: Ambiguous option: %s (could be --%s%s or --%s%s)\n", arg, (ambiguous_flags & OPT_UNSET) ? "no-" : "", ambiguous_option->long_name,
@@ -458,7 +458,7 @@ static void check_typos(const char *arg, const struct option *options)return ;if (strstarts (arg,"no-" )) { -fprintf (stderr," Error: did you mean `--%s` (with two dashes ?)" , arg); +fprintf (stderr," Error: did you mean `--%s` (with two dashes ?)\n" , arg);exit (129 ); }
@@ -466,7 +466,7 @@ static void check_typos(const char *arg, const struct option *options)if (!options->long_name)continue ;if (strstarts (options->long_name, arg)) { -fprintf (stderr," Error: did you mean `--%s` (with two dashes ?)" , arg); +fprintf (stderr," Error: did you mean `--%s` (with two dashes ?)\n" , arg);exit (129 ); } }
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 15/17 perf tests mmap: Show which tracepoint is failing
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
In the 'perf test "mmap interface"' we try creating events for several tracepoints, but when perf_evsel__new() fails we're not showing which one is failing, fix that to help diagnosing problems, such as the syscall tracepoints ones being found and fixes in this merge window.
Now the failing tests shows:
# perf test -v "mmap interface" 4: Read samples using the mmap interface : --- start --- test child forked, pid 14311 <SNIP> perf_evsel__new(sys_enter_getppid) test child finished with -1 ---- end ---- Read samples using the mmap interface: FAILED! #
Now to check why the syscalls:sys_enter_getppid is failing...
# ls -la /sys/kernel/debug/tracing/events/syscalls/sys_enter_getppid ls: cannot access '/sys/kernel/debug/tracing/events/syscalls/sys_enter_getppid': No such file or directory #
--- tools/perf/tests/mmap-basic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/mmap-basic.c +1 -1
@@ -75,7 +75,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unusesnprintf (name,sizeof (name),"sys_enter_%s" , syscall_names[i]); evsels[i] =perf_evsel__newtp ("syscalls" , name);if (IS_ERR (evsels[i])) { -pr_debug ("perf_evsel__new\n" ); +pr_debug ("perf_evsel__new(%s)\n" , name); goto out_delete_evlist; }
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 16/17 perf test BPF: Fixup BPF test using epoll_pwait syscall function probe
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Since e145242ea0df ("syscalls/core, syscalls/x86: Clean up syscall stub naming convention") changed the main syscall function for 'epoll_pwait' to something other than the expected 'SyS_epoll_pwait the' 'perf test BPF' entries started failing, fix it by using something called from the main syscall function instead, 'epoll_wait', which should keep this test working in older kernels too.
Before:
# perf test BPF 40: BPF filter : 40.1: Basic BPF filtering : FAILED! 40.2: BPF pinning : Skip 40.3: BPF prologue generation : Skip 40.4: BPF relocation checker : Skip
If we use -v for that test we see the problem:
Probe point 'SyS_epoll_pwait' not found.
After:
# perf test BPF 40: BPF filter : 40.1: Basic BPF filtering : Ok 40.2: BPF pinning : Ok 40.3: BPF prologue generation : Ok 40.4: BPF relocation checker : Ok #
--- tools/perf/tests/bpf-script-example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/bpf-script-example.c +1 -1
@@ -31,7 +31,7 @@ struct bpf_map_def SEC("maps") flip_table = { .max_entries = 1, }; -SEC("func=SyS_epoll_pwait") +SEC("func=do_epoll_wait")int bpf_func__SyS_epoll_pwait (void *ctx) {int ind =0 ;
Signature · 1 line
2.14.3
Arnaldo Carvalho de Melo
maintainerPATCH 17/17 coresight: Move to SPDX identifier
In reply to Arnaldo Carvalho de MeloFrom: Mathieu Poirier <[email protected]>
Move CoreSight headers to the SPDX identifier.
--- include/linux/coresight-pmu.h | 13 +------------ tools/include/linux/coresight-pmu.h | 13 +------------ tools/perf/arch/arm/util/auxtrace.c | 13 +------------ tools/perf/arch/arm/util/cs-etm.c | 13 +------------ tools/perf/arch/arm/util/cs-etm.h | 13 +------------ tools/perf/arch/arm/util/pmu.c | 13 +------------ tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 3 +-- tools/perf/util/cs-etm.c | 3 +-- tools/perf/util/cs-etm.h | 13 +------------ 9 files changed, 9 insertions(+), 88 deletions(-)
include/linux/coresight-pmu.h +1 -12
@@ -1,18 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright(C) 2015 Linaro Limited. All rights reserved. * Author: Mathieu Poirier <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINUX_CORESIGHT_PMU_H
tools/include/linux/coresight-pmu.h +1 -12
@@ -1,18 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright(C) 2015 Linaro Limited. All rights reserved. * Author: Mathieu Poirier <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _LINUX_CORESIGHT_PMU_H
tools/perf/arch/arm/util/auxtrace.c +1 -12
@@ -1,18 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright(C) 2015 Linaro Limited. All rights reserved. * Author: Mathieu Poirier <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h>
tools/perf/arch/arm/util/cs-etm.c +1 -12
@@ -1,18 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright(C) 2015 Linaro Limited. All rights reserved. * Author: Mathieu Poirier <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. */ #include <api/fs/fs.h>
tools/perf/arch/arm/util/cs-etm.h +1 -12
@@ -1,18 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright(C) 2015 Linaro Limited. All rights reserved. * Author: Mathieu Poirier <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INCLUDE__PERF_CS_ETM_H__
tools/perf/arch/arm/util/pmu.c +1 -12
@@ -1,18 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright(C) 2015 Linaro Limited. All rights reserved. * Author: Mathieu Poirier <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h>
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright(C) 2015-2018 Linaro Limited. * * Author: Tor Jeremiassen <[email protected]>
tools/perf/util/cs-etm.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright(C) 2015-2018 Linaro Limited. * * Author: Tor Jeremiassen <[email protected]>
tools/perf/util/cs-etm.h +1 -12
@@ -1,18 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright(C) 2015 Linaro Limited. All rights reserved. * Author: Mathieu Poirier <[email protected]> -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 as published by -* the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -* more details. -* -* You should have received a copy of the GNU General Public License along with -* this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INCLUDE__UTIL_PERF_CS_ETM_H__
Signature · 1 line
2.14.3
Quoted 110 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling, this took longer than I expected
due to the syscall rename fallout :-\- Arnaldo
The following changes since commit
5c8dad48e4f53d6fd0a7e4f95d7c1c983374de88:
trace_kprobe: Remove warning message "Could not insert probe at..." (2018-04-17 07:54:57 +0200)are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-urgent-for-mingo-4.17-20180420for you to fetch changes up to
8a9fd8323087e794f1d3cd4850b393ced048bc73:coresight: Move to SPDX identifier (2018-04-19 12:29:41 -0300)
----------------------------------------------------------------
perf/urgent fixes and improvements:- Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE].
The percentage of preempting and non-preempting context switches help understanding the nature of workloads (CPU or IO bound) that are running on a machine. This adds the kernel facility and userspace changes needed to show this information in 'perf script' and 'perf report -D' (Alexey Budankov)- Remove old error messages about things that unlikely to be the root cause in modern systems (Andi Kleen)
- Synchronize kernel ABI headers, v4.17-rc1 (Ingo Molnar)
- Support
MAP_FIXED_NOREPLACE, noticed when updating thetools/include/copies (Arnaldo Carvalho de Melo)- Fixup BPF test using
epoll_pwaitsyscall function probe, to cope with
the syscall routines renames performed in this development cycle (Arnaldo Carvalho de Melo)- Fix
sample_max_stackmaximum check and do not proceed when an error has been detect, return them to avoid misidentifying errors (Jiri Olsa)- Add '\n' at the end of parse-options error messages (Ravi Bangoria)
- Add s390 support for detailed/verbose PMU event description (Thomas Richter)
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Alexey Budankov (3):
perf/core: Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE] perf report: Extend raw dump (-D) out with switch out event type perf script: Extend misc field decoding with switch out event typeAndi Kleen (4):
perf mem: Allow all record/report options perf hists browser: Clarify top/report browser help perf record: Remove misleading error suggestion perf record: Remove suggestion to enable APICArnaldo Carvalho de Melo (3):
perf trace: SupportMAP_FIXED_NOREPLACE
perf tests mmap: Show which tracepoint is failing
perf test BPF: Fixup BPF test usingepoll_pwaitsyscall function probeIngo Molnar (1):
tools/headers: Synchronize kernel ABI headers, v4.17-rc1Jiri Olsa (3):
perf: Return proper values for user stack errors
perf: Fixsample_max_stackmaximum check
perf: Remove superfluous allocation error checkMathieu Poirier (1):
coresight: Move to SPDX identifierRavi Bangoria (1):
perf tools: Add '\n' at the end of parse-options error messagesThomas Richter (1):
perf list: Add s390 support for detailed/verbose PMU event descriptioninclude/linux/coresight-pmu.h | 13 +- include/uapi/linux/perf_event.h | 18 +- kernel/events/callchain.c | 25 +- kernel/events/core.c | 8 +- tools/arch/arm/include/uapi/asm/kvm.h | 9 + tools/arch/x86/include/asm/required-features.h | 8 +- tools/arch/x86/include/uapi/asm/kvm.h | 19 +- tools/include/linux/coresight-pmu.h | 13 +- tools/include/uapi/asm-generic/mman-common.h | 3 + tools/include/uapi/linux/bpf.h | 1 + tools/include/uapi/linux/if_link.h | 39 ++ tools/include/uapi/linux/kvm.h | 21 +- tools/include/uapi/linux/perf_event.h | 18 +- tools/include/uapi/sound/asound.h | 1 + tools/lib/subcmd/parse-options.c | 6 +- tools/perf/Documentation/perf-mem.txt | 3 + tools/perf/Documentation/perf-script.txt | 17 +- tools/perf/arch/arm/util/auxtrace.c | 13 +- tools/perf/arch/arm/util/cs-etm.c | 13 +- tools/perf/arch/arm/util/cs-etm.h | 13 +- tools/perf/arch/arm/util/pmu.c | 13 +- tools/perf/arch/x86/Makefile | 2 +- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 712 +++++++++++----------- tools/perf/builtin-mem.c | 4 +- tools/perf/builtin-script.c | 5 +- tools/perf/tests/bpf-script-example.c | 2 +- tools/perf/tests/mmap-basic.c | 2 +- tools/perf/trace/beauty/mmap.c | 3 +
Quoted 8 lines
tools/perf/ui/browsers/hists.c | 2 +- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 3 +- tools/perf/util/cs-etm.c | 3 +- tools/perf/util/cs-etm.h | 13 +- tools/perf/util/event.c | 4 +- tools/perf/util/evsel.c | 6 +- tools/perf/util/pmu.c | 6 + 35 files changed, 545 insertions(+), 496 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo