Re: [RFC PATCH v3 00/17] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC)

From: Moger, Babu
Date: Thu Apr 04 2024 - 16:03:05 EST


Hi Peter,


On 4/4/24 14:08, Peter Newman wrote:
> Hi Babu,
>
> On Thu, Mar 28, 2024 at 6:07 PM Babu Moger <babu.moger@xxxxxxx> wrote:
>> The list follows the following format:
>>
>> * Default CTRL_MON group:
>> "//<domain_id>=<assignment_flags>"
>>
>> * Non-default CTRL_MON group:
>> "<CTRL_MON group>//<domain_id>=<assignment_flags>"
>>
>> * Child MON group of default CTRL_MON group:
>> "/<MON group>/<domain_id>=<assignment_flags>"
>>
>> * Child MON group of non-default CTRL_MON group:
>> "<CTRL_MON group>/<MON group>/<domain_id>=<assignment_flags>"
>>
>> Assignment flags can be one of the following:
>>
>> t MBM total event is assigned
>> l MBM local event is assigned
>> tl Both total and local MBM events are assigned
>> _ None of the MBM events are assigned
>>
>> Examples:
>>
>> # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control
>> non_defult_group//0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;
>> non_defult_group/non_default_mon1/0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;
>> //0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;
>> /default_mon1/0=tl;1=tl;2=tl;3=tl;4=tl;5=tl;6=tl;7=tl;
>>
>> There are four groups and all the groups have local and total event assigned.
>>
>> "//" - This is a default CONTROL MON group
>>
>> "non_defult_group//" - This is non default CONTROL MON group
>>
>> "/default_mon1/" - This is Child MON group of the defult group
>>
>> "non_defult_group/non_default_mon1/" - This is child MON group of the non default group
>>
>> =tl means both total and local events are assigned.
>
> I recall there was supposed to be a way to perform the same update on
> all domains together so that it isn't tedious to not do per-domain

Yes. Correct. Reinette suggested to have "no domains" means ALL the domains.

Example:

Initial list:
$cat /sys/fs/resctrl/info/L3_MON/mbm_assign_control
non_def_ctrl_mon_grep//0=_;1=_;2=_;3=_;4=_;5=_;6=_;7=_;
//0=_;1=_;2=_;3=_;4=_;5=_;6=_;7=_;

Two groups and no events assigned.


To assign total event on all the domains, The command will look like this.

$ echo "//=t" > /sys/fs/resctrl/info/L3_MON/mbm_assign_control

Parsing becomes ugly here. I look for domain number after the name. Now I
have add some ugly checks there.


I also thought about something like this:

$ echo "//FFFF=t" > /sys/fs/resctrl/info/L3_MON/mbm_assign_control

FFFF means all the domains. But there could be domain number with FFFF also.

So, I dropped the idea.


> customizations. (And also to avoid serializing programming all the
> domains the same way.)

One more thing with respect to domains:

This series updates all the domains when assignment is requested.
Makes it easy to implement.

For example:

$ echo "//0=t" > /sys/fs/resctrl/info/L3_MON/mbm_assign_control

This command will assign total event on all the domains on default group
even though user passed only domain 0.

I am looking at supporting domain specific assignment right now.
If your use case is specific to each domain then I can add that support in
in next revision.

>
>
>>
>> .../admin-guide/kernel-parameters.txt | 2 +-
>> Documentation/arch/x86/resctrl.rst | 144 ++++
>> arch/x86/include/asm/cpufeatures.h | 1 +
>> arch/x86/include/asm/msr-index.h | 2 +
>> arch/x86/kernel/cpu/cpuid-deps.c | 3 +
>> arch/x86/kernel/cpu/resctrl/core.c | 25 +-
>> arch/x86/kernel/cpu/resctrl/internal.h | 56 +-
>> arch/x86/kernel/cpu/resctrl/monitor.c | 24 +-
>> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 714 +++++++++++++++++-
>> arch/x86/kernel/cpu/scattered.c | 1 +
>> include/linux/resctrl.h | 12 +
>> 11 files changed, 964 insertions(+), 20 deletions(-)
>>
>> --
>> 2.34.1
>>
>
> This should be fine for me to get started with. I'll see if I can work
> backwards from the patches adding the parsing code to see how I'll
> work the software implementation in.
>
> Thanks!
> -Peter

--
Thanks
Babu Moger