Strange behavior of perf top with PEBS

From: Nikolay Borisov
Date: Wed Jul 20 2016 - 09:28:48 EST


Hello,

Running perf version 4.4.14.g0cb188d (no modification to the PMU/perf
code) I observed that "perf top" counts no cycles and produces no
output. After a bit of head scratching and testing I figured that
running "perf top -e cycles" actually works whereas the default option
is equivalent to running "perf top -e cycles:p". So the latter version
seems to not work on my machine.

Here is what my CPU is:

cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 6
microcode : 0x60f
cpu MHz : 2992.637
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm
constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64
monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm
dtherm tpr_shadow vnmi flexpriority

And the PEBS that is detected:
Performance Events: PEBS fmt0+, 4-deep LBR, Core2 events, Intel PMU driver

Looking at the code in arch/x86/kernel/cpu/perf_event_intel_ds.c it
seems that the number after the fmt decides the level (according to
http://man7.org/linux/man-pages/man1/perf-list.1.html#EVENT%C2%A0MODIFIERS)
So in this case fmt0 should means that :p is not supported but perf top
doesn't give any error. Increasing the number of
p's : "perf top -e cycles:pp" shows the following error:

'precise' request may not be supported. Try removing 'p' modifier.

In this case shouldn't adding even a single :p modifier cause the
aforementioned error to be printed?