mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 19:35:18 +07:00
32ccb130f5
The kernel has a special check for a specific irq_vectors trace event. TRACE_EVENT_PERF_PERM(irq_work_exit, is_sampling_event(p_event) ? -EPERM : 0); The perf-record fails for this irq_vectors event when it is present, like when using a wildcard: root@skl:/tmp# perf record -a -e irq_vectors:* sleep 2 Error: You may not have permission to collect system-wide stats. Consider tweaking /proc/sys/kernel/perf_event_paranoid, which controls use of the performance events system by unprivileged users (without CAP_SYS_ADMIN). The current value is 2: -1: Allow use of (almost) all events by all users >= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK >= 1: Disallow CPU event access by users without CAP_SYS_ADMIN >= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN To make this setting permanent, edit /etc/sysctl.conf too, e.g.: kernel.perf_event_paranoid = -1 This patch prints out the exact sub event that failed with EPERM for wildcards to help in understanding what went wrong when this event is present: After the patch: root@skl:/tmp# perf record -a -e irq_vectors:* sleep 2 Error: No permission to enable irq_vectors:irq_work_exit event. You may not have permission to collect system-wide stats. ...... Committer notes: So we have a lot of irq_vectors events: [root@jouet ~]# perf list irq_vectors:* List of pre-defined events (to be used in -e): irq_vectors:call_function_entry [Tracepoint event] irq_vectors:call_function_exit [Tracepoint event] irq_vectors:call_function_single_entry [Tracepoint event] irq_vectors:call_function_single_exit [Tracepoint event] irq_vectors:deferred_error_apic_entry [Tracepoint event] irq_vectors:deferred_error_apic_exit [Tracepoint event] irq_vectors:error_apic_entry [Tracepoint event] irq_vectors:error_apic_exit [Tracepoint event] irq_vectors:irq_work_entry [Tracepoint event] irq_vectors:irq_work_exit [Tracepoint event] irq_vectors:local_timer_entry [Tracepoint event] irq_vectors:local_timer_exit [Tracepoint event] irq_vectors:reschedule_entry [Tracepoint event] irq_vectors:reschedule_exit [Tracepoint event] irq_vectors:spurious_apic_entry [Tracepoint event] irq_vectors:spurious_apic_exit [Tracepoint event] irq_vectors:thermal_apic_entry [Tracepoint event] irq_vectors:thermal_apic_exit [Tracepoint event] irq_vectors:threshold_apic_entry [Tracepoint event] irq_vectors:threshold_apic_exit [Tracepoint event] irq_vectors:x86_platform_ipi_entry [Tracepoint event] irq_vectors:x86_platform_ipi_exit [Tracepoint event] # And some may be sampled: [root@jouet ~]# perf record -e irq_vectors:local* sleep 20s [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.020 MB perf.data (2 samples) ] [root@jouet ~]# perf report -D | egrep 'stats:|events:' Aggregated stats: TOTAL events: 155 MMAP events: 144 COMM events: 2 EXIT events: 1 SAMPLE events: 2 MMAP2 events: 4 FINISHED_ROUND events: 1 TIME_CONV events: 1 irq_vectors:local_timer_entry stats: TOTAL events: 1 SAMPLE events: 1 irq_vectors:local_timer_exit stats: TOTAL events: 1 SAMPLE events: 1 [root@jouet ~]# But, as shown in the tracepoint definition at the start of this message, some, like "irq_vectors:irq_work_exit", may not be sampled, just counted, i.e. if we try to sample, as when using 'perf record', we get an error: [root@jouet ~]# perf record -e irq_vectors:irq_work_exit Error: You may not have permission to collect system-wide stats. Consider tweaking /proc/sys/kernel/perf_event_paranoid, <SNIP> The error message is misleading, this patch will help in pointing out what is the event causing such an error, but the error message needs improvement, i.e. we need to figure out a way to check if a tracepoint is counting only, like this one, when all we can do is to count it with 'perf stat', at most printing the delta using interval printing, as in: [root@jouet ~]# perf stat -I 5000 -e irq_vectors:irq_work_* # time counts unit events 5.000168871 0 irq_vectors:irq_work_entry 5.000168871 0 irq_vectors:irq_work_exit 10.000676730 0 irq_vectors:irq_work_entry 10.000676730 0 irq_vectors:irq_work_exit 15.001122415 0 irq_vectors:irq_work_entry 15.001122415 0 irq_vectors:irq_work_exit 20.001298051 0 irq_vectors:irq_work_entry 20.001298051 0 irq_vectors:irq_work_exit 25.001485020 1 irq_vectors:irq_work_entry 25.001485020 1 irq_vectors:irq_work_exit 30.001658706 0 irq_vectors:irq_work_entry 30.001658706 0 irq_vectors:irq_work_exit ^C 32.045711878 0 irq_vectors:irq_work_entry 32.045711878 0 irq_vectors:irq_work_exit [root@jouet ~]# But at least, when we use a wildcard, this patch helps a bit. Signed-off-by: Yao Jin <yao.jin@linux.intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1491566932-503-1-git-send-email-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> |
||
---|---|---|
.. | ||
c++ | ||
include | ||
intel-pt-decoder | ||
libunwind | ||
scripting-engines | ||
annotate.c | ||
annotate.h | ||
auxtrace.c | ||
auxtrace.h | ||
block-range.c | ||
block-range.h | ||
bpf-loader.c | ||
bpf-loader.h | ||
bpf-prologue.c | ||
bpf-prologue.h | ||
Build | ||
build-id.c | ||
build-id.h | ||
cache.h | ||
call-path.c | ||
call-path.h | ||
callchain.c | ||
callchain.h | ||
cgroup.c | ||
cgroup.h | ||
cloexec.c | ||
cloexec.h | ||
color.c | ||
color.h | ||
comm.c | ||
comm.h | ||
config.c | ||
config.h | ||
counts.c | ||
counts.h | ||
cpumap.c | ||
cpumap.h | ||
cs-etm.h | ||
ctype.c | ||
data-convert-bt.c | ||
data-convert-bt.h | ||
data-convert.h | ||
data.c | ||
data.h | ||
db-export.c | ||
db-export.h | ||
debug.c | ||
debug.h | ||
demangle-java.c | ||
demangle-java.h | ||
demangle-rust.c | ||
demangle-rust.h | ||
drv_configs.c | ||
drv_configs.h | ||
dso.c | ||
dso.h | ||
dump-insn.c | ||
dump-insn.h | ||
dwarf-aux.c | ||
dwarf-aux.h | ||
dwarf-regs.c | ||
env.c | ||
env.h | ||
event.c | ||
event.h | ||
evlist.c | ||
evlist.h | ||
evsel_fprintf.c | ||
evsel.c | ||
evsel.h | ||
expr.h | ||
expr.y | ||
find-vdso-map.c | ||
genelf_debug.c | ||
genelf.c | ||
genelf.h | ||
generate-cmdlist.sh | ||
group.h | ||
header.c | ||
header.h | ||
help-unknown-cmd.c | ||
help-unknown-cmd.h | ||
hist.c | ||
hist.h | ||
intel-bts.c | ||
intel-bts.h | ||
intel-pt.c | ||
intel-pt.h | ||
intlist.c | ||
intlist.h | ||
jit.h | ||
jitdump.c | ||
jitdump.h | ||
kvm-stat.h | ||
levenshtein.c | ||
levenshtein.h | ||
llvm-utils.c | ||
llvm-utils.h | ||
lzma.c | ||
machine.c | ||
machine.h | ||
map.c | ||
map.h | ||
mem-events.c | ||
mem-events.h | ||
namespaces.c | ||
namespaces.h | ||
ordered-events.c | ||
ordered-events.h | ||
parse-branch-options.c | ||
parse-branch-options.h | ||
parse-events.c | ||
parse-events.h | ||
parse-events.l | ||
parse-events.y | ||
parse-regs-options.c | ||
parse-regs-options.h | ||
path.c | ||
perf_regs.c | ||
perf_regs.h | ||
perf-hooks-list.h | ||
perf-hooks.c | ||
perf-hooks.h | ||
PERF-VERSION-GEN | ||
pmu.c | ||
pmu.h | ||
pmu.l | ||
pmu.y | ||
probe-event.c | ||
probe-event.h | ||
probe-file.c | ||
probe-file.h | ||
probe-finder.c | ||
probe-finder.h | ||
pstack.c | ||
pstack.h | ||
python-ext-sources | ||
python.c | ||
quote.c | ||
quote.h | ||
rb_resort.h | ||
rblist.c | ||
rblist.h | ||
record.c | ||
session.c | ||
session.h | ||
setup.py | ||
sort.c | ||
sort.h | ||
srcline.c | ||
stat-shadow.c | ||
stat.c | ||
stat.h | ||
strbuf.c | ||
strbuf.h | ||
strfilter.c | ||
strfilter.h | ||
string.c | ||
strlist.c | ||
strlist.h | ||
svghelper.c | ||
svghelper.h | ||
symbol_fprintf.c | ||
symbol-elf.c | ||
symbol-minimal.c | ||
symbol.c | ||
symbol.h | ||
syscalltbl.c | ||
syscalltbl.h | ||
target.c | ||
target.h | ||
term.c | ||
term.h | ||
thread_map.c | ||
thread_map.h | ||
thread-stack.c | ||
thread-stack.h | ||
thread.c | ||
thread.h | ||
time-utils.c | ||
time-utils.h | ||
tool.h | ||
top.c | ||
top.h | ||
trace-event-info.c | ||
trace-event-parse.c | ||
trace-event-read.c | ||
trace-event-scripting.c | ||
trace-event.c | ||
trace-event.h | ||
trigger.h | ||
tsc.c | ||
tsc.h | ||
unwind-libdw.c | ||
unwind-libdw.h | ||
unwind-libunwind-local.c | ||
unwind-libunwind.c | ||
unwind.h | ||
usage.c | ||
util-cxx.h | ||
util.c | ||
util.h | ||
values.c | ||
values.h | ||
vdso.c | ||
vdso.h | ||
xyarray.c | ||
xyarray.h | ||
zlib.c |