Re: [PATCH v12 14/26] x86/resctrl: Add the functionality to assign MBM events

From: Moger, Babu
Date: Wed Apr 16 2025 - 14:17:24 EST


Hi Tony,

On 4/16/25 12:55, Luck, Tony wrote:
> On Wed, Apr 16, 2025 at 12:09:52PM -0500, Moger, Babu wrote:
>> Hi Reinette,
>>
>> On 4/15/25 11:53, Reinette Chatre wrote:
>>> Hi Babu,
>>>
>>> On 4/15/25 7:20 AM, Moger, Babu wrote:
>>>> Hi Reinette,
>>>>
>>>> On 4/11/25 16:04, Reinette Chatre wrote:
>>>>> Hi Babu,
>>>>>
>>>>> On 4/3/25 5:18 PM, Babu Moger wrote:
>>>>>> The mbm_cntr_assign mode offers "num_mbm_cntrs" number of counters that
>>>>>> can be assigned to an RMID, event pair and monitor the bandwidth as long
>>>>>> as it is assigned.
>>>>>
>>>>> Above makes it sound as though multiple counters can be assigned to
>>>>> an RMID, event pair.
>>>>>
>>>>
>>>> Yes. Multiple counter-ids can be assigned to RMID, event pair.
>>>
>>> oh, are you referring to the assignments of different counters across multiple
>>> domains?
>>
>> May be I am confusing you here. This is what I meant.
>>
>> Here is one example.
>>
>> In a same group,
>> Configure cntr_id 0, to count reads only (This maps to total event).
>> Configure cntr_id 1, to count write only (This maps to local event).
>> Configure cntr_id 2, to count dirty victims.
>> so on..
>> so on..
>> Configure cntr_id 31, to count remote read only.
>>
>> We have 32 counter ids in a domain. Basically, we can configure all the
>> counters in a domain to just one group if you want to.
>>
>> We cannot do that right now because our data structures cannot do that.
>> We can only configure 2 events(local and total) right now.
>
> Not just data structures, but also user visible files in
> mon_data/mon_L3*/*
>
> You'd need to create a new file for each counter.

Yes. That is correct.

>
> My patch for making it easier to add more counters:
>
> https://lore.kernel.org/all/20250407234032.241215-3-tony.luck@xxxxxxxxx/
>
> may help ... though you have to pick the number of simultaneous counters
> at compile time to size the arrays in the domain structures:
>
> struct mbm_state *mbm_states[QOS_NUM_MBM_EVENTS];
>
> and if you are dynamically adding/removing events using the
> configuration files, need to alloc/free the memory that those
> arrays of pointers reference ... as well as adding/removing files
> from the appropriate mon_data/mon_L3* directory.

Not just that. Also there is that overflow handler to keep all these
counters in sane state. So, pretty quickly it gets complicated. It is
probably best to handle as a separate series.

--
Thanks
Babu Moger