Skip to content

RFC perf/core: Invoke pmu::sched_task callback for cpu events

Namhyung Kim lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2perf/core: Enable sched_task callbacks if PMU has itkernel/events/core.c+4 -05 replies
2/2perf/core: Invoke pmu::sched_task callback for per-cpu eventsinclude/linux/perf_event.h kernel/events/core.c+37 -25 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/2] perf/core: Invoke pmu::sched_task callback for cpu events

Hello,

It was reported that system-wide events with precise_ip set have a lot of unknown symbols on Intel machines. Depending on the system load I can see more than 30% of total symbols are not resolved (actually don't have DSO mappings).

I found that it's only large PEBS is enabled - using call-graph or the frequency mode will disable it and have valid results. I've verified it by checking intel_pmu_pebs_sched_task() is called like below:

  # perf probe -a intel_pmu_pebs_sched_task
  # perf stat -a -e probe:intel_pmu_pebs_sched_task \
Quoted 1 line

perf record -a -e cycles:ppp -c 100001 sleep 1

[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 2.625 MB perf.data (10345 samples) ]

Performance counter stats for 'system wide':

                 0      probe:intel_pmu_pebs_sched_task                                   

       2.157533991 seconds time elapsed

Looking at the code, I found out that the pmu::sched_task callback was changed recently that it's called only for task events. So cpu events with large PEBS didn't flush the buffer and they are attributed to unrelated tasks later resulted in unresolved symbols.

This patch reverts it and keeps the optimization for task events. While at it, I also found the context switch callback was not enabled for cpu events from the beginning. So I've added it too. With this applied, I can see the above callbacks are hit as expected and perf report has valid symbols.

Thanks
Namhyung

Namhyung Kim (2):
perf/core: Enable sched_task callbacks if PMU has it perf/core: Invoke pmu::sched_task callback for per-cpu events

 include/linux/perf_event.h |  1 +
 kernel/events/core.c       | 42 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 41 insertions(+), 2 deletions(-)
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog