diff options
author | Kan Liang <kan.liang@linux.intel.com> | 2020-11-30 11:38:40 -0800 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2021-03-06 12:52:39 +0100 |
commit | a5398bffc01fe044848c5024e5e867e407f239b8 (patch) | |
tree | 4024bf63256a99173f8c38e49de68debed41657e /arch/x86 | |
parent | a38fd8748464831584a19438cbb3082b5a2dab15 (diff) |
perf/core: Flush PMU internal buffers for per-CPU events
Sometimes the PMU internal buffers have to be flushed for per-CPU events
during a context switch, e.g., large PEBS. Otherwise, the perf tool may
report samples in locations that do not belong to the process where the
samples are processed in, because PEBS does not tag samples with PID/TID.
The current code only flush the buffers for a per-task event. It doesn't
check a per-CPU event.
Add a new event state flag, PERF_ATTACH_SCHED_CB, to indicate that the
PMU internal buffers have to be flushed for this event during a context
switch.
Add sched_cb_entry and perf_sched_cb_usages back to track the PMU/cpuctx
which is required to be flushed.
Only need to invoke the sched_task() for per-CPU events in this patch.
The per-task events have been handled in perf_event_context_sched_in/out
already.
Fixes: 9c964efa4330 ("perf/x86/intel: Drain the PEBS buffer during context switches")
Reported-by: Gabriel Marin <gmx@google.com>
Originally-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20201130193842.10569-1-kan.liang@linux.intel.com
Diffstat (limited to 'arch/x86')
0 files changed, 0 insertions, 0 deletions