powerpc/perf: Fix task context setting for trace imc
PATCH 1/1 powerpc/perf: Fix task context setting for trace imc
Trace IMC (In-Memory collection counters) in powerpc is useful for application level profiling. For trace_imc, presently task context (task_ctx_nr) is set to perf_hw_context. But perf_hw_context is to be used for cpu PMU. So for trace_imc, even though it is per thread PMU, it is preferred to use sw_context inorder to be able to do application level monitoring. Hence change the task_ctx_nr to use perf_sw_context.
--- arch/powerpc/perf/imc-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/imc-pmu.c +1 -1
@@ -1457,7 +1457,7 @@ static int trace_imc_event_init(struct perf_event *event) event->hw.idx =-1 ; - event->pmu->task_ctx_nr = perf_hw_context; + event->pmu->task_ctx_nr = perf_sw_context; event->destroy = reset_global_refc;return 0 ; }
Signature · 1 line
2.33.0
Michael Ellerman
reviewerQuoted 8 lines · Athira Rajeev
Trace IMC (In-Memory collection counters) in powerpc is useful for application level profiling. For
trace_imc, presently task context (task_ctx_nr) is set toperf_hw_context. Butperf_hw_contextis to be used for cpu PMU. So fortrace_imc, even though it is per thread PMU, it is preferred to usesw_contextinorder to be able to do application level monitoring. Hence change thetask_ctx_nrto useperf_sw_context.
It's not a software event though, so this is not obviously correct.
Can you explain more why this is OK, I guess perf_sw_context is misnamed these days? And can you add a comment in the code explaining why this hardware PMU is using perf_sw_context.
cheers
Quoted 22 lines
Fixes 012ae244845f ("powerpc/perf: Trace imc PMU functions")Signed-off-by Athira Rajeev <[email protected]>Reviewed-by Madhavan Srinivasan <[email protected]>--- arch/powerpc/perf/imc-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/perf/imc-pmu.c +1
-1@@ -1457,7 +1457,7 @@ static int trace_imc_event_init(struct perf_event *event) event->hw.idx =-1 ; - event->pmu->task_ctx_nr = perf_hw_context; + event->pmu->task_ctx_nr = perf_sw_context; event->destroy = reset_global_refc;return 0 ; }Signature · 1 line
2.33.0