Re: [PATCH v4 03/24] x86/resctrl: Add a separate schema list for resctrl
From: James Morse
Date: Thu Jun 17 2021 - 13:03:07 EST
Hi Babu,
On 15/06/2021 18:51, Babu Moger wrote:
> On 6/14/21 3:09 PM, James Morse wrote:
>> Resctrl exposes schemata to user-space, which allow the control values
>> to be specified for a group of tasks.
>>
>> User-visible properties of the interface, (such as the schemata names
>> and how the values are parsed) are rooted in a struct provided by the
>> architecture code. (struct rdt_hw_resource). Once a second architecture
>> uses resctrl, this would allow user-visible properties to diverge
>> between architectures.
>>
>> These properties should come from the resctrl code that will be common
>> to all architectures. Resctrl has no per-schema structure, only struct
>> rdt_{hw_,}resource. Create a struct resctrl_schema to hold the
>> rdt_resource. Before a second architecture can be supported, this
>> structure will also need to hold the schema name visible to user-space
>> and the type of configuration values for resctrl.
>> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
>> index be6f5df78e31..425e7913dc8d 100644
>> --- a/include/linux/resctrl.h
>> +++ b/include/linux/resctrl.h
>> @@ -154,4 +154,15 @@ struct rdt_resource {
>>
>> };
>>
>> +/**
>> + * struct resctrl_schema - configuration abilities of a resource presented to
>> + * user-space
>> + * @list: Member of resctrl_schema_all.
>> + * @res: The resource structure exported by the architecture to describe
>> + * the hardware that is configured by this schema.
>> + */
>> +struct resctrl_schema {
>> + struct list_head list;
>> + struct rdt_resource *res;
> It will be better to be consistent with the naming.
> struct rdt_resource *resctrl;
Consistent with what? The rest of the code base conventionally calls a resource 'r'.
The structures with '_hw_' are private to the architecture, the 'resctrl' structure there
is the part of the struct that the architecture makes visible to the filesystem of that name.
That pattern doesn't apply here, 'struct resctrl_schema' is an invention of the
filesystem, the architecture code doesn't need to know anything about it. (this is why it
goes in include/linux from the beginning).
I think the choices are 'r', (too terse), 'resource' (too much typing, obvious from the
type), or 'res'...
Thanks!
James