Re: [PATCH v2 23/29] arm_mpam: Add mpam_msmon_read() to read monitor value

James Morse
2025-10-06T16:00:05Z

Hi Ben,

On 11/09/2025 16:46, Ben Horgan wrote:
> On 9/10/25 21:43, James Morse wrote:
>> Reading a monitor involves configuring what you want to monitor, and
>> reading the value. Components made up of multiple MSC may need values
>> from each MSC. MSCs may take time to configure, returning 'not ready'.
>> The maximum 'not ready' time should have been provided by firmware.
>>
>> Add mpam_msmon_read() to hide all this. If (one of) the MSC returns
>> not ready, then wait the full timeout value before trying again.

>> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
>> index cf190f896de1..1543c33c5d6a 100644
>> --- a/drivers/resctrl/mpam_devices.c
>> +++ b/drivers/resctrl/mpam_devices.c
>> @@ -898,6 +898,232 @@ static int mpam_msc_hw_probe(struct mpam_msc *msc)

>> +static int _msmon_read(struct mpam_component *comp, struct mon_read *arg)
>> +{
>> + int err, idx;
>> + struct mpam_msc *msc;
>> + struct mpam_vmsc *vmsc;
>> + struct mpam_msc_ris *ris;
>> +
>> + idx = srcu_read_lock(&mpam_srcu);
>> + list_for_each_entry_rcu(vmsc, &comp->vmsc, comp_list) {
>
> This can be list_for_each_entry_srcu(). (I thought I'd already commented
> but turns out that was on another patch.)

>
>> + msc = vmsc->msc;
>> +
>> + list_for_each_entry_rcu(ris, &vmsc->ris, vmsc_list) {
>
> Also here.

Yup - thanks I missed these. Fixed.
I bet I went cross-eyed between here and mpam_apply_config() as they are structurally similar.

Thanks,

James