Re: [RESEND PATCH v4 04/15] fs/resctrl: Introduce kernel mode (kmode) data structures
"Moger, Babu" <[email protected]>
| Newsgroups | org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hi Reinette,
On 8/10/2026 10:03 PM, Reinette Chatre wrote:
> Hi Babu,
>
> On 7/7/26 2:50 PM, Babu Moger wrote:
>> Kernel-mode traffic can use a different allocation and monitoring context
>> than the originating user task. On x86, Privilege Level Zero Association
>> (PLZA) enables the kernel to switch to a different CLOSID (and optionally
>> RMID) when entering kernel mode.
>>
>> Architectures need a common way to name kernel-mode policies before resctrl
>
> Please pick one term and stick with it. While reading through this series I
> have come across "kernel-mode policies", "kernel-mode binding", "kernel-mode
> configuration", and "kernel-mode association". Is the distinction even needed?
> Could all of these just instead be: "kernel mode"?
Sure.
>
>> can report what is active or what the platform supports.
>>
>> Introduce enum resctrl_kernel_mode:
>> - INHERIT_CTRL_AND_MON: Kernel work inherits allocation and monitoring
>> from the user task (current behavior).
>
> The issue with this "combination" mode becomes obvious in patch 7. I also
> see that sashiko hinted at this issue but I am not able to see from your response
> what the plan is to address this. As highlighted by patch 7 and sashiko the
> "allocation" and "monitoring" features of a system are independent - a system
> need not support/enable both. This should be easy to reproduce by, for example,
> booting a system with needed rdt= options disabling allocation or monitoring
> features.
>
> I think it will be unexpected to a user on an allocation-only system to
> see interface like:
>
> # cat info/kernel_mode
> [inherit_ctrl_and_mon]
> global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
> global_assign_ctrl_assign_mon_per_cpu:group=uninitialized
>
> Should it not rather be, for example:
> # cat info/kernel_mode
> [inherit_ctrl]
> global_assign_ctrl_per_cpu:group=uninitialized
>
> Similarly the user input would not need to provide a monitor group when system
> only supports allocation.
Ok. Yea. We need to separate control and monitor separately.
How about something like this?
# cat info/kernel_mode
[ctrl=inherit,mon=inherit]
ctrl=assign,mon=inherit:group=uninitialized
ctrl=assign,mon=assign:group=uninitialized
ctrl=inherit,mon=assign:group=uninitialized
If allocation(ctrl) is only supported.
# cat info/kernel_mode
[ctrl=inherit]
ctrl=assign:group=uninitialized
If monitor (mon) is only supported.
# cat info/kernel_mode
[mon=inherit]
mon=assign:group=uninitialized
>
>> - GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU: Assign allocation for kernel
>> work; inherit monitoring from the user task.
>
> I am not able to parse "Assign allocation for kernel work"
Will change it. Explaining in control and monitor groups terms will be
better.
>
>
>> - GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU: Assign a dedicated allocation
>> and monitoring for kernel work.
>>
>> Signed-off-by: Babu Moger <[email protected]>
>> ---
>
> ...
>
>> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
>> index 73ff522448a0..c7abed51cd5f 100644
>> --- a/include/linux/resctrl.h
>> +++ b/include/linux/resctrl.h
>> @@ -703,6 +703,37 @@ 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-mode control and monitor association
>> + * policy.
>> + *
>> + * @INHERIT_CTRL_AND_MON:
>> + * Kernel work inherits the allocation and monitoring from the user space
>
> "inherits the allocation and monitoring" is very vague. I think it will help to
> make things clear if this is described as the control and monitor groups being
> assigned.
>
Sure.
>> + * task. On x86 this means that kernel work shares the same CLOSID and
>> + * RMID as the user space task. This matches today's resctrl behavior.
>
> "This matches today's resctrl behavior." - This cannot be expected to age well and can
> be dropped.
Will change.
>
>> + *
>> + * @GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU:
>> + * Kernel work uses a globally assigned allocation while monitoring is
>> + * inherited from the user space task. On x86 this means a CLOSID is
>
> (same comment as above)
ack.
>
>> + * assigned for kernel work and the RMID is inherited from the user space
>> + * task. Default scope is all online CPUs; a subset may be selected via
>> + * the resctrl group interface. A CTRL_MON group is bound to this mode.
>> + *
>> + * @GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU:
>> + * Kernel work uses globally assigned allocation and monitoring. On x86
>
> (same comment as above)
Ack.
>
>> + * this means both CLOSID and RMID are assigned for kernel work. Default
>> + * scope is all online CPUs; a subset may be selected via the resctrl
>> + * group interface. A CTRL_MON or MON group is bound to this mode.
>> + */
>> +enum resctrl_kernel_mode {
>> + INHERIT_CTRL_AND_MON,
>> + GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU,
>> + GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
>> + RESCTRL_KMODE_LAST = GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
>
> Please drop comma on a terminator line.
Sure.
Thanks
Babu