perf/x86/intel: Set PERF_ATTACH_SCHED_CB for large PEBS and LBR
authorKan Liang <kan.liang@linux.intel.com>
Mon, 30 Nov 2020 19:38:41 +0000 (11:38 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 16:06:34 +0000 (17:06 +0100)
commit896846b8151d9e3ce634ba95aee3d731a16d9f5f
tree637c6d0d8418f91801ee2e4e23e6b614588de72d
parent82ad50c112f89ca0bc6e28b9e72dfc157996f6c6
perf/x86/intel: Set PERF_ATTACH_SCHED_CB for large PEBS and LBR

[ Upstream commit afbef30149587ad46f4780b1e0cc5e219745ce90 ]

To supply a PID/TID for large PEBS, it requires flushing the PEBS buffer
in a context switch.

For normal LBRs, a context switch can flip the address space and LBR
entries are not tagged with an identifier, we need to wipe the LBR, even
for per-cpu events.

For LBR callstack, save/restore the stack is required during a context
switch.

Set PERF_ATTACH_SCHED_CB for the event with large PEBS & LBR.

Fixes: 9c964efa4330 ("perf/x86/intel: Drain the PEBS buffer during context switches")
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-2-kan.liang@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/events/intel/core.c