[PATCH v2 0/2] perf: arm_pmuv3: Don't use PMCCNTR_EL0 on SMT cores

Yicong Yang
2025-08-20T10:33:52Z

From: Yicong Yang <yangyicong@hisilicon.com>

This patchset fixed CPU_CYCLES counting on SMT system. CPU_CYCLES can use
PMCCNTR_EL0 which will count the hardware processor clock rather than the
PE clock (ARM DDI0487 L.b D13.1.3) on SMT cores which fails the users
expectation as CPU_CYCLES (0x0011) is defined to count on each PE cycles.
Fix this by avoid using PMCCNTR_EL0 on SMT cores when counting CPU_CYCLES.

Changes since v1:
- remove redundant comment and add tags on Patch 1/2
- detect the SMT implementation during PMU probe rather than runtime
Link: https://lore.kernel.org/linux-arm-kernel/20250812080830.20796-1-yangyicong@huawei.com/

Yicong Yang (2):
perf: arm_pmuv3: Factor out PMCCNTR_EL0 use conditions
perf: arm_pmuv3: Don't use PMCCNTR_EL0 on SMT cores

drivers/perf/arm_pmu.c | 3 +++
drivers/perf/arm_pmuv3.c | 39 +++++++++++++++++++++++++++++++++--
include/linux/arch_topology.h | 11 ++++++++++
include/linux/perf/arm_pmu.h | 1 +
4 files changed, 52 insertions(+), 2 deletions(-)

--
2.24.0