Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 012669c

Browse files
author
Peter Zijlstra
committed
perf: Fix task context PMU for Hetero
On HETEROGENEOUS hardware (ARM big.Little, Intel Alderlake etc.) each CPU might have a different hardware PMU. Since each such PMU is represented by a different struct pmu, but we only have a single HW task context. That means that the task context needs to switch PMU type when it switches CPUs. Not doing this means that ctx->pmu calls (pmu_{dis,en}able(), {start,commit,cancel}_txn() etc.) are called against the wrong PMU and things will go wobbly. Fixes: f83d2f9 ("perf/x86/intel: Add Alder Lake Hybrid support") Reported-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Kan Liang <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 1d5c788 commit 012669c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

kernel/events/core.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3822,9 +3822,16 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
38223822
struct task_struct *task)
38233823
{
38243824
struct perf_cpu_context *cpuctx;
3825-
struct pmu *pmu = ctx->pmu;
3825+
struct pmu *pmu;
38263826

38273827
cpuctx = __get_cpu_context(ctx);
3828+
3829+
/*
3830+
* HACK: for HETEROGENEOUS the task context might have switched to a
3831+
* different PMU, force (re)set the context,
3832+
*/
3833+
pmu = ctx->pmu = cpuctx->ctx.pmu;
3834+
38283835
if (cpuctx->task_ctx == ctx) {
38293836
if (cpuctx->sched_cb_usage)
38303837
__perf_pmu_sched_task(cpuctx, true);

0 commit comments

Comments
 (0)