Re: [RFC PATCH 27/36] arm_mpam: Allow configuration to be applied and restored during cpu online

From: James Morse
Date: Fri Aug 08 2025 - 03:29:46 EST


Hi Dave, Ben,

On 28/07/2025 16:34, Dave Martin wrote:
Although it may look like the globals are read all over the place after
probing, I think this actually only happens during resctrl initialision
(which is basically single-threaded).

The only place where they are read after probing and without mediation
via resctrl is on the CPU hotplug path.

(and the mpam driver gets the first go a cpuhp, then it calls into resctrl).


Adding locking would ensure that an unstable value is never read, but
this is not sufficient by itself to sure that the _final_ value of a
variable is read (for some definition of "final"). And, if there is a
well-defined notion of final value and there is sufficient
synchronisation to ensure that this is the value read by a particular
read, then by construction an unstable value cannot be read.


I think that this kind of pattern is not that uncommon in the kernel,
though it is a bit painful to reason about.

As it's sparked some discussion, I've added a mpam_assert_partid_sizes_fixed() that
documents this, and will trigger a WARN_ON_ONCE() if these things are observed as
happening in the wrong order.


Thanks,

James