Re: [PATCH v2 0/2] perf/arm-cmn: Allow userspace to select the PMU's CPU
From: Will Deacon
Date: Fri Nov 27 2026 - 13:42:35 EST
On Wed, Sep 30, 2026 at 06:11:25PM -0500, Haris Okanovic wrote:
> arm_cmn_probe() picks the CPU that owns the PMU and nothing but the CPU
> hotplug callbacks ever revisits it, so in practice all of the PMU's
> recurring work stays on the first CPU local to the interconnect's NUMA
> node. Patch 2 makes the existing 'cpumask' attribute writable so it can
> be moved, which helps on systems that confine background kernel work to
> a chosen set of housekeeping CPUs.
>
> I made the existing 'cpumask' attribute writable rather than
> adding a new one. Every other implementation of that file is read-only,
> so I am happy to switch to a separate attribute if you would prefer to
> keep 'cpumask' uniformly read-only across PMUs.
>
> Patch 1 is new in v2. Robin pointed out that perf_event_open() can latch
> cmn->cpu and then install the event after a migration has already moved
> the PMU, leaving it on a CPU which no longer owns the PMU's shared state.
> The window already exists via arm_cmn_pmu_online_cpu(), so patch 1 stands
> on its own; a writable cpumask just makes it reachable on demand.
Hmm. Not sure about this. It feels to me as though, if we want interfaces
beyond CPU hotplug to control the affinity of system/uncore PMUs, then
that should probably be something managed and understood by the core
perf code rather than hacked onto one of the many PMU drivers by quietly
changing the semantics of the established debugfs interface.
Aha, you did that over at:
https://lore.kernel.org/r/20261013185603.1347265-1-harisokn@xxxxxxxxxx
do you plan to respin that?
Otherwise, if over-loading CPU 0 is the problem, I suppose we could hack
the probe routine to pick an arbitrary CPU, similar to
cpumask_any_distribute().
Will