Re: [PATCH v2 08/29] arm_mpam: Add the class and component structures for firmware described ris

James Morse
2025-09-26T17:52:59Z

Hi Markus,

On 11/09/2025 17:30, Markus Elfring wrote:
> …
>> +++ b/drivers/resctrl/mpam_devices.c
> …
>>> +int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx,
>> + enum mpam_class_types type, u8 class_id, int component_id)
>> +{
>> + int err;
>> +
>> + mutex_lock(&mpam_list_lock);
>> + err = mpam_ris_create_locked(msc, ris_idx, type, class_id,
>> + component_id);
>> + mutex_unlock(&mpam_list_lock);
> …
>
> Under which circumstances would you become interested to apply a statement
> like “guard(mutex)(&mpam_list_lock);”?
> https://elixir.bootlin.com/linux/v6.17-rc5/source/include/linux/mutex.h#L228

None! The bit of this you cut out is a call to mpam_free_garbage() which calls
synchronize_srcu(). That may sleep for a while. The whole point of the deferred free-ing
is it does not happen under the lock. The 'guard' magic means the compiler gets to choose
when to call unlock.

Thanks,

James