Re: [PATCH v5 04/40] x86/resctrl: Use schema type to determine how to parse schema values

From: James Morse
Date: Fri Dec 20 2024 - 13:31:54 EST


Hi Reinette,

On 23/10/2024 22:14, Reinette Chatre wrote:
> On 10/4/24 11:03 AM, James Morse wrote:

>> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
>> index 496ddcaa4ecf..54ec87339038 100644
>> --- a/include/linux/resctrl.h
>> +++ b/include/linux/resctrl.h
>> @@ -192,6 +191,17 @@ enum resctrl_scope {
>> RESCTRL_L3_NODE,
>> };
>>
>> +/**
>> + * enum resctrl_schema_fmt - The format user-space provides for a schema.
>> + * @RESCTRL_SCHEMA_BITMAP: The schema is a bitmap in hex.
>> + * @RESCTRL_SCHEMA_RANGE: The schema is a number, either a percentage
>> + * or a MBps value.
>
> The description of RESCTRL_SCHEMA_RANGE appears to aim to be specific. Considering this
> it should also include the "multiples of one eighth GB/s" input option used on
> AMD systems.

I really don't want to define something like that as being general purpose.
This is an intermediate step to splitting 'range' into: percentage, mibps or 'platform'.
Eventually the AMD fraction-of-GB/s would be 'platform', with resctrl unable to tell
user-space what the unit is (it doesn't today either).

I have a series to do this for MPAM's cache-capacity scheme which takes a percentage for
caches like L2 or L3. I'd like percentage to be something that can be specified as the
schema format because that gives us the opportunity to expose common properties of
percentage controls to user-space from the filesystem code. e.g. the schema format,
percentage min and granularity - the last two can only be done today if its a bandwidth
you control, and user-space just has to know what the format of the control is.

Most of MPAMs controls are either bitmaps or something we can pretend is a percentage.
The odd two are PRI (ority), which is some kind of cost or weight, and the bandwidth
stride scheme, which is similarly a cost or weight. I'd describe these as 'platform' if
they are ever supported upstream. If another architecture has a similar control format it
can be added and those MPAM controls can be switched over.

If you think the comment is too specific, I'll change it to say its a decimal number.
Splitting it up into what that number means will come back in a later series.


> The software controller is the only user of actual bandwidth and for its
> use it should be "MiBps".

This would no longer match the command line argument mba_MBps, or the other code comments.
I don't think this is worth the churn as it could never be consistent. I'll add this as
a future cleanup patch so we can see how noisy it is going to be.
(
fs/resctrl/ctrlmondata.c | 4 ++--
fs/resctrl/internal.h | 2 +-
fs/resctrl/monitor.c | 6 +++---
fs/resctrl/rdtgroup.c | 18 +++++++++---------
include/linux/resctrl.h | 10 +++++-----
5 files changed, 20 insertions(+), 20 deletions(-)
)


Thanks,

James