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

From: Markus Elfring

Date: Fri Sep 26 2025 - 14:16:16 EST


>> …
>>> +++ 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.

How does this feedback fit to the proposed addition of a mutex_lock()/mutex_unlock()
call combination (which might be achievable also with another programming interface)?

Regards,
Markus