提交 b839d224 编写于 作者: A Athira Rajeev 提交者: Zheng Zengkai

powerpc/perf: Don't use perf_hw_context for trace IMC PMU

stable inclusion
from stable-v5.10.110
commit b5d363ff171e208fd546ed718535002cc64a13c4
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b5d363ff171e208fd546ed718535002cc64a13c4

--------------------------------

[ Upstream commit 01983223 ]

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 should only be used for CPU PMU.
See commit 26657848 ("perf/core: Verify we have a single
perf_hw_context PMU").

So for trace_imc, even though it is per thread PMU, it is preferred to
use sw_context in order to be able to do application level monitoring.
Hence change the task_ctx_nr to use perf_sw_context.

Fixes: 012ae244 ("powerpc/perf: Trace imc PMU functions")
Signed-off-by: NAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: NMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
[mpe: Update subject & incorporate notes into change log, reflow comment]
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220202041837.65968-1-atrajeev@linux.vnet.ibm.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 329ada2c
...@@ -1457,7 +1457,11 @@ static int trace_imc_event_init(struct perf_event *event) ...@@ -1457,7 +1457,11 @@ static int trace_imc_event_init(struct perf_event *event)
event->hw.idx = -1; event->hw.idx = -1;
event->pmu->task_ctx_nr = perf_hw_context; /*
* There can only be a single PMU for perf_hw_context events which is assigned to
* core PMU. Hence use "perf_sw_context" for trace_imc.
*/
event->pmu->task_ctx_nr = perf_sw_context;
event->destroy = reset_global_refc; event->destroy = reset_global_refc;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册