Re: [PATCH v3 00/12] [PATCH v3 00/12] x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem
From: Moger, Babu
Date: Fri Jun 12 2026 - 11:38:19 EST
On 6/11/2026 4:53 PM, Reinette Chatre wrote:
Hi Babu,
On 4/30/26 4:24 PM, Babu Moger wrote:
Design
======
A new sysfs file, info/kernel_mode, holds a single global policy that
selects what kernel work is steered and which rdtgroup it is steered
How should "selects *what* kernel work is steered" be interpreted? Do these
modes not all apply to *all* kernel work?
How about?
A new sysfs file, info/kernel_mode, holds a single global policy for kernel contexts and the rdtgroup associated with the policy.
to. Reads describe the supported modes and the currently-active
binding; writes change the policy or rebind to a different group.
Look at the thread below for design discussion.
https://lore.kernel.org/lkml/14a8ad0a-e842-4268-871a-0762f1169e03@xxxxxxxxx/
...
Examples
========
(See Documentation/filesystems/resctrl.rst, "kernel_mode" and
"kmode_cpus" sections, for the full UAPI.)
# Mount resctrl
# mount -t resctrl resctrl /sys/fs/resctrl
# cd /sys/fs/resctrl
# Read the supported modes. The active mode is bracketed and reports
# the bound "<ctrl>/<mon>/" group; other supported modes report
# ":group=none" because nothing is bound to them.
# cat info/kernel_mode
[inherit_ctrl_and_mon:group=//]
This is unexpected since associating a group to this mode implies that this
group is used to manage allocations and monitoring of kernel work but this
is not true, right? From what I understand there should be no group associated with
this default "inherit_ctrl_and_mon" mode.
The default mode is "inherit_ctrl_and_mon", where both user mode and kernel mode share the same CLOSID and RMID. This is current mode (without this series).
I thought we are going to set the default mode with the default group when system boots up. No?
global_assign_ctrl_inherit_mon_per_cpu:group=none
global_assign_ctrl_assign_mon_per_cpu:group=none
nit: "none" does not reflect state as clearly as "unset"/"uninitialized"/"NA"
Lets go with "uninitialized".
# Create a CTRL_MON group plus a MON child and bind both the kernel
# CLOSID and RMID to them.
# mkdir ctrl1
# mkdir ctrl1/mon_groups/mon1
# echo "global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/" \
> info/kernel_mode
# cat info/kernel_mode
inherit_ctrl_and_mon:group=none
global_assign_ctrl_inherit_mon_per_cpu:group=none
[global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/]
# kmode_cpus and kmode_cpus_list are visible only on the bound group.
# ls ctrl1/kmode_cpus*
ctrl1/kmode_cpus ctrl1/kmode_cpus_list
Since it is ctrl1/mon1 that was bound, should these CPU files not appear
in ctrl1/mon_groups/mon1 ?
Correct. Will fix it.
# Restrict the binding to a CPU subset; the write is incremental.
Does "incremental" mean that if the file contains CPUs 0-3 then writing
"4" would set the CPUs to 0-4? This does not sound right since it is
expected that user space can remove CPUs also?
Will remove incremental. Writing "4" will remove 0-3 and keep only 4.
# echo 0-3 > ctrl1/kmode_cpus_list
# cat ctrl1/kmode_cpus
f
# cat ctrl1/kmode_cpus_list
0-3
# Empty masks are rejected; use info/kernel_mode to reset to
# "every online CPU".
# echo "" > ctrl1/kmode_cpus_list
bash: echo: write error: Invalid argument
# cat info/last_cmd_status
Empty mask not allowed; use info/kernel_mode to unbind
Why are empty masks rejected/not allowed?
No specific reason.
When the mode is switched, we discussed earlier to globally apply the mode to all the online CPUs.
At this point reading "kmode_cpus_list" will still report empty.
Users can change it to selectively apply the mode by writing to "kmode_cpus_list".
I was not sure what was the action when empty masks are written.
Should the empty mask apply the mode to all the online CPUs?
# Disable kernel-mode steering (back to inherit, default group).
This sounds like kernel work is steered to default group which I
do not think is accurate for the "inherit_ctrl_and_mon" mode.
How about ?
Drop the kernel-mode binding and restore inherit_ctrl_and_mon on the default group.
thanks
Babu