[RFC PATCH 18/38] arm_mpam: resctrl: Add support for csu counters

Ben Horgan ben.horgan at arm.com
Fri Dec 19 04:06:51 PST 2025


Hi Jonathan,

On 12/18/25 13:20, Jonathan Cameron wrote:
> On Fri, 5 Dec 2025 21:58:41 +0000
> James Morse <james.morse at arm.com> wrote:
> 
>> resctrl exposes a counter via a file named llc_occupancy. This isn't really
>> a counter as its value goes up and down, this is a snapshot of the cache
>> storage usage monitor.
>>
>> Add some picking code to find a cache as close as possible to the L3 that
>> supports the CSU monitor.
>>
>> If there is an L3, but it doesn't have any controls, force the L3 resource
>> to exist. The existing topology_matches_l3() and
>> mpam_resctrl_domain_hdr_init() code will ensure this looks like the L3,
>> even if the class belongs to a later cache.
>>
>> Signed-off-by: James Morse <james.morse at arm.com>
> 
> More triviality from me.  I'll take a separate look at whether this actually
> works for all the systems we care about.  It feels like maybe a top level
> MPAM to resctl mapping document might be useful as people are going to fall
> into traps around these various heuristics, particularly as more exciting
> topologies arrive in the future.

Seems sensible, this is one of the tricky things.

> 
> 
>> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
>> index fe830524639e..fc1f054f187e 100644
>> --- a/drivers/resctrl/mpam_resctrl.c
>> +++ b/drivers/resctrl/mpam_resctrl.c
> 
>>  /*
>>   * Calculate the worst-case percentage change from each implemented step
>>   * in the control.
>> @@ -499,6 +531,64 @@ static void mpam_resctrl_pick_mba(void)
>>  	}
>>  }
>>  
>> +static void counter_update_class(enum resctrl_event_id evt_id,
>> +				 struct mpam_class *class)
>> +{
>> +	struct mpam_class *existing_class = mpam_resctrl_counters[evt_id].class;
>> +
>> +	if (existing_class) {
>> +		if (class->level == 3) {
>> +			pr_debug("Existing class is L3 - L3 wins\n");
>> +			return;
> 
> As returned the else isn't adding anything much.
> 
>> +		} else if (existing_class->level < class->level) {
>> +			pr_debug("Existing class is closer to L3, %u versus %u - closer is better\n",
>> +				 existing_class->level, class->level);
>> +			return;
>> +		}
>> +	}
>> +
>> +	mpam_resctrl_counters[evt_id].class = class;
>> +	exposed_mon_capable = true;
>> +}
> 
> 

Thanks,

Ben




More information about the linux-arm-kernel mailing list