perf/x86/intel: Fix crash in icl_update_topdown_event()
Subsystems (3)
PATCH 1/1 perf/x86/intel: Fix crash in icl_update_topdown_event()
From: Kan Liang <[email protected]>
[ Upstream commit b0823d5fbacb1c551d793cbfe7af24e0d1fa45ed ]
The perf_fuzzer found a hard-lockup crash on a RaptorLake machine:
Oops: general protection fault, maybe for address 0xffff89aeceab400: 0000
CPU: 23 UID: 0 PID: 0 Comm: swapper/23
Tainted: [W]=WARN
Hardware name: Dell Inc. Precision 9660/0VJ762
RIP: 0010:native_read_pmc+0x7/0x40
Code: cc e8 8d a9 01 00 48 89 03 5b cd cc cc cc cc 0f 1f ...
RSP: 000:fffb03100273de8 EFLAGS: 00010046
....
Call Trace:
<TASK>
icl_update_topdown_event+0x165/0x190
? ktime_get+0x38/0xd0
intel_pmu_read_event+0xf9/0x210
__perf_event_read+0xf9/0x210CPUs 16-23 are E-core CPUs that don't support the perf metrics feature. The icl_update_topdown_event() should not be invoked on these CPUs.
It's a regression of commit:
f9bdf1f95339 ("perf/x86/intel: Avoid disable PMU if !cpuc->enabled in sample read")
The bug introduced by that commit is that the is_topdown_event() function is mistakenly used to replace the is_topdown_count() call to check if the topdown functions for the perf metrics feature should be invoked.
Fix it.
Fixes f9bdf1f95339 ("perf/x86/intel: Avoid disable PMU if !cpuc->enabled in sample read")
Reported-by Vince Weaver <[email protected]>
Signed-off-by Kan Liang <[email protected]>
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
Tested-by Vince Weaver <[email protected]>
Cc [email protected] # v6.15+
[ omitted PEBS check ]
Signed-off-by Sasha Levin <[email protected]>
Signed-off-by Greg Kroah-Hartman <[email protected]>
Signed-off-by Angel Adetula <[email protected]>
--- arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/core.c +1 -1
@@ -2793,7 +2793,7 @@ static void intel_pmu_read_event(struct perf_event *event)if (pmu_enabled)intel_pmu_disable_all (); -if (is_topdown_event (event)) +if (is_topdown_count (event))static_call (intel_pmu_update_topdown_event)(event);else intel_pmu_drain_pebs_buffer ();
Signature · 1 line
2.51.0.470.ga7dc726c21-goog