linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] perf: arm_pmu: Fix build on arm if !CONFIG_GENERIC_ARCH_TOPOLOGY
@ 2025-11-04 13:40 Yicong Yang
  2025-11-04 16:33 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: Yicong Yang @ 2025-11-04 13:40 UTC (permalink / raw)
  To: will, mark.rutland, linux-arm-kernel; +Cc: yangyccccc

The SMT implementation is retrieved by topology_core_has_smt() which
depends on CONFIG_GENERIC_ARCH_TOPOLOGY. The config is optional on
arm platforms so protect the usage with CONFIG_GENERIC_ARCH_TOPOLOGY.

Fixes: c3d78c34ad00 ("perf: arm_pmuv3: Don't use PMCCNTR_EL0 on SMT cores")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202511041757.vuCGOmFc-lkp@intel.com/
Signed-off-by: Yicong Yang <yangyccccc@gmail.com>
---
 drivers/perf/arm_pmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index ae437791b5f8..f38bdeb906f0 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -925,11 +925,13 @@ int armpmu_register(struct arm_pmu *pmu)
 	if (ret)
 		return ret;
 
+#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
 	/*
 	 * By this stage we know our supported CPUs on either DT/ACPI platforms,
 	 * detect the SMT implementation.
 	 */
 	pmu->has_smt = topology_core_has_smt(cpumask_first(&pmu->supported_cpus));
+#endif
 
 	if (!pmu->set_event_filter)
 		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
-- 
2.50.1 (Apple Git-155)



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] perf: arm_pmu: Fix build on arm if !CONFIG_GENERIC_ARCH_TOPOLOGY
  2025-11-04 13:40 [PATCH -next] perf: arm_pmu: Fix build on arm if !CONFIG_GENERIC_ARCH_TOPOLOGY Yicong Yang
@ 2025-11-04 16:33 ` Will Deacon
  2025-11-05  8:01   ` Yicong Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2025-11-04 16:33 UTC (permalink / raw)
  To: Yicong Yang; +Cc: mark.rutland, linux-arm-kernel

On Tue, Nov 04, 2025 at 09:40:04PM +0800, Yicong Yang wrote:
> The SMT implementation is retrieved by topology_core_has_smt() which
> depends on CONFIG_GENERIC_ARCH_TOPOLOGY. The config is optional on
> arm platforms so protect the usage with CONFIG_GENERIC_ARCH_TOPOLOGY.
> 
> Fixes: c3d78c34ad00 ("perf: arm_pmuv3: Don't use PMCCNTR_EL0 on SMT cores")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202511041757.vuCGOmFc-lkp@intel.com/
> Signed-off-by: Yicong Yang <yangyccccc@gmail.com>
> ---
>  drivers/perf/arm_pmu.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index ae437791b5f8..f38bdeb906f0 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -925,11 +925,13 @@ int armpmu_register(struct arm_pmu *pmu)
>  	if (ret)
>  		return ret;
>  
> +#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
>  	/*
>  	 * By this stage we know our supported CPUs on either DT/ACPI platforms,
>  	 * detect the SMT implementation.
>  	 */
>  	pmu->has_smt = topology_core_has_smt(cpumask_first(&pmu->supported_cpus));
> +#endif
>  
>  	if (!pmu->set_event_filter)
>  		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
> -- 
> 2.50.1 (Apple Git-155)

Wouldn't we be better off adding something like:

#else
static inline bool topology_core_has_smt(int cpu) { return false; }
#endif /* CONFIG_GENERIC_ARCH_TOPOLOGY */

to the bottom of include/linux/arch_topology.h?

Will


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] perf: arm_pmu: Fix build on arm if !CONFIG_GENERIC_ARCH_TOPOLOGY
  2025-11-04 16:33 ` Will Deacon
@ 2025-11-05  8:01   ` Yicong Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Yicong Yang @ 2025-11-05  8:01 UTC (permalink / raw)
  To: Will Deacon; +Cc: yangyccccc, mark.rutland, linux-arm-kernel

On 2025/11/5 00:33, Will Deacon wrote:
> On Tue, Nov 04, 2025 at 09:40:04PM +0800, Yicong Yang wrote:
>> The SMT implementation is retrieved by topology_core_has_smt() which
>> depends on CONFIG_GENERIC_ARCH_TOPOLOGY. The config is optional on
>> arm platforms so protect the usage with CONFIG_GENERIC_ARCH_TOPOLOGY.
>>
>> Fixes: c3d78c34ad00 ("perf: arm_pmuv3: Don't use PMCCNTR_EL0 on SMT cores")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202511041757.vuCGOmFc-lkp@intel.com/
>> Signed-off-by: Yicong Yang <yangyccccc@gmail.com>
>> ---
>>  drivers/perf/arm_pmu.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
>> index ae437791b5f8..f38bdeb906f0 100644
>> --- a/drivers/perf/arm_pmu.c
>> +++ b/drivers/perf/arm_pmu.c
>> @@ -925,11 +925,13 @@ int armpmu_register(struct arm_pmu *pmu)
>>  	if (ret)
>>  		return ret;
>>  
>> +#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
>>  	/*
>>  	 * By this stage we know our supported CPUs on either DT/ACPI platforms,
>>  	 * detect the SMT implementation.
>>  	 */
>>  	pmu->has_smt = topology_core_has_smt(cpumask_first(&pmu->supported_cpus));
>> +#endif
>>  
>>  	if (!pmu->set_event_filter)
>>  		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
>> -- 
>> 2.50.1 (Apple Git-155)
> Wouldn't we be better off adding something like:
>
> #else
> static inline bool topology_core_has_smt(int cpu) { return false; }
> #endif /* CONFIG_GENERIC_ARCH_TOPOLOGY */
>
> to the bottom of include/linux/arch_topology.h?

I was thinking so but found there's no !CONFIG_GENERIC_ARCH_TOPOLOGY
stubs for other functions. So I checked how this is handled in other places and follow in
the same way [1]

but a stub will be neater here. will respin a version using the stub.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/kernel/smp.c?h=v6.18-rc4#n261

thanks.








^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-05  8:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 13:40 [PATCH -next] perf: arm_pmu: Fix build on arm if !CONFIG_GENERIC_ARCH_TOPOLOGY Yicong Yang
2025-11-04 16:33 ` Will Deacon
2025-11-05  8:01   ` Yicong Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).