Re: [PATCH v2 5/6] perf: add MIPS Coherence Manager 3 (CM3) PMU driver

From: Vladimir Kondratiev

Date: Wed Nov 18 2026 - 12:27:03 EST


On 11/12/26 15:02, sashiko-bot@xxxxxxxxxx wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [Medium] perf: mips_cm3_pmu: counter overflow double-counting in
> cm3_pmu_update()
> - [Low] perf: mips_cm3_pmu: broken !MIPS_CPS / !SMP configuration
> --
>
> commit 272d1a9241643c479b7f4cabbd1c40edccbe1b16
> Author: Vladimir Kondratiev <vladimir.kondratiev@xxxxxxxxxxxx>
>
> perf: add MIPS Coherence Manager 3 (CM3) PMU driver
>
> This commit adds an uncore PMU driver and documentation for the MIPS
> Coherence Manager 3 (CM3) performance and cycle counters.
>
>> diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig
>> index 245e7bb763b99..2dbed2fc7b030 100644
>> --- a/drivers/perf/Kconfig
>> +++ b/drivers/perf/Kconfig
>> @@ -75,6 +75,18 @@ config ARM_XSCALE_PMU
>> depends on ARM_PMU && CPU_XSCALE
>> def_bool y
>>
>> +config MIPS_CM3_PMU
>> + tristate "MIPS Coherence Manager 3 (CM3) PMU"
>> + depends on MIPS_CM
> [Severity: Low]
> Should MIPS_CM3_PMU depend on MIPS_CPS rather than MIPS_CM?
>
> MIPS_GIC selects MIPS_CM even when CONFIG_MIPS_CPS=n and CONFIG_SMP=n.
> On a !CONFIG_SMP build, irq_set_affinity() is a stub returning -EINVAL, so
> cm3_pmu_online_cpu() unconditionally triggers WARN_ON() when an overflow
> IRQ is present; without CONFIG_MIPS_CPS, cps_smp_setup() also never
> populates the cluster ID in cpu_data[].globalnumber.

This is a false negative. On a !CONFIG_SMP build:

- cm3_pmu_online_cpu() is a CPU hotplug handler, it won't be called on
the !CONFIG_SMP build.

- cpu_data[].globalnumber will stay 0, so cpu_cluster() will return 0,
and it is true

Thanks, Vladimir