x86,fs/resctrl: Support for Global Bandwidth Enforcement and Priviledge Level Zero Association
Subsystems (5)
Re: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
In reply to Reinette ChatreHi Reinette,
Quoted 483 lines · Reinette Chatre
Hi Tony, Ben, Babu, and Stephane,
Quoted 143 lines · Tony
Quoted 102 lines · Reinette Chatre
Hi Tony,
Quoted 48 lines · Tony
Quoted 47 lines · Reinette Chatre
Hi Tony,
Quoted 43 lines · Tony
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
I'm not sure if this would happen in the real world or not.
Ack. I would like to echo Tony's request for feedback from resctrl users
https://lore.kernel.org/lkml/aYzcpuG0PfUaTdqt@agluck-desk3/Indeed. This is all getting a bit complicated.
ack
We have several proposals so far:
1) Ben's suggestion to use the default group (either with a Babu-style "plza" file just in that group, or a configuration file under "info/").
This is easily the simplest for implementation, but has no flexibility. Also requires users to move all the non-critical workloads out to other
CTRL_MONgroups. Doesn't steal a CLOSID/RMID.2) My thoughts are for a separate group that is only used to configure the schemata. This does allocate a dedicated CLOSID/RMID pair. Those are used for all tasks when in kernel mode.
No context switch overhead. Has some flexibility.
3) Babu's RFC patch. Designates an existing
CTRL_MONgroup as the one that defines kernel CLOSID/RMID. Tasks and CPUs can be assigned to this group in addition to belonging to another group than defines schemata resources when running in non-kernel mode.
Tasks aren't required to be in the kernel group, in which case they keep the same CLOSID in both user and kernel mode. When used in this way there will be context switch overhead when changing between tasks with different kernel CLOSID/RMID.4) Even more complex scenarios with more than one user configurable kernel group to give more options on resources available in the kernel.
I had a quick pass as coding my option "2". My UI to designate the group to use for kernel mode is to reserve the name "
kernel_group" when makingCTRL_MONgroups. Some tweaks to avoid creating the "tasks", "cpus", and "cpus_list" files (which might be done more elegantly), and "mon_groups" directory in this group.Quoted 6 lines
Quoted 2 lines
Should the decision of whether context switch overhead is acceptable not be left up to the user?
When someone comes up with a convincing use case to support one set of kernel resources when interrupting task A, and a different set of resources when interrupting task B, we should certainly listen.
Absolutely. Someone can come up with such use case at any time tough. This could be, and as has happened with some other resctrl interfaces, likely will be after this feature has been supported for a few kernel versions. What timeline should we give which users to share their use cases with us? Even if we do hear from some users will that guarantee that no such use case will arise in the future? Such predictions of usage are difficult for me and I thus find it simpler to think of flexible ways to enable the features that we know the hardware supports.
This does not mean that a full featured solution needs to be implemented from day 1. If folks believe there are "no valid use cases" today resctrl still needs to prepare for how it can grow to support full hardware capability and hardware designs in the future.
Also, please also consider not just resources for kernel work but also monitoring for kernel work. I do think, for example, a reasonable use case may be to determine how much memory bandwidth the kernel uses on behalf of certain tasks.
Quoted 5 lines
Quoted 3 lines
I assume that, just like what is currently done for x86's
MSR_IA32_PQR_ASSOC, the needed registers will only be updated if there is a new CLOSID/RMID needed for kernel space.Babu's RFC does this.
Right.
Quoted 10 lines
Quoted 5 lines
Are you suggesting that just this checking itself is too
expensive to justify giving user space more flexibility by fully enabling what the hardware supports? If resctrl does draw such a line to not enable what hardware supports it should be well justified.The check is likley light weight (as long as the variables to be compared reside in the same cache lines as the exisitng CLOSID and RMID checks). So if there is a use case for different resources when in kernel mode, then taking this path will be fine.
Why limit this to knowing about a use case? As I understand this feature can be supported in a flexible way without introducing additional context switch overhead if the user prefers to use just one allocation for all kernel work. By being configurable and allowing resctrl to support more use cases in the future resctrl does not paint itself into a corner. This allows resctrl to grow support so that the user can use all capabilities of the hardware with understanding that it will increase context switch time.
Quoted 1 line
Reinette
How about this idea for extensibility.
Rename Babu's "plza" file to "
plza_mode". Instead of just being an on/off switch, it may accept multiple possible requests.Humorous version:
# echo "babu" > plza_modeThis results in behavior of Babu's RFC. The CLOSID and RMID assigned to the
CTRL_MONgroup are used when in kernel mode, but only for tasks that have their task-id written to the "tasks" file or for tasks in the default group in the "cpus" or "cpus_list" files are used to assign CPUs to this group.# echo "tony" > plza_modeAll tasks run with the CLOSID/RMID for this group. The "tasks", "cpus" and "
cpus_list" files and the "mon_groups" directory are removed.# echo "ben" > plza_mode"Only usable in the top-level default
CTRL_MONdirectory. CLOSID=0/RMID=0 are used for all tasks in kernel mode.# echo "stephane" > plza_modeThe RMID for this group is freed. All tasks run in kernel mode with the CLOSID for this group, but use same RMID for both user and kernel. In addition to files removed in "tony" mode, the
mon_datadirectory is removed.# echo "some-future-name" > plza_modeSomebody has a new use case. Resctrl can be extended by allowing some new mode.
Quoted 7 lines
Likely real implementation:
Sub-components of each of the ideas above are encoded as a bitmask that is written to
plza_mode. There is a file in the info/ directory listing which bits are supported on the current system (e.g. the "keep the same RMID" mode may be impractical on ARM, so it would not be listed as an option.)I like the idea of a global file that indicates what is supported on the system. I find this to match Ben's proposal of a "
kernel_mode" file in info/ that looks to be a good foundation to build on. Ben also reiterated support for this in
https://lore.kernel.org/lkml/[email protected]/As I mentioned in https://lore.kernel.org/lkml/[email protected]/
the suggestions surrounding the per-resource group "plza_mode" file
are unexpected since they ignore earlier comments about impact on user space. Specifically, this proposal does not address:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/Below I aim to summarize the discussions as they relate to constraints and requirements. I intended to capture all that has been mentioned in these discussions so far so if I did miss something it was not intentional and please point this out to help make this summary complete.
I hope by starting with this we can start with at least agreeing what resctrl needs to support and how user space could interact with resctrl to meet requirements.
After the summary of what resctrl needs to support I aim to combine capabilities from the various proposals to meet the constraints and requirements as I understand them so far. This aims to build on all that has been shared until now.
Any comments are appreciated.
Summary of considerations surrounding CLOSID/RMID (PARTID/PMG) assignment for kernel work
=========================================================================================- PLZA currently only supports global assignment (only
PLZA_ENofMSR_IA32_PQR_PLZA_ASSOCmay differ on logical processors). Even so, current speculation is that RMID_EN=0 implies that user space RMID is used to monitor kernel work that could appear to user as "kernel mode" supporting multiple RMIDs.
https://lore.kernel.org/lkml/[email protected]/- MPAM can set unique PARTID and PMG on every logical processor.
https://lore.kernel.org/lkml/[email protected]/- While current PLZA only supports global assignment it may in future generations not require
MSR_IA32_PQR_PLZA_ASSOCto be same on logical processors. resctrl thus needs to be flexible here.
https://lore.kernel.org/lkml/[email protected]/- No equivalent feature on RISC-V.
https://lore.kernel.org/lkml/aYvP98xGoKPrDBCE@gen8/- Impact on context switch delay is a concern and unnecessary context switch delay should be avoided.
https://lore.kernel.org/lkml/aZThTzdxVcBkLD7P@agluck-desk3/
https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/- There is no requirement that a CLOSID/PARTID should be dedicated to kernel work. Specifically, same CLOSID/PARTID can be used for user space and kernel work. Also directly requested to not make kernel work CLOSID/PARTID exclusive:
https://lore.kernel.org/lkml/[email protected]/- Only use case presented so far is related to memory bandwidth allocation where all kernel work is done unthrottled or equivalent to highest priority tasks while monitoring remains associated to task self.
https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
PLZA can support this with its global allocation (assuming RMID_EN=0 associates user RMID with kernel work) To support this use case MPAM would need to be able to change both PARTID and PMG:
https://lore.kernel.org/lkml/[email protected]/- Motivation of this work is to run kernel work with more/all/unthrottled resources to avoid priority inversions. We need to be careful with such generalization since not all resource allocations are alike yet a CLOSID/PARTID assignment applies to all resources. For example, user may designate a cache portion for high priority user space work and then needs to choose which cache portions the kernel may allocate into.
https://lore.kernel.org/lkml/[email protected]/
- If all kernel work is done using the same allocation/CLOSID/PARTID then user needs to decide whether the kernel work's cache allocation overlaps the high priority tasks or not. To avoid evicting high priority task work it may be simplest for kernel allocation to not overlap high priority work but kernel work done on behalf of high priority work would then risk eviction by low priority work.
- When considering cache allocation it seems more flexible to have high priority work keep its cache allocation when entering the kernel? This implies more than one CLOSID/PARTID may need to be used for kernel work.TBD
===
- What is impact of different controls (for example the upcoming MAX) when tasks are spread across multiple control groups?
https://lore.kernel.org/lkml/[email protected]/How can MPAM support the "monitor kernel work with user space work" use case?
=============================================================================
This considers how MPAM could support the use case presented in:
https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/To support this use case in MPAM the control group that dictates the allocations used in kernel work has to have monitor group(s) where this usage is tracked and user space would need to sum the kernel and user space usage. The number of PMG may vary and resctrl cannot assume that the kernel control group would have sufficient monitor groups to map 1:1 with user space control and monitor groups. Mapping user space control and monitor groups to kernel monitor groups thus seems best to be done by user space.
Some examples:
Consider allocation and monitoring setup for user space work:
/sys/fs/resctrl<= User space default allocations/sys/fs/resctrl/g1<= User space allocations g1/sys/fs/resctrl/g1/mon_groups/g1m1<= User space monitoring group g1m1/sys/fs/resctrl/g1/mon_groups/g1m2<= User space monitoring group g1m2/sys/fs/resctrl/g2<= User space allocations g2/sys/fs/resctrl/g2/mon_groups/g2m1<= User space monitoring group g2m1/sys/fs/resctrl/g2/mon_groups/g2m2<= User space monitoring group g2m2Having a single control group for kernel work and a system that supports 7 PMG per PARTID makes it possible to have a monitoring group for each user space monitoring group:
(will go more into how such assignments can be made later)
/sys/fs/resctrl/kernel<= Kernel space allocations
/sys/fs/resctrl/kernel/mon_data<= Kernel space monitoring default group
/sys/fs/resctrl/kernel/mon_groups/kernel_g1<= Kernel space monitoring group g1
/sys/fs/resctrl/kernel/mon_groups/kernel_g1m1<= Kernel space monitoring group g1m1/sys/fs/resctrl/kernel/mon_groups/kernel_g1m2<= Kernel space monitoring group g1m2
/sys/fs/resctrl/kernel/mon_groups/kernel_g2<= Kernel space monitoring group g2
/sys/fs/resctrl/kernel/mon_groups/kernel_g2m1<= Kernel space monitoring group g2m1/sys/fs/resctrl/kernel/mon_groups/kernel_g2m2<= Kernel space monitoring group g2m2With a configuration as above user space can sum the monitoring events of the user space groups and associated kernel space groups to obtain counts of all work done on behalf of associated tasks.
It may not be possible to have such 1:1 relationship and user space would have to arrange groups to match its usage. For example if system only supports two PMG per PARTID then user space may find it best to track monitoring as below:
/sys/fs/resctrl/kernel<= Kernel space allocations
/sys/fs/resctrl/kernel/mon_data<= Kernel space monitoring for all of default and g1
/sys/fs/resctrl/kernel/mon_groups/kernel_g2<= Kernel space monitoring for all of g2Requirements
============
Based on understanding of what PLZA and MPAM is (and could be) capable of while considering the use case presented thus far it seems that resctrl has to:
- support global assignment of resource group for kernel work
- support per-resource group assignment for kernel workHow can resctrl support the requirements?
=========================================New global resctrl fs files
===========================
info/kernel_mode (always visible)
info/kernel_mode_assignment (visibility and content depends on active setting in info/kernel_mode)info/kernel_mode
================
- Displays the currently active as well as possible features available to user
space.
- Single place where user can query "kernel mode" behavior and capabilities of the
system.
- Some possible values:
-inherit_ctrl_and_mon<=== previously named "match_user", just renamed for consistency with other names When active, kernel and user space use the same CLOSID/RMID. The current status
quo for x86.
-global_assign_ctrl_inherit_mon
When active, CLOSID/control group can be assigned for *all* (hence, "global")
kernel work while all kernel work uses same RMID as user space.
Can only be supported on architecture where CLOSID and RMID are independent.
An arch may support this in hardware (RMID_EN=0?) or this can be done by resctrl during
context switch if the RMID is independent and the context switches cost is
considered "reasonable".
This supports use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for PLZA.
-global_assign_ctrl_assign_mon
When active the same resource group (CLOSID and RMID) can be assigned to
*all* kernel work. This could be any group, including the default group.
There may not be a use case for this but it could be useful as an intemediate
step of the mode that follow (more later).
-per_group_assign_ctrl_assign_mon
When active every resource group can be associated with another (or the same)
resource group. This association maps the resource group for user space work
to resource group for kernel work. This is similar to the "kernel_group" idea
presented in:
https://lore.kernel.org/lkml/[email protected]/
This addresses use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for MPAM.
- Additional values can be added as new requirements arise, for example "per_task"
assignment. Connecting visibility of info/kernel_mode_assignment to mode in
info/kernel_mode enables resctrl to later support additional modes that may require
different configuration files, potentially per-resource group like the "tasks_kernel"
(or perhaps rather "kernel_mode_tasks" to have consistent prefix for this feature)
and "cpus_kernel" ("kernel_mode_cpus"?) discussed in these threads.User can view active and supported modes:
# cat info/kernel_mode [inherit_ctrl_and_mon] global_assign_ctrl_inherit_mon global_assign_ctrl_assign_monUser can switch modes:
# echo global_assign_ctrl_inherit_mon > kernel_mode # cat kernel_mode inherit_ctrl_and_mon [global_assign_ctrl_inherit_mon] global_assign_ctrl_assign_moninfo/kernel_mode_assignment
===========================
- Visibility depends on active mode in info/kernel_mode.
- Content depends on active mode in info/kernel_mode
- Syntax to identify resource groups can use the syntax created as part of earlier ABMC work that supports default group https://lore.kernel.org/lkml/[email protected]/
- DefaultCTRL_MONgroup and if relevant, the default MON group, can be the default assignment when user just changes thekernel_modewithout setting the assignment.info/kernel_mode_assignment when mode is
global_assign_ctrl_inherit_mon
-----------------------------------------------------------------------
- info/kernel_mode_assignment contains single value that is the name of the control group used for all kernel work.
- CLOSID/PARTID used for kernel work is determined from the control group assigned
- default value is defaultCTRL_MONgroup
- no monitor group assignment, kernel work inherits user space RMID
- syntax is
<CTRL_MONgroup> with "/" meaning default.info/kernel_mode_assignment when mode is
global_assign_ctrl_assign_mon
-----------------------------------------------------------------------
- info/kernel_mode_assignment contains single value that is the name of the resource group used for all kernel work.
- Combined CLOSID/RMID or combined PARTID/PMG is set globally to be associated with all kernel work.
- default value is defaultCTRL_MONgroup
- syntax is
<CTRL_MONgroup>/MON group>/ with "//" meaning default control and default monitoring group.info/kernel_mode_assignment when mode is
per_group_assign_ctrl_assign_mon
-------------------------------------------------------------------------
- this presents the information proposed in https://lore.kernel.org/lkml/[email protected]/
within a single file for convenience and potential optimization when user space needs to make changes. Interface proposed in https://lore.kernel.org/lkml/[email protected]/ is also an option and as an alternative a per-resource group "kernel_group" can be made visible when user space enables this mode.
- info/kernel_mode_assignment contains a mapping of every resource group to another resource group:
<resource group for user space work>:<resource group for kernel work>
- all resource groups must be present in first field of this file
- Even though this is a "per group" setting expectation is that this will set the
kernel work CLOSID/RMID for every task. This implies that writing to this file would need to access thetasklist_lockthat, when taking for too long, may impact other parts of system. See https://lore.kernel.org/lkml/CALPaoCh0SbG1+VbbgcxjubE7Cc2Pb6QqhG3NH6X=WwsNfqNjtA@mail.gmail.com/Scenarios supported
===================Default
-------
For x86 I understand kernel work and user work to be done with same CLOSID/RMID which implies that info/kernel_mode can always be visible and at least display:# cat info/kernel_mode [inherit_ctrl_and_mon]info/kernel_mode_assignment is not visible in this mode.
I understand MPAM may have different defaults here so would like to understand better.
Dedicated global allocations for kernel work, monitoring same for user space and kernel (PLZA)
----------------------------------------------------------------------------------------------
Possible scenario with PLZA, not MPAM (see later):
1. Create group(s) to manage allocations associated with user space work
and assign tasks/CPUs to these groups.
2. Create group to manage allocations associated with all kernel work.
- For example,# mkdir /sys/fs/resctrl/unthrottled - No constraints from resctrl fs on interactions with files in this group. From resctrl fs perspective it is not "dedicated" to kernel work but just another resource group. User space can still assign tasks/CPUs to this group that will result in this group to be used for both kernel and user space control and monitoring. If user space wants to dedicate a group to kernel work then they should not assign tasks/CPUs to it. 3. Set kernel mode to global_assign_ctrl_inherit_mon: # echo global_assign_ctrl_inherit_mon > info/kernel_mode - info/kernel_mode_assignment becomes visible and contains "/" to indicate that default resource group is used for all kernel work - Sets the "global" CLOSID to be used for kernel work to 0, no setting of global RMID. 4. Set control group to be used for all kernel work: # echo unthrottled > info/kernel_mode_assignment - Sets the "global" CLOSID to be used for kernel work to CLOSID associated with CTRL_MON group named "unthrottled", no change to global RMID.Dedicated global allocations and monitoring for kernel work
-----------------------------------------------------------
- Step 1 and 2 could be the same as above.
OR
2b. If there is an "unthrottled" control group that is used for both user space and kernel
allocations a separate MON group can be used to track monitoring data for kernel work.
- For example,# mkdir /sys/fs/resctrl/unthrottled <=== All high priority work, kernel and user space # mkdir /sys/fs/resctrl/unthrottled/mon_groups/kernel_unthrottled <= Just monitor kernel work3. Set kernel mode to
global_assign_ctrl_assign_mon:# echo global_assign_ctrl_assign_mon > info/kernel_mode - info/kernel_mode_assignment becomes visible and contains "//" - default CTRL_MON is used for all kernel work allocations and monitoring - Sets both the "global" CLOSID and RMID to be used for kernel work to 0. 4. Set control group to be used for all kernel work: # echo unthrottled/kernel_unthrottled > info/kernel_mode_assignment - Sets the "global" CLOSID to be used for kernel work to CLOSID associated with CTRL_MON group named "unthrottled" and RMID used for kernel work to RMID associated with child MON group within "unthrottled" group named "kernel_untrottled".Dedicated global allocations for kernel work, monitoring same for user space and kernel (MPAM)
----------------------------------------------------------------------------------------------
1. User space creates resource and monitoring groups for user tasks:
/sys/fs/resctrl<= User space default allocations
/sys/fs/resctrl/g1<= User space allocations g1/sys/fs/resctrl/g1/mon_groups/g1m1<= User space monitoring group g1m1/sys/fs/resctrl/g1/mon_groups/g1m2<= User space monitoring group g1m2/sys/fs/resctrl/g2<= User space allocations g2/sys/fs/resctrl/g2/mon_groups/g2m1<= User space monitoring group g2m1/sys/fs/resctrl/g2/mon_groups/g2m2<= User space monitoring group g2m22. User space creates resource and monitoring groups for kernel work (system has two PMG):
/sys/fs/resctrl/kernel<= Kernel space allocations
/sys/fs/resctrl/kernel/mon_data<= Kernel space monitoring for all of default and g1
/sys/fs/resctrl/kernel/mon_groups/kernel_g2<= Kernel space monitoring for all of g2
3. Set kernel mode toper_group_assign_ctrl_assign_mon:
Quoted 16 lines
# echo per_group_assign_ctrl_assign_mon > info/kernel_mode
- info/kernel_mode_assignment becomes visible and contains
# cat info/kernel_mode_assignment
//://
g1//://
g1/g1m1/://
g1/g1m2/://
g2//://
g2/g2m1/://
g2/g2m2/://
- An optimization here may be to have the change to per_group_assign_ctrl_assign_mon mode be implemented
similar to the change to global_assign_ctrl_assign_mon that initializes a global default. This can
avoid keeping tasklist_lock for a long time to set all tasks' kernel CLOSID/RMID to default just for
user space to likely change it.
4. Set groups to be used for kernel work:
# echo '//:kernel//\ng1//:kernel//\ng1/g1m1/:kernel//\ng1/g1m2/:kernel//\ng2//:kernel/kernel_g2/\ng2/g2m1/:kernel/kernel_g2/\ng2/g2m2/:kernel/kernel_g2/\n' > info/kernel_mode_assignmentAm I right in thinking that you want this in the info directory to avoid adding files to the CTRL_MON/MON groups?
Quoted 1 line
Quoted 1 line
The interfaces proposed aim to maintain compatibility with existing
user space tools while
Quoted 8 lines
adding support for all requirements expressed thus far in an efficient way. For an existing user space tool there is no change in meaning of any existing file and no existing known resource group files are made to disappear. There is a global configuration that lets user space manage allocations without needing to check and configure each control group, even per-resource group allocations can be managed from user space with a single read/write to support making changes in most efficient way.
What do you think?
Looks a good and well considered plan. Thank you in particular for figuring out how MPAM fits in.
Quoted 3 lines
Reinette
Thanks,
Ben
Re: [RFC PATCH 01/19] x86,fs/resctrl: Add support for Global Bandwidth Enforcement (GLBE)
In reply to Reinette ChatreHi, Reinette,
Quoted 13 lines
What if, instead, it looks something like:
info/
└── MB/ └── resource_schemata/ ├── GMB/ │ ├── max:4096 │ ├── min:1 │ ├── resolution:1 │ ├── scale:1 │ ├── tolerance:0 │ ├── type:scalar linear │ └── unit:GBps
Quoted 8 lines
└── MB/
├── max:8192
├── min:1
├── resolution:8
├── scale:1
├── tolerance:0
├── type:scalar linear
└── unit:GBpsMay I have 2 comments?
1. This directory is for both info and control, right?
"info" is a read-only directory:
dr-xr-xr-x 8 root root 0 Feb 23 12:50 info
And its name suggests it's for info only as well.
Instead of mixing legal info and control together, is it better to add a new "control" or "config" directory in /sys/fs/resctrl for this control and info purpose?
2. This control method seems only handles global control for resources. But what if a control is per domain and per closid/partid?
For example, MPAM has a hardlimit control per mem bandwidth allocation domain per partid. When hardlimit is enabled, MPAM hardware enforces hard limit of MBW max. This can not be controlled globally.
For this kind of per partid per domain control, propose config_schemata/control_schemata file:
partition X/
control_schemata (or config_schemata): MB_hardlimit: 0=0/1;1=0/1;...
Is this reasonable?
Thanks.
-Fenghua
Re: [RFC PATCH 01/19] x86,fs/resctrl: Add support for Global Bandwidth Enforcement (GLBE)
In reply to Reinette ChatreHi, Reinette,
Quoted 13 lines
What if, instead, it looks something like:
info/
└── MB/ └── resource_schemata/ ├── GMB/ │ ├── max:4096 │ ├── min:1 │ ├── resolution:1 │ ├── scale:1 │ ├── tolerance:0 │ ├── type:scalar linear │ └── unit:GBps
Quoted 8 lines
└── MB/
├── max:8192
├── min:1
├── resolution:8
├── scale:1
├── tolerance:0
├── type:scalar linear
└── unit:GBpsMay I have 2 comments?
1. This directory is for both info and control, right?
"info" is a read-only directory:
dr-xr-xr-x 8 root root 0 Feb 23 12:50 info
And its name suggests it's for info only as well.
Instead of mixing legal info and control together, is it better to add a new "control" or "config" directory in /sys/fs/resctrl for this control and info purpose?
2. This control method seems only handles global control for resources. But what if a control is per domain and per closid/partid?
For example, MPAM has a hardlimit control per mem bandwidth allocation domain per partid. When hardlimit is enabled, MPAM hardware enforces hard limit of MBW max. This can not be controlled globally.
For this kind of per partid per domain control, propose config_schemata/control_schemata file:
partition X/
control_schemata (or config_schemata): MB_hardlimit: 0=0/1;1=0/1;...
Is this reasonable?
Thanks.
-Fenghua
Reinette Chatre
maintainerRe: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
In reply to Ben HorganHi Ben,
Quoted 1 line · Ben Horgan
On 2/20/26 02:53, Reinette Chatre wrote:
...
Quoted 33 lines
Quoted 16 lines
Dedicated global allocations for kernel work, monitoring same for user space and kernel (MPAM)
----------------------------------------------------------------------------------------------
1. User space creates resource and monitoring groups for user tasks:
/sys/fs/resctrl<= User space default allocations
/sys/fs/resctrl/g1<= User space allocations g1/sys/fs/resctrl/g1/mon_groups/g1m1<= User space monitoring group g1m1/sys/fs/resctrl/g1/mon_groups/g1m2<= User space monitoring group g1m2/sys/fs/resctrl/g2<= User space allocations g2/sys/fs/resctrl/g2/mon_groups/g2m1<= User space monitoring group g2m1/sys/fs/resctrl/g2/mon_groups/g2m2<= User space monitoring group g2m22. User space creates resource and monitoring groups for kernel work (system has two PMG):
/sys/fs/resctrl/kernel<= Kernel space allocations
/sys/fs/resctrl/kernel/mon_data<= Kernel space monitoring for all of default and g1
/sys/fs/resctrl/kernel/mon_groups/kernel_g2<= Kernel space monitoring for all of g2
3. Set kernel mode toper_group_assign_ctrl_assign_mon:Quoted 16 lines
# echo per_group_assign_ctrl_assign_mon > info/kernel_mode - info/kernel_mode_assignment becomes visible and contains # cat info/kernel_mode_assignment //:// g1//:// g1/g1m1/:// g1/g1m2/:// g2//:// g2/g2m1/:// g2/g2m2/:// - An optimization here may be to have the change to per_group_assign_ctrl_assign_mon mode be implemented similar to the change to global_assign_ctrl_assign_mon that initializes a global default. This can avoid keeping tasklist_lock for a long time to set all tasks' kernel CLOSID/RMID to default just for user space to likely change it. 4. Set groups to be used for kernel work: # echo '//:kernel//\ng1//:kernel//\ng1/g1m1/:kernel//\ng1/g1m2/:kernel//\ng2//:kernel/kernel_g2/\ng2/g2m1/:kernel/kernel_g2/\ng2/g2m2/:kernel/kernel_g2/\n' > info/kernel_mode_assignment
Quoted 2 lines
Am I right in thinking that you want this in the info directory to avoid adding files to the CTRL_MON/MON groups?
I see this file as providing the same capability as you suggested in
https://lore.kernel.org/lkml/[email protected]/. The reason why I presented this as a single file is not because I am trying to avoid adding files to the CTRL_MON/MON groups but because I believe such interface enables resctrl to have more flexibility and support more scenarios for optimization.
As you mentioned in your proposal the solution enables a single write to move a task. As I thought through what resctrl needs to do on such write I saw a lot of similarities with mongrp_reparent() that loops through all the tasks via for_each_process_thread() while holding tasklist_lock. Issues with mongrp_reparent() holding tasklist_lock for a long time are described in [1].
While the single file does not avoid taking tasklist_lock it does give the user the ability to set kernel group for multiple user groups with a single write. When user space does so I believe it is possible for resctrl to have an optimization that takes tasklist_lock just once and make changes to tasks belonging to all groups while looping through all tasks on system just once. With files within the CTRL_MON/MON groups setting kernel group for multiple user groups will require multiple writes from user space where each write requires looping through tasks while holding tasklist_lock during each loop. From what I learned from [1] something like this can be very disruptive to the rest of the system.
In summary, I see having this single file provide the same capability as the on-file-per-CTRL_MON/MON group since user can choose to set kernel group for user group one at a time but it also gives more flexibility to resctrl for optimization.
Nothing is set in stone here. There is still flexibility in this proposal to support PARTID and PMG assignment with a single file in each CTRL_MON/MON group if we find that it has the more benefits. resctrl can still expose a "per_group_assign_ctrl_assign_mon" mode but instead of making "info/kernel_mode_assignment" visible when it is enabled the control file in CTRL_MON/MON groups are made visible ... even in this case resctrl could still add the single file later if deemed necessary at that time.
Considering all this, do you think resctrl should rather start with a file in each CTRL_MON/MON group?
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCh0SbG1+VbbgcxjubE7Cc2Pb6QqhG3NH6X=WwsNfqNjtA@mail.gmail.com/
Reinette Chatre
maintainerRe: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
In reply to Moger, BabuHi Babu,
Quoted 5 lines · Babu
Quoted 3 lines · Reinette Chatre
Summary of considerations surrounding CLOSID/RMID (PARTID/PMG) assignment for kernel work
=========================================================================================
Quoted 7 lines
Quoted 5 lines
- PLZA currently only supports global assignment (only
PLZA_ENofMSR_IA32_PQR_PLZA_ASSOCmay differ on logical processors). Even so, current speculation is that RMID_EN=0 implies that user space RMID is used to monitor kernel work that could appear to user as "kernel mode" supporting multiple RMIDs.
https://lore.kernel.org/lkml/[email protected]/Yes. RMID_EN=0 means dont use separate RMID for plza.
Thank you very much for confirming.
...
Quoted 9 lines
Quoted 7 lines
How can resctrl support the requirements?
=========================================New global resctrl fs files
===========================
info/kernel_mode (always visible)
info/kernel_mode_assignment (visibility and content depends on active setting in info/kernel_mode)Probably good idea to drop "assign" for this work. We already have
mbm_assignmode and related work.
hmmm ... I think "assign" is generic enough of a word that it cannot be claimed by a single feature.
Quoted 1 line
info/kernel_mode_assoc or info/kernel_mode_association? Or We can wait later to rename appropriately.
yes, naming can be settled later.
Quoted 45 lines
Quoted 26 lines
info/kernel_mode
================
- Displays the currently active as well as possible features available to user
space.
- Single place where user can query "kernel mode" behavior and capabilities of the
system.
- Some possible values:
-inherit_ctrl_and_mon<=== previously named "match_user", just renamed for consistency with other names When active, kernel and user space use the same CLOSID/RMID. The current status
quo for x86.
-global_assign_ctrl_inherit_mon
When active, CLOSID/control group can be assigned for *all* (hence, "global")
kernel work while all kernel work uses same RMID as user space.
Can only be supported on architecture where CLOSID and RMID are independent.
An arch may support this in hardware (RMID_EN=0?) or this can be done by resctrl during
context switch if the RMID is independent and the context switches cost is
considered "reasonable".
This supports use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for PLZA.
-global_assign_ctrl_assign_mon
When active the same resource group (CLOSID and RMID) can be assigned to
*all* kernel work. This could be any group, including the default group.
There may not be a use case for this but it could be useful as an intemediate
step of the mode that follow (more later).Quoted 8 lines
-
per_group_assign_ctrl_assign_mon
When active every resource group can be associated with another (or the same)
resource group. This association maps the resource group for user space work
to resource group for kernel work. This is similar to the "kernel_group" idea
presented in:
https://lore.kernel.org/lkml/[email protected]/
This addresses use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for MPAM.All these new names and related information will go in global structure.
Something like this..
Struct
kern_mode{
enumassoc_mode;
struct rdtgroup*k_rdtgrp;
...
};
Quoted 3 lines
Not sure what other information will be required here. Will know once I stared working on it.
This structure will be updated based on user echo's in "
kernel_mode" and "kernel_mode_assignment".
This looks to be a good start. I think keeping the rdtgroup association is good since it helps to easily display the name to user space while also providing access to the CLOSID and RMID that is assigned to the tasks.
By placing them in their own structure instead of just globals it does make it easier to build on when some modes have different requirements wrt rdtgroup management. You may encounter that certain arrangements work better to support interactions with the task structure that are not clear at this time.
Quoted 10 lines
Quoted 8 lines
- Additional values can be added as new requirements arise, for example "
per_task" assignment. Connecting visibility of info/kernel_mode_assignment to mode in info/kernel_mode enables resctrl to later support additional modes that may require different configuration files, potentially per-resource group like the "tasks_kernel" (or perhaps rather "kernel_mode_tasks" to have consistent prefix for this feature) and "cpus_kernel" ("kernel_mode_cpus"?) discussed in these threads.So, per resource group file "
kernel_mode_tasks" and "kernel_mode_cpus" are not required right now. Correct?
Correct. The way I see it the baseline implementation to support PLZA should be straightforward. We'll probably spend a bit extra time on the supporting documentation to pave the way for possible additions.
Quoted 87 lines
Quoted 44 lines
User can view active and supported modes:
# cat info/kernel_mode [inherit_ctrl_and_mon] global_assign_ctrl_inherit_mon global_assign_ctrl_assign_monUser can switch modes:
# echo global_assign_ctrl_inherit_mon > kernel_mode # cat kernel_mode inherit_ctrl_and_mon [global_assign_ctrl_inherit_mon] global_assign_ctrl_assign_moninfo/kernel_mode_assignment
===========================
- Visibility depends on active mode in info/kernel_mode.
- Content depends on active mode in info/kernel_mode
- Syntax to identify resource groups can use the syntax created as part of earlier ABMC work that supports default group https://lore.kernel.org/lkml/[email protected]/
- DefaultCTRL_MONgroup and if relevant, the default MON group, can be the default assignment when user just changes thekernel_modewithout setting the assignment.info/kernel_mode_assignment when mode is
global_assign_ctrl_inherit_mon
-----------------------------------------------------------------------
- info/kernel_mode_assignment contains single value that is the name of the control group used for all kernel work.
- CLOSID/PARTID used for kernel work is determined from the control group assigned
- default value is defaultCTRL_MONgroup
- no monitor group assignment, kernel work inherits user space RMID
- syntax is
<CTRL_MONgroup> with "/" meaning default.info/kernel_mode_assignment when mode is
global_assign_ctrl_assign_mon
-----------------------------------------------------------------------
- info/kernel_mode_assignment contains single value that is the name of the resource group used for all kernel work.
- Combined CLOSID/RMID or combined PARTID/PMG is set globally to be associated with all kernel work.
- default value is defaultCTRL_MONgroup
- syntax is
<CTRL_MONgroup>/MON group>/ with "//" meaning default control and default monitoring group.Quoted 14 lines
info/kernel_mode_assignment when mode is
per_group_assign_ctrl_assign_mon
-------------------------------------------------------------------------
- this presents the information proposed in https://lore.kernel.org/lkml/[email protected]/
within a single file for convenience and potential optimization when user space needs to make changes. Interface proposed in https://lore.kernel.org/lkml/[email protected]/ is also an option and as an alternative a per-resource group "kernel_group" can be made visible when user space enables this mode.
- info/kernel_mode_assignment contains a mapping of every resource group to another resource group:
<resource group for user space work>:<resource group for kernel work>
- all resource groups must be present in first field of this file
- Even though this is a "per group" setting expectation is that this will set the
kernel work CLOSID/RMID for every task. This implies that writing to this file would need to access thetasklist_lockthat, when taking for too long, may impact other parts of system. See https://lore.kernel.org/lkml/CALPaoCh0SbG1+VbbgcxjubE7Cc2Pb6QqhG3NH6X=WwsNfqNjtA@mail.gmail.com/This mode is currently not supported in AMD PLZA implementation. But we have to keep the options open for future enhancement for MPAM. I am still learning on MPM requirement.
Quoted 22 lines
Scenarios supported
===================Default
-------
For x86 I understand kernel work and user work to be done with same CLOSID/RMID which implies that info/kernel_mode can always be visible and at least display:# cat info/kernel_mode [inherit_ctrl_and_mon]info/kernel_mode_assignment is not visible in this mode.
I understand MPAM may have different defaults here so would like to understand better.
Dedicated global allocations for kernel work, monitoring same for user space and kernel (PLZA)
----------------------------------------------------------------------------------------------
Possible scenario with PLZA, not MPAM (see later):
1. Create group(s) to manage allocations associated with user space work
and assign tasks/CPUs to these groups.
2. Create group to manage allocations associated with all kernel work.
- For example,Quoted 3 lines
# mkdir /sys/fs/resctrl/unthrottled - No constraints from resctrl fs on interactions with files in this group. From resctrl fs perspective it is not "dedicated" to kernel work but just another resource group.
Quoted 1 line
That is correct. We dont need to handle the group special for
kernel_modewhile creating the group. However, there will some handling required whenkernel_modegroup is deleted. We need to move the tasks/cpus back to default group and update the globalkernel_modestructure.
Good point, yes.
...
Quoted 34 lines
Quoted 16 lines
Dedicated global allocations for kernel work, monitoring same for user space and kernel (MPAM)
----------------------------------------------------------------------------------------------
1. User space creates resource and monitoring groups for user tasks:
/sys/fs/resctrl<= User space default allocations
/sys/fs/resctrl/g1 <= User space allocations g1/sys/fs/resctrl/g1/mon_groups/g1m1<= User space monitoring group g1m1/sys/fs/resctrl/g1/mon_groups/g1m2<= User space monitoring group g1m2/sys/fs/resctrl/g2<= User space allocations g2/sys/fs/resctrl/g2/mon_groups/g2m1<= User space monitoring group g2m1/sys/fs/resctrl/g2/mon_groups/g2m2<= User space monitoring group g2m22. User space creates resource and monitoring groups for kernel work (system has two PMG):
/sys/fs/resctrl/kernel <= Kernel space allocations /sys/fs/resctrl/kernel/mon_data <= Kernel space monitoring for all of default and g1 /sys/fs/resctrl/kernel/mon_groups/kernel_g2 <= Kernel space monitoring for all of g2
3. Set kernel mode toper_group_assign_ctrl_assign_mon:Quoted 17 lines
# echo per_group_assign_ctrl_assign_mon > info/kernel_mode - info/kernel_mode_assignment becomes visible and contains # cat info/kernel_mode_assignment //:// g1//:// g1/g1m1/:// g1/g1m2/:// g2//:// g2/g2m1/:// g2/g2m2/:// - An optimization here may be to have the change to per_group_assign_ctrl_assign_mon mode be implemented similar to the change to global_assign_ctrl_assign_mon that initializes a global default. This can avoid keeping tasklist_lock for a long time to set all tasks' kernel CLOSID/RMID to default just for user space to likely change it. 4. Set groups to be used for kernel work: # echo '//:kernel//\ng1//:kernel//\ng1/g1m1/:kernel//\ng1/g1m2/:kernel//\ng2//:kernel/kernel_g2/\ng2/g2m1/:kernel/kernel_g2/\ng2/g2m2/:kernel/kernel_g2/\n' > info/kernel_mode_assignment
Quoted 1 line
Currently, this is not supported in AMD's PLZA implimentation. But we need to keep this option open for MPAM.
Right. I expect PLZA to at least support "global_assign_ctrl_inherit_mon" mode since that is the one we know somebody is waiting for. I am not actually sure about "global_assign_ctrl_assign_mon" for PLZA. It is the variant intended to be implemented by this RFC submission and does not seem difficult to implement but I have not really heard any requests around it. Please do correct me if I missed anything here.
Quoted 12 lines
Quoted 11 lines
The interfaces proposed aim to maintain compatibility with existing user space tools while adding support for all requirements expressed thus far in an efficient way. For an existing user space tool there is no change in meaning of any existing file and no existing known resource group files are made to disappear. There is a global configuration that lets user space manage allocations without needing to check and configure each control group, even per-resource group allocations can be managed from user space with a single read/write to support making changes in most efficient way.
What do you think?
Quoted 9 lines
I will start planning this work. Feel free to add more details. I Will have more questions as I start working on it.
I will separate GMBA work from this work.
Will send both series separately.
Thanks for details and summary.
Thank you very much.
Reinette
Reinette Chatre
maintainerRe: [RFC PATCH 01/19] x86,fs/resctrl: Add support for Global Bandwidth Enforcement (GLBE)
In reply to Fenghua YuHi Fenghua,
Quoted 24 lines · Fenghua Yu
Hi, Reinette,
Quoted 13 lines
What if, instead, it looks something like:
info/
└── MB/ └── resource_schemata/ ├── GMB/ │ ├── max:4096 │ ├── min:1 │ ├── resolution:1 │ ├── scale:1 │ ├── tolerance:0 │ ├── type:scalar linear │ └── unit:GBpsQuoted 8 lines
└── MB/ ├── max:8192 ├── min:1 ├── resolution:8 ├── scale:1 ├── tolerance:0 ├── type:scalar linear └── unit:GBps
Quoted 1 line
May I have 2 comments?
Your comments are always welcome and appreciated.
Quoted 2 lines
1. This directory is for both info and control, right?
Right.
Quoted 3 lines
"info" is a read-only directory:
dr-xr-xr-x 8 root root 0 Feb 23 12:50 info
While "info" is a read-only directory it has contained writable files since the original monitoring support landed (max_threshold_occupancy) and has gained more writable files since then.
Quoted 4 lines
And its name suggests it's for info only as well.
Instead of mixing legal info and control together, is it better to add a new "control" or "config" directory in
/sys/fs/resctrlfor this control and info purpose?
While I agree "config" may be a more appropriate name I do not think we are
in a position to change it now. The documentation is clear here with there being only two sections for resctrl files: "Info directory" and "Resource alloc and monitor groups".
Quoted 2 lines
2. This control method seems only handles global control for resources. But what if a control is per domain and per closid/partid?
The intention of the files within info/<resource>/resource_schemata related to controls are to describe the control *properties*, not for user space to set control values using these files.
The values of the controls will continue to be set by user space via the per closid/partid/resource group "schemata" file. The intention of the info/<resource>/resource_schemata files is to describe to user space what are valid values for the "schemata" file and the expectation is that these files (info/<resource>/resource_schemata/*) will
be (at least initially) read-only.
Quoted 9 lines
For example, MPAM has a hardlimit control per mem bandwidth allocation domain per partid. When hardlimit is enabled, MPAM hardware enforces hard limit of MBW max. This can not be controlled globally.
For this kind of per partid per domain control, propose config_schemata/control_schemata file:
partition X/
control_schemata (orconfig_schemata):
MB_hardlimit: 0=0/1;1=0/1;...Is this reasonable?
Yes, managing HARDLIM as additional schema/control is reasonable. Exactly how to expose its valid values to user space via info/ files has not been discussed but I believe the schema description format does support such extension.
Please see https://lore.kernel.org/lkml/[email protected]/ for some example schemata related to HARDLIM.
Reinette
Re: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
In reply to Reinette ChatreHi Reinette,
Quoted 30 lines · Reinette Chatre
Hi Babu,
Quoted 5 lines · Babu
Quoted 3 lines · Reinette Chatre
Summary of considerations surrounding CLOSID/RMID (PARTID/PMG) assignment for kernel work
=========================================================================================Quoted 7 lines
Quoted 5 lines
- PLZA currently only supports global assignment (only
PLZA_ENofMSR_IA32_PQR_PLZA_ASSOCmay differ on logical processors). Even so, current speculation is that RMID_EN=0 implies that user space RMID is used to monitor kernel work that could appear to user as "kernel mode" supporting multiple RMIDs.
https://lore.kernel.org/lkml/[email protected]/Yes. RMID_EN=0 means dont use separate RMID for plza.
Thank you very much for confirming.
...
Quoted 9 lines
Quoted 7 lines
How can resctrl support the requirements?
=========================================New global resctrl fs files
===========================
info/kernel_mode (always visible)
info/kernel_mode_assignment (visibility and content depends on active setting in info/kernel_mode)Probably good idea to drop "assign" for this work. We already have
mbm_assignmode and related work.
Quoted 7 lines
hmmm ... I think "assign" is generic enough of a word that it cannot be claimed by a single feature.
Quoted 1 line
info/kernel_mode_assoc or info/kernel_mode_association? Or We can wait later to rename appropriately.
yes, naming can be settled later.
Sure.
Quoted 48 lines
Quoted 48 lines
Quoted 27 lines
info/kernel_mode
================
- Displays the currently active as well as possible features available to user
space.
- Single place where user can query "kernel mode" behavior and capabilities of the
system.
- Some possible values:
-inherit_ctrl_and_mon<=== previously named "match_user", just renamed for consistency with other names When active, kernel and user space use the same CLOSID/RMID. The current status
quo for x86.
-global_assign_ctrl_inherit_mon
When active, CLOSID/control group can be assigned for *all* (hence, "global")
kernel work while all kernel work uses same RMID as user space.
Can only be supported on architecture where CLOSID and RMID are independent.
An arch may support this in hardware (RMID_EN=0?) or this can be done by resctrl during
context switch if the RMID is independent and the context switches cost is
considered "reasonable".
This supports use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for PLZA.
-global_assign_ctrl_assign_mon
When active the same resource group (CLOSID and RMID) can be assigned to
*all* kernel work. This could be any group, including the default group.
There may not be a use case for this but it could be useful as an intemediate
step of the mode that follow (more later).Quoted 8 lines
-
per_group_assign_ctrl_assign_mon
When active every resource group can be associated with another (or the same)
resource group. This association maps the resource group for user space work
to resource group for kernel work. This is similar to the "kernel_group" idea
presented in:
https://lore.kernel.org/lkml/[email protected]/
This addresses use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for MPAM.All these new names and related information will go in global structure.
Something like this..
Struct
kern_mode{
enumassoc_mode;
struct rdtgroup*k_rdtgrp;
...
};Not sure what other information will be required here. Will know once I stared working on it.
Quoted 7 lines
Quoted 1 line
This structure will be updated based on user echo's in "
kernel_mode" and "kernel_mode_assignment".This looks to be a good start. I think keeping the rdtgroup association is good since it helps to easily display the name to user space while also providing access to the CLOSID and RMID that is assigned to the tasks.
By placing them in their own structure instead of just globals it does make it easier to build on when some modes have different requirements wrt rdtgroup management.
I am not clear on this comment. Can you please elaborate little bit?
Thanks
Babu
Quoted 182 lines
You may encounter that certain arrangements work better to support interactions with the task structure that are not clear at this time.
Quoted 10 lines
Quoted 8 lines
- Additional values can be added as new requirements arise, for example "
per_task" assignment. Connecting visibility of info/kernel_mode_assignment to mode in info/kernel_mode enables resctrl to later support additional modes that may require different configuration files, potentially per-resource group like the "tasks_kernel" (or perhaps rather "kernel_mode_tasks" to have consistent prefix for this feature) and "cpus_kernel" ("kernel_mode_cpus"?) discussed in these threads.So, per resource group file "
kernel_mode_tasks" and "kernel_mode_cpus" are not required right now. Correct?Correct. The way I see it the baseline implementation to support PLZA should be straightforward. We'll probably spend a bit extra time on the supporting documentation to pave the way for possible additions.
Quoted 87 lines
Quoted 44 lines
User can view active and supported modes:
# cat info/kernel_mode [inherit_ctrl_and_mon] global_assign_ctrl_inherit_mon global_assign_ctrl_assign_monUser can switch modes:
# echo global_assign_ctrl_inherit_mon > kernel_mode # cat kernel_mode inherit_ctrl_and_mon [global_assign_ctrl_inherit_mon] global_assign_ctrl_assign_moninfo/kernel_mode_assignment
===========================
- Visibility depends on active mode in info/kernel_mode.
- Content depends on active mode in info/kernel_mode
- Syntax to identify resource groups can use the syntax created as part of earlier ABMC work that supports default group https://lore.kernel.org/lkml/[email protected]/
- DefaultCTRL_MONgroup and if relevant, the default MON group, can be the default assignment when user just changes thekernel_modewithout setting the assignment.info/kernel_mode_assignment when mode is
global_assign_ctrl_inherit_mon
-----------------------------------------------------------------------
- info/kernel_mode_assignment contains single value that is the name of the control group used for all kernel work.
- CLOSID/PARTID used for kernel work is determined from the control group assigned
- default value is defaultCTRL_MONgroup
- no monitor group assignment, kernel work inherits user space RMID
- syntax is
<CTRL_MONgroup> with "/" meaning default.info/kernel_mode_assignment when mode is
global_assign_ctrl_assign_mon
-----------------------------------------------------------------------
- info/kernel_mode_assignment contains single value that is the name of the resource group used for all kernel work.
- Combined CLOSID/RMID or combined PARTID/PMG is set globally to be associated with all kernel work.
- default value is defaultCTRL_MONgroup
- syntax is
<CTRL_MONgroup>/MON group>/ with "//" meaning default control and default monitoring group.Quoted 14 lines
info/kernel_mode_assignment when mode is
per_group_assign_ctrl_assign_mon
-------------------------------------------------------------------------
- this presents the information proposed in https://lore.kernel.org/lkml/[email protected]/
within a single file for convenience and potential optimization when user space needs to make changes. Interface proposed in https://lore.kernel.org/lkml/[email protected]/ is also an option and as an alternative a per-resource group "kernel_group" can be made visible when user space enables this mode.
- info/kernel_mode_assignment contains a mapping of every resource group to another resource group:
<resource group for user space work>:<resource group for kernel work>
- all resource groups must be present in first field of this file
- Even though this is a "per group" setting expectation is that this will set the
kernel work CLOSID/RMID for every task. This implies that writing to this file would need to access thetasklist_lockthat, when taking for too long, may impact other parts of system. See https://lore.kernel.org/lkml/CALPaoCh0SbG1+VbbgcxjubE7Cc2Pb6QqhG3NH6X=WwsNfqNjtA@mail.gmail.com/This mode is currently not supported in AMD PLZA implementation. But we have to keep the options open for future enhancement for MPAM. I am still learning on MPM requirement.
Quoted 22 lines
Scenarios supported
===================Default
-------
For x86 I understand kernel work and user work to be done with same CLOSID/RMID which implies that info/kernel_mode can always be visible and at least display:# cat info/kernel_mode [inherit_ctrl_and_mon]info/kernel_mode_assignment is not visible in this mode.
I understand MPAM may have different defaults here so would like to understand better.
Dedicated global allocations for kernel work, monitoring same for user space and kernel (PLZA)
----------------------------------------------------------------------------------------------
Possible scenario with PLZA, not MPAM (see later):
1. Create group(s) to manage allocations associated with user space work
and assign tasks/CPUs to these groups.
2. Create group to manage allocations associated with all kernel work.
- For example,Quoted 3 lines
# mkdir /sys/fs/resctrl/unthrottled - No constraints from resctrl fs on interactions with files in this group. From resctrl fs perspective it is not "dedicated" to kernel work but just another resource group.Quoted 1 line
That is correct. We dont need to handle the group special for
kernel_modewhile creating the group. However, there will some handling required whenkernel_modegroup is deleted. We need to move the tasks/cpus back to default group and update the globalkernel_modestructure.Good point, yes.
...
Quoted 34 lines
Quoted 16 lines
Dedicated global allocations for kernel work, monitoring same for user space and kernel (MPAM)
----------------------------------------------------------------------------------------------
1. User space creates resource and monitoring groups for user tasks:
/sys/fs/resctrl<= User space default allocations
/sys/fs/resctrl/g1 <= User space allocations g1/sys/fs/resctrl/g1/mon_groups/g1m1<= User space monitoring group g1m1/sys/fs/resctrl/g1/mon_groups/g1m2<= User space monitoring group g1m2/sys/fs/resctrl/g2<= User space allocations g2/sys/fs/resctrl/g2/mon_groups/g2m1<= User space monitoring group g2m1/sys/fs/resctrl/g2/mon_groups/g2m2<= User space monitoring group g2m22. User space creates resource and monitoring groups for kernel work (system has two PMG):
/sys/fs/resctrl/kernel <= Kernel space allocations /sys/fs/resctrl/kernel/mon_data <= Kernel space monitoring for all of default and g1 /sys/fs/resctrl/kernel/mon_groups/kernel_g2 <= Kernel space monitoring for all of g2
3. Set kernel mode toper_group_assign_ctrl_assign_mon:Quoted 17 lines
# echo per_group_assign_ctrl_assign_mon > info/kernel_mode - info/kernel_mode_assignment becomes visible and contains # cat info/kernel_mode_assignment //:// g1//:// g1/g1m1/:// g1/g1m2/:// g2//:// g2/g2m1/:// g2/g2m2/:// - An optimization here may be to have the change to per_group_assign_ctrl_assign_mon mode be implemented similar to the change to global_assign_ctrl_assign_mon that initializes a global default. This can avoid keeping tasklist_lock for a long time to set all tasks' kernel CLOSID/RMID to default just for user space to likely change it. 4. Set groups to be used for kernel work: # echo '//:kernel//\ng1//:kernel//\ng1/g1m1/:kernel//\ng1/g1m2/:kernel//\ng2//:kernel/kernel_g2/\ng2/g2m1/:kernel/kernel_g2/\ng2/g2m2/:kernel/kernel_g2/\n' > info/kernel_mode_assignmentQuoted 1 line
Currently, this is not supported in AMD's PLZA implimentation. But we need to keep this option open for MPAM.
Right. I expect PLZA to at least support "
global_assign_ctrl_inherit_mon" mode since that is the one we know somebody is waiting for. I am not actually sure about "global_assign_ctrl_assign_mon" for PLZA. It is the variant intended to be implemented by this RFC submission and does not seem difficult to implement but I have not really heard any requests around it. Please do correct me if I missed anything here.Quoted 12 lines
Quoted 11 lines
The interfaces proposed aim to maintain compatibility with existing user space tools while adding support for all requirements expressed thus far in an efficient way. For an existing user space tool there is no change in meaning of any existing file and no existing known resource group files are made to disappear. There is a global configuration that lets user space manage allocations without needing to check and configure each control group, even per-resource group allocations can be managed from user space with a single read/write to support making changes in most efficient way.
What do you think?
Quoted 9 lines
I will start planning this work. Feel free to add more details. I Will have more questions as I start working on it.
I will separate GMBA work from this work.
Will send both series separately.
Thanks for details and summary.
Thank you very much.
Reinette
Reinette Chatre
maintainerRe: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
Hi Babu,
Quoted 51 lines · Babu
Quoted 50 lines · Reinette Chatre
Quoted 48 lines · Babu
Quoted 24 lines · Reinette Chatre
info/kernel_mode
================
- Displays the currently active as well as possible features available to user
space.
- Single place where user can query "kernel mode" behavior and capabilities of the
system.
- Some possible values:
-inherit_ctrl_and_mon<=== previously named "match_user", just renamed for consistency with other names When active, kernel and user space use the same CLOSID/RMID. The current status
quo for x86.
-global_assign_ctrl_inherit_mon
When active, CLOSID/control group can be assigned for *all* (hence, "global")
kernel work while all kernel work uses same RMID as user space.
Can only be supported on architecture where CLOSID and RMID are independent.
An arch may support this in hardware (RMID_EN=0?) or this can be done by resctrl during
context switch if the RMID is independent and the context switches cost is
considered "reasonable".
This supports use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for PLZA.
-global_assign_ctrl_assign_mon
When active the same resource group (CLOSID and RMID) can be assigned to
*all* kernel work. This could be any group, including the default group.
There may not be a use case for this but it could be useful as an intemediate
step of the mode that follow (more later).Quoted 8 lines
-
per_group_assign_ctrl_assign_mon
When active every resource group can be associated with another (or the same)
resource group. This association maps the resource group for user space work
to resource group for kernel work. This is similar to the "kernel_group" idea
presented in:
https://lore.kernel.org/lkml/[email protected]/
This addresses use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for MPAM.All these new names and related information will go in global structure.
Something like this..
Struct
kern_mode{
enumassoc_mode;
struct rdtgroup*k_rdtgrp;
...
};Not sure what other information will be required here. Will know once I stared working on it.
This structure will be updated based on user echo's in "
kernel_mode" and "kernel_mode_assignment".
Quoted 7 lines
Quoted 5 lines
This looks to be a good start. I think keeping the rdtgroup association is good since it helps to easily display the name to user space while also providing access to the CLOSID and RMID that is assigned to the tasks.
By placing them in their own structure instead of just globals it does make it easier to build on when some modes have different requirements wrt rdtgroup management.I am not clear on this comment. Can you please elaborate little bit?
I believe what you propose should suffice for the initial support for PLZA. I do not see the PLZA enabling needing anything more complicated.
As I understand for MPAM support there needs to be more state to track which privilege level tasks run at.
So, when just considering how MPAM may build on this: The PARTID/PMG to run at when in kernel mode can be managed per group or per task. In either case I suspect that struct task_struct would need to include the kernel mode PARTID/PMG to support setting the correct kernel mode PARTID/PMG during context switching similar to what you coded up in this initial RFC. MPAM may choose to have struct task_struct be the only place to keep all state about which PARTID/PMG to run when in kernel mode but I suspect that may result in a lot of lock contention (user space could, for example, be able to lock up the entire system with a loop reading info/kernel_mode_assignment) so MPAM may choose to expand the struct kernel_mode introduced by PLZA to, (if kernel mode is managed per group) instead of one struct rdtgroup * contain a mapping of every resource group to the resource group that should be used for kernel mode work. This could be some staging/cache used between user space and all the task structures to help manage the state.
I do not know what MPAM implementation may choose to do but as I see it your proposal provides a good foundation to build on since it establishes a global place, struct kernel_mode, where all such state can/should be stored instead of some unspecified group of global variables.
Reinette
Re: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
In reply to Reinette ChatreHi Reinette,
Quoted 75 lines · Reinette Chatre
Hi Ben,
Quoted 1 line · Ben Horgan
On 2/20/26 02:53, Reinette Chatre wrote:
...
Quoted 33 lines
Quoted 16 lines
Dedicated global allocations for kernel work, monitoring same for user space and kernel (MPAM)
----------------------------------------------------------------------------------------------
1. User space creates resource and monitoring groups for user tasks:
/sys/fs/resctrl<= User space default allocations
/sys/fs/resctrl/g1<= User space allocations g1/sys/fs/resctrl/g1/mon_groups/g1m1<= User space monitoring group g1m1/sys/fs/resctrl/g1/mon_groups/g1m2<= User space monitoring group g1m2/sys/fs/resctrl/g2<= User space allocations g2/sys/fs/resctrl/g2/mon_groups/g2m1<= User space monitoring group g2m1/sys/fs/resctrl/g2/mon_groups/g2m2<= User space monitoring group g2m22. User space creates resource and monitoring groups for kernel work (system has two PMG):
/sys/fs/resctrl/kernel<= Kernel space allocations
/sys/fs/resctrl/kernel/mon_data<= Kernel space monitoring for all of default and g1
/sys/fs/resctrl/kernel/mon_groups/kernel_g2<= Kernel space monitoring for all of g2
3. Set kernel mode toper_group_assign_ctrl_assign_mon:Quoted 16 lines
# echo per_group_assign_ctrl_assign_mon > info/kernel_mode - info/kernel_mode_assignment becomes visible and contains # cat info/kernel_mode_assignment //:// g1//:// g1/g1m1/:// g1/g1m2/:// g2//:// g2/g2m1/:// g2/g2m2/:// - An optimization here may be to have the change to per_group_assign_ctrl_assign_mon mode be implemented similar to the change to global_assign_ctrl_assign_mon that initializes a global default. This can avoid keeping tasklist_lock for a long time to set all tasks' kernel CLOSID/RMID to default just for user space to likely change it. 4. Set groups to be used for kernel work: # echo '//:kernel//\ng1//:kernel//\ng1/g1m1/:kernel//\ng1/g1m2/:kernel//\ng2//:kernel/kernel_g2/\ng2/g2m1/:kernel/kernel_g2/\ng2/g2m2/:kernel/kernel_g2/\n' > info/kernel_mode_assignmentQuoted 2 lines
Am I right in thinking that you want this in the info directory to avoid adding files to the CTRL_MON/MON groups?
I see this file as providing the same capability as you suggested in
https://lore.kernel.org/lkml/[email protected]/. The reason why I presented this as a single file is not because I am trying to avoid adding files to the CTRL_MON/MON groups but because I believe such interface enables resctrl to have more flexibility and support more scenarios for optimization.As you mentioned in your proposal the solution enables a single write to move a task. As I thought through what resctrl needs to do on such write I saw a lot of similarities with
mongrp_reparent()that loops through all the tasks viafor_each_process_thread()while holdingtasklist_lock. Issues withmongrp_reparent()holdingtasklist_lockfor a long time are described in [1].While the single file does not avoid taking
tasklist_lockit does give the user the ability to set kernel group for multiple user groups with a single write. When user space does so I believe it is possible for resctrl to have an optimization that takestasklist_lockjust once and make changes to tasks belonging to all groups while looping through all tasks on system just once. With files within the CTRL_MON/MON groups setting kernel group for multiple user groups will require multiple writes from user space where each write requires looping through tasks while holdingtasklist_lockduring each loop. From what I learned from [1] something like this can be very disruptive to the rest of the system.In summary, I see having this single file provide the same capability as the on-file-per-CTRL_MON/MON group since user can choose to set kernel group for user group one at a time but it also gives more flexibility to resctrl for optimization.
Nothing is set in stone here. There is still flexibility in this proposal to support PARTID and PMG assignment with a single file in each CTRL_MON/MON group if we find that it has the more benefits. resctrl can still expose a "
per_group_assign_ctrl_assign_mon" mode but instead of making "info/kernel_mode_assignment" visible when it is enabled the control file in CTRL_MON/MON groups are made visible ... even in this case resctrl could still add the single file later if deemed necessary at that time.
Quoted 2 lines
Considering all this, do you think resctrl should rather start with a file in each CTRL_MON/MON group?
From what you say, it sounds like the optimization opportunities granted by having a single file will be necessary with some usage patterns and so I'd be happy to start with just the single "info/kernel_mode_assignment" file. It does mean that you need to consider more than the current CTRL_MON directory when reading or writing configuration but I don't see any real problem there.
Quoted 4 lines
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCh0SbG1+VbbgcxjubE7Cc2Pb6QqhG3NH6X=WwsNfqNjtA@mail.gmail.com/
Thanks,
Ben
Reinette Chatre
maintainerRe: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
Hi Ben,
Quoted 81 lines · Ben Horgan
Hi Reinette,
Quoted 75 lines · Reinette Chatre
Hi Ben,
Quoted 1 line · Ben Horgan
On 2/20/26 02:53, Reinette Chatre wrote:
...
Quoted 33 lines
Quoted 16 lines
Dedicated global allocations for kernel work, monitoring same for user space and kernel (MPAM)
----------------------------------------------------------------------------------------------
1. User space creates resource and monitoring groups for user tasks:
/sys/fs/resctrl<= User space default allocations
/sys/fs/resctrl/g1<= User space allocations g1/sys/fs/resctrl/g1/mon_groups/g1m1<= User space monitoring group g1m1/sys/fs/resctrl/g1/mon_groups/g1m2<= User space monitoring group g1m2/sys/fs/resctrl/g2<= User space allocations g2/sys/fs/resctrl/g2/mon_groups/g2m1<= User space monitoring group g2m1/sys/fs/resctrl/g2/mon_groups/g2m2<= User space monitoring group g2m22. User space creates resource and monitoring groups for kernel work (system has two PMG):
/sys/fs/resctrl/kernel<= Kernel space allocations
/sys/fs/resctrl/kernel/mon_data<= Kernel space monitoring for all of default and g1
/sys/fs/resctrl/kernel/mon_groups/kernel_g2<= Kernel space monitoring for all of g2
3. Set kernel mode toper_group_assign_ctrl_assign_mon:Quoted 16 lines
# echo per_group_assign_ctrl_assign_mon > info/kernel_mode - info/kernel_mode_assignment becomes visible and contains # cat info/kernel_mode_assignment //:// g1//:// g1/g1m1/:// g1/g1m2/:// g2//:// g2/g2m1/:// g2/g2m2/:// - An optimization here may be to have the change to per_group_assign_ctrl_assign_mon mode be implemented similar to the change to global_assign_ctrl_assign_mon that initializes a global default. This can avoid keeping tasklist_lock for a long time to set all tasks' kernel CLOSID/RMID to default just for user space to likely change it. 4. Set groups to be used for kernel work: # echo '//:kernel//\ng1//:kernel//\ng1/g1m1/:kernel//\ng1/g1m2/:kernel//\ng2//:kernel/kernel_g2/\ng2/g2m1/:kernel/kernel_g2/\ng2/g2m2/:kernel/kernel_g2/\n' > info/kernel_mode_assignmentQuoted 2 lines
Am I right in thinking that you want this in the info directory to avoid adding files to the CTRL_MON/MON groups?
I see this file as providing the same capability as you suggested in
https://lore.kernel.org/lkml/[email protected]/. The reason why I presented this as a single file is not because I am trying to avoid adding files to the CTRL_MON/MON groups but because I believe such interface enables resctrl to have more flexibility and support more scenarios for optimization.As you mentioned in your proposal the solution enables a single write to move a task. As I thought through what resctrl needs to do on such write I saw a lot of similarities with
mongrp_reparent()that loops through all the tasks viafor_each_process_thread()while holdingtasklist_lock. Issues withmongrp_reparent()holdingtasklist_lockfor a long time are described in [1].While the single file does not avoid taking
tasklist_lockit does give the user the ability to set kernel group for multiple user groups with a single write. When user space does so I believe it is possible for resctrl to have an optimization that takestasklist_lockjust once and make changes to tasks belonging to all groups while looping through all tasks on system just once. With files within the CTRL_MON/MON groups setting kernel group for multiple user groups will require multiple writes from user space where each write requires looping through tasks while holdingtasklist_lockduring each loop. From what I learned from [1] something like this can be very disruptive to the rest of the system.In summary, I see having this single file provide the same capability as the on-file-per-CTRL_MON/MON group since user can choose to set kernel group for user group one at a time but it also gives more flexibility to resctrl for optimization.
Nothing is set in stone here. There is still flexibility in this proposal to support PARTID and PMG assignment with a single file in each CTRL_MON/MON group if we find that it has the more benefits. resctrl can still expose a "
per_group_assign_ctrl_assign_mon" mode but instead of making "info/kernel_mode_assignment" visible when it is enabled the control file in CTRL_MON/MON groups are made visible ... even in this case resctrl could still add the single file later if deemed necessary at that time.Quoted 2 lines
Considering all this, do you think resctrl should rather start with a file in each CTRL_MON/MON group?
Quoted 6 lines
From what you say, it sounds like the optimization opportunities granted by having a single file will be necessary with some usage patterns and so I'd be happy to start with just the single "info/kernel_mode_assignment" file. It does mean that you need to consider more than the current
CTRL_MONdirectory when reading or writing configuration but I don't see any real problem there.
When reading the global file it will display all groups, yes. Writing configuration need only modify the group(s) needing to be modified (similar to schemata file).
Babu and I did speculate a bit on other interactions with "info/kernel_mode_assignment" in https://lore.kernel.org/lkml/[email protected]/ and resctrl may need to adjust how a task's group membership is managed. resctrl could cache some state or manage task membership differently entirely like
what Peter proposed in https://lore.kernel.org/lkml/[email protected]/
If task group membership management becomes "cheap" then resctrl interface can be reconsidered.
Reinette
Quoted 10 lines
Quoted 5 lines
Reinette
[1] https://lore.kernel.org/lkml/CALPaoCh0SbG1+VbbgcxjubE7Cc2Pb6QqhG3NH6X=WwsNfqNjtA@mail.gmail.com/
Thanks,
Ben
Babu Moger
reviewerRe: [RFC PATCH 13/19] x86/resctrl: Add PLZA state tracking and context switch handling
In reply to Reinette ChatreHi Reinette,
Quoted 75 lines · Reinette Chatre
Hi Babu,
Quoted 47 lines · Babu
Quoted 46 lines · Reinette Chatre
Quoted 45 lines · Babu
Quoted 24 lines · Reinette Chatre
info/kernel_mode
================
- Displays the currently active as well as possible features available to user
space.
- Single place where user can query "kernel mode" behavior and capabilities of the
system.
- Some possible values:
-inherit_ctrl_and_mon<=== previously named "match_user", just renamed for consistency with other names When active, kernel and user space use the same CLOSID/RMID. The current status
quo for x86.
-global_assign_ctrl_inherit_mon
When active, CLOSID/control group can be assigned for *all* (hence, "global")
kernel work while all kernel work uses same RMID as user space.
Can only be supported on architecture where CLOSID and RMID are independent.
An arch may support this in hardware (RMID_EN=0?) or this can be done by resctrl during
context switch if the RMID is independent and the context switches cost is
considered "reasonable".
This supports use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for PLZA.
-global_assign_ctrl_assign_mon
When active the same resource group (CLOSID and RMID) can be assigned to
*all* kernel work. This could be any group, including the default group.
There may not be a use case for this but it could be useful as an intemediate
step of the mode that follow (more later).Quoted 8 lines
-
per_group_assign_ctrl_assign_mon
When active every resource group can be associated with another (or the same)
resource group. This association maps the resource group for user space work
to resource group for kernel work. This is similar to the "kernel_group" idea
presented in:
https://lore.kernel.org/lkml/[email protected]/
This addresses use case https://lore.kernel.org/lkml/CABPqkBSq=cgn-am4qorA_VN0vsbpbfDePSi7gubicpROB1=djw@mail.gmail.com/
for MPAM.All these new names and related information will go in global structure.
Something like this..
Struct
kern_mode{
enumassoc_mode;
struct rdtgroup*k_rdtgrp;
...
};Not sure what other information will be required here. Will know once I stared working on it.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
This structure will be updated based on user echo's in "
kernel_mode" and "kernel_mode_assignment".This looks to be a good start. I think keeping the rdtgroup association is good since it helps to easily display the name to user space while also providing access to the CLOSID and RMID that is assigned to the tasks.
By placing them in their own structure instead of just globals it does make it easier to build on when some modes have different requirements wrt rdtgroup management.I am not clear on this comment. Can you please elaborate little bit?
I believe what you propose should suffice for the initial support for PLZA. I do not see the PLZA enabling needing anything more complicated.
As I understand for MPAM support there needs to be more state to track which privilege level tasks run at.
So, when just considering how MPAM may build on this: The PARTID/PMG to run at when in kernel mode can be managed per group or per task. In either case I suspect that struct
task_structwould need to include the kernel mode PARTID/PMG to support setting the correct kernel mode PARTID/PMG during context switching similar to what you coded up in this initial RFC. MPAM may choose to have structtask_structbe the only place to keep all state about which PARTID/PMG to run when in kernel mode but I suspect that may result in a lot of lock contention (user space could, for example, be able to lock up the entire system with a loop reading info/kernel_mode_assignment) so MPAM may choose to expand the structkernel_modeintroduced by PLZA to, (if kernel mode is managed per group) instead of one struct rdtgroup * contain a mapping of every resource group to the resource group that should be used for kernel mode work. This could be some staging/cache used between user space and all the task structures to help manage the state.
Quoted 4 lines
I do not know what MPAM implementation may choose to do but as I see it your proposal provides a good foundation to build on since it establishes a global place, struct
kernel_mode, where all such state can/should be stored instead of some unspecified group of global variables.
Sounds good. Thanks for the clarification.
Thanks
Babu