[PATCH v7 04/19] fs/resctrl: Introduce kernel mode enum

Babu Moger babu.moger at amd.com
Thu Dec 3 11:45:19 PST 2026


Hi Reinette,

On 12/1/26 22:44, Reinette Chatre wrote:
> Hi Babu,
> 
> On 11/11/26 2:43 PM, Babu Moger wrote:
>> Kernel work need not use the CLOSID and RMID of the user task on whose
>> behalf it runs. On x86, Privilege Level Zero Association (PLZA) enables a
>> CPU to use a different CLOSID and/or RMID association while executing at
> 
> Please drop "association".

Yes.

> 
>> privilege level zero.
>>
>> Resctrl needs common definitions of how kernel work is managed so that
>> architectures can advertise the kernel modes they support and user space
>> can query them and select the one to use.
>>
>> Introduce enum resctrl_kernel_mode:
> 
> This is missing a motivation for why the modes below are introduced. How about
> something like:
> 
>    Introduce enum resctrl_kernel_mode with the behavior of every system today
>    and the behavior that PLZA supports:
> 
>    - RESCTRL_INHERIT_USER: Kernel work uses the CLOSID and RMID of the user
>      task. This is the only behavior available today and remains the default.
>      Naming it allows it to be reported and selected again after another mode
>      was in use.
> 
>    - RESCTRL_GLOBAL_ENABLE_PER_CPU: All the kernel work uses the CLOSID
>      and/or RMID of a single resource group, which may also have user tasks
>      assigned to it. The mode can be enabled or disabled per-CPU; on a CPU
>      where it is disabled, kernel work inherits the user task's CLOSID and
>      RMID. This is the behavior PLZA supports, but the mode is named for the
>      behavior so that any architecture that supports it can use it.

Looks good. Thanks.
> 
>>
>> - RESCTRL_INHERIT_USER: Kernel work uses the CLOSID and RMID of the user
>>    task.
>>
>> - RESCTRL_GLOBAL_ENABLE_PER_CPU: All the kernel work uses the CLOSID
>>    and/or RMID of a single resource group, which may also have user tasks
>>    assigned to it. The mode can be enabled or disabled per-CPU; on a CPU
>>    where it is disabled, kernel work inherits the user task's CLOSID and
>>    RMID.
>>
>> Signed-off-by: Babu Moger <babu.moger at amd.com>
>> ---
> 
> ...
> 
>> ---
>>   include/linux/resctrl.h | 25 +++++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>>
>> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
>> index b6b4519a5190..6f3e57ec4aa3 100644
>> --- a/include/linux/resctrl.h
>> +++ b/include/linux/resctrl.h
>> @@ -716,6 +716,31 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable);
>>    */
>>   bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r);
>>   
>> +/**
>> + * enum resctrl_kernel_mode - Kernel modes
>> + *
>> + * @RESCTRL_INHERIT_USER:
>> + *     Kernel work inherits the CLOSID and RMID of the user task.
>> + *
>> + * @RESCTRL_GLOBAL_ENABLE_PER_CPU:
>> + *     All kernel work uses the CLOSID and/or RMID of a single resource
>> + *     group, which may also have user tasks assigned to it. The mode can
>> + *     be enabled/disabled per-CPU, all online CPUs are enabled by default.
>> + *     When the mode is disabled on a CPU then the kernel work on that CPU
>> + *     inherits the CLOSID and RMID from the user task, effectively the
>> + *     kernel mode becomes RESCTRL_INHERIT_USER on that CPU.
>> + *
>> + *     On x86, CLOSID and RMID are configured independently; either or both
>> + *     may differ from the user task.
> 
> I saw the comment from sashiko. Considering this is an x86 specific comment in
> resctrl fs header the above sentence could also just be dropped?

Sure. Dropped it.

Thanks
Babu



More information about the linux-arm-kernel mailing list