From: "Moger, Babu" <bmoger@amd.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
Babu Moger <babu.moger@amd.com>,
tony.luck@intel.com, ben.horgan@arm.com, Dave.Martin@arm.com,
james.morse@arm.com, bp@alien8.de
Cc: corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org,
x86@kernel.org, fustini@kernel.org, tglx@kernel.org,
mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com,
fenghuay@nvidia.com, rppt@kernel.org, arnd@arndb.de,
kmehltretter@gmail.com, dapeng1.mi@linux.intel.com,
elver@google.com, enelsonmoore@gmail.com, jlayton@kernel.org,
seanjc@google.com, ewanhai-oc@zhaoxin.com,
binbin.wu@linux.intel.com, nikunj@amd.com, ashish.kalra@amd.com,
peterz@infradead.org, superm1@kernel.org,
thomas.lendacky@amd.com, prathyushi.nangia@amd.com,
kim.phillips@amd.com, ricardo.neri-calderon@linux.intel.com,
darwi@linutronix.de, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v7 10/19] fs/resctrl: Add interface to display kernel mode status
Date: Fri, 4 Dec 2026 17:07:08 -0600 [thread overview]
Message-ID: <e82638df-b3ff-4df5-a3e8-602c1409557c@amd.com> (raw)
In-Reply-To: <24e59242-0646-4092-8db6-11844a122c48@intel.com>
Hi Reinette,
On 12/1/2026 10:56 PM, Reinette Chatre wrote:
> Hi Babu,
>
> On 11/11/26 2:44 PM, Babu Moger wrote:
>> Kernel mode support allows the CPU's CLOSID and/or RMID association to
>> change when transitioning from user mode to kernel mode.
>
> This sentence appears here and is then copy&pasted into many commits that
> follow. First, please drop "association", I've noted it a few times so far
> and will stop doing so, please just be specific about referring to CLOSID
> and RMID. Second, please drop the "transitioning" term that uses some PLZA
> implementation language.
> This sentence can be something like:
> The RESCTRL_GLOBAL_ENABLE_PER_CPU kernel mode runs all kernel work on
> the CPUs where it is enabled with the CLOSID and/or RMID of a single
> resource group.
Sure.
>
> In commits that follow the specific property the commit depends on can
> be highlighted instead of whole sentence repeatedly copy&pasted. For example,
> "x86,fs/resctrl: Add CPU hotplug support for kernel mode" can then start
> with:
> The RESCTRL_GLOBAL_ENABLE_PER_CPU kernel mode is enabled per CPU. CPUs
> that come online ...
Yes. Sure.
>
>>
>> Add info/kernel_mode to expose the supported and active kernel modes
>> through the resctrl filesystem. Supported modes are listed one per line,
>
> needs imperative
Sure.
>
>> with the active mode enclosed in square brackets.
>>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
>
> ...
>
>> ---
>> Documentation/filesystems/resctrl.rst | 56 ++++++++++++++
>> fs/resctrl/rdtgroup.c | 105 ++++++++++++++++++++++++++
>> 2 files changed, 161 insertions(+)
>>
>> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
>> index 2d672bbb69be..033d405338c0 100644
>> --- a/Documentation/filesystems/resctrl.rst
>> +++ b/Documentation/filesystems/resctrl.rst
>> @@ -549,6 +549,62 @@ The top level of the "info" directory contains the following file(s):
>> # cat info/last_cmd_status
>> mask f7 has non-consecutive 1-bits
>>
>> +"kernel_mode":
>> + Lists the kernel modes supported by the system, one per line, with
>> + the active mode enclosed in square brackets.
>> +
>> + A task running on a CPU is associated with an allocation and
>> + monitoring ID pair (ctrl_hw_id, mon_hw_id), which determines the
>> + resource allocation and monitoring applied to that task. Kernel
>
> Should this not rather be "A task is associated with a resource group, which
> determines ..."?
Sure.
>
>> + modes allow the CPU's allocation and/or monitoring association to
>> + change during the transition from user mode to kernel mode.
>> +
>> + Possible kernel modes are:
>> +
>> + "inherit_user":
>> + Default mode at boot. Kernel work uses the allocation
>> + and monitoring of the user task on whose behalf it runs.
>> +
>> + "global_enable_per_cpu":
>> + Kernel work uses the allocation and/or monitoring of a backing
>> + CTRL_MON or MON group. The mode can be enabled or disabled
>> + per-CPU. The line contains group= and whichever of ctrl= and
>> + mon= the platform supports::
>
> Final sentence above does not add more than example below. How about
>
> The mode and its parameters are shown as::
>
Sure.
>> +
>> + global_enable_per_cpu:ctrl=<assign|inherit>;mon=<assign|inherit>;group=<CTRL_MON>/<MON>/
>> +
>> + "ctrl":
>> + "assign" if kernel work uses the resource group's
>> + allocation, or "inherit" if it uses the user task's
>
> allocation -> allocations
> (a resource group contains multiple allocations across several resources)
>
>> + allocation. Present only on systems that support allocation.
>
> allocation -> allocations (just for the first instance, the "support allocation" remains singular.)
Ack.
>
>> +
>> + "mon":
>> + "assign" if kernel work uses the resource group's monitoring,
>> + or "inherit" if it uses the user task's monitoring. Present
>> + only on systems that support monitoring.
>> +
>> + "group":
>> + Path of the backing resource group, relative to the resctrl
>> + mount point.
>> +
>> + A MON group is shown as "<CTRL_MON>/<MON>/".
>> +
>> + A CTRL_MON group is shown as "<CTRL_MON>//" when "mon=assign".
>> +
>> + When "mon=inherit", or monitoring is unsupported, a CTRL_MON group
>> + is shown as "<CTRL_MON>/".
>> +
>> + When the mode is not active, the output lists the supported parameters
>> + and their default values, which are used if the mode is activated
>> + without new values.
>> +
>> + Example of a system that supports allocation and monitoring, with default mode
>
> drop default? Or perhaps better to match terminology with "with inherit_user mode active"?
Sure.
>
>> + set to inherit_user::
>> +
>> + # cat info/kernel_mode
>> + [inherit_user]
>> + global_enable_per_cpu:ctrl=assign;mon=assign;group=//
>> +
>> Resource alloc and monitor groups
>> =================================
>>
>> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
>> index 28bd4c4d98f2..afbe0f94940a 100644
>> --- a/fs/resctrl/rdtgroup.c
>> +++ b/fs/resctrl/rdtgroup.c
>> @@ -998,6 +998,104 @@ static int rdt_last_cmd_status_show(struct kernfs_open_file *of,
>> return 0;
>> }
>>
>> +/* Names used in info/kernel_mode; indexed by enum resctrl_kernel_mode */
>> +static const char * const resctrl_kmode_str[] = {
>> + [RESCTRL_INHERIT_USER] = "inherit_user",
>> + [RESCTRL_GLOBAL_ENABLE_PER_CPU] = "global_enable_per_cpu"
>> +};
>> +
>> +static_assert(ARRAY_SIZE(resctrl_kmode_str) == RESCTRL_NUM_KERNEL_MODES);
>> +
>> +static const char *resctrl_kmode_state_str(enum kmode_state state)
>> +{
>> + return state == KMODE_ASSIGN ? "assign" : "inherit";
>> +}
>> +
>> +static void resctrl_kmode_group_path(struct rdtgroup *rdtgrp,
>> + const char **ctrl, const char **mon)
>> +{
>> + *ctrl = "";
>
> Above looks unnecessary.
Sure.
>
>> + *mon = "";
>
> Above can just move to the RDTCTRL_GROUP branch?
Sure.
>
>> +
>> + if (rdtgrp->type == RDTMON_GROUP) {
>> + *ctrl = rdt_kn_name(rdtgrp->mon.parent->kn);
>> + *mon = rdt_kn_name(rdtgrp->kn);
>> + } else {
>> + *ctrl = rdt_kn_name(rdtgrp->kn);
>> + }
>> +}
>> +
>> +/**
>> + * resctrl_kernel_mode_show() - Display supported and active kernel modes
>> + * @of: kernfs open file
>> + * @seq: output seq_file
>> + * @v: unused
>> + *
>> + * Lists one line per mode and brackets the active mode. inherit_user
>> + * has no parameters. global_enable_per_cpu prints ctrl= only when
>> + * allocation is supported and mon= only when monitoring is supported,
>> + * then group=. The MON group is included in group= only when monitoring
>> + * is supported and mon is assign.
>> + *
>> + * Return: 0 on success, or -ENOENT on error.
>> + */
>> +static int resctrl_kernel_mode_show(struct kernfs_open_file *of,
>> + struct seq_file *seq, void *v)
>> +{
>> + const char *ctrl_grp, *mon_grp;
>> + enum resctrl_kernel_mode mode;
>> + bool active;
>> + char sep;
>> +
>> + if (!info_kn_lock(of->kn))
>> + return -ENOENT;
>> +
>> + for (mode = 0; mode < RESCTRL_NUM_KERNEL_MODES; mode++) {
>> + if (!test_bit(mode, resctrl_kmode.supported))
>> + continue;
>> +
>> + active = resctrl_kmode.active == mode;
>> +
>> + seq_printf(seq, active ? "[%s" : "%s", resctrl_kmode_str[mode]);
>> +
>> + if (mode == RESCTRL_GLOBAL_ENABLE_PER_CPU) {
>> + ctrl_grp = "";
>> + mon_grp = "";
>> + if (active) {
>> + if (resctrl_kmode.rdtgrp)
>> + resctrl_kmode_group_path(resctrl_kmode.rdtgrp,
>> + &ctrl_grp, &mon_grp);
>> + else
>> + pr_warn("%s active without a resource group\n",
>> + resctrl_kmode_str[mode]);
>> + }
>
> Above should be simplified if resctrl_kmode_cfg::rdtgrp is initialized to the
> default resource group.
Ack.
>
>> +
>> + sep = ':';
>> + if (resctrl_arch_alloc_capable()) {
>> + seq_printf(seq, "%cctrl=%s", sep,
>> + resctrl_kmode_state_str(resctrl_kmode.ctrl));
>> + sep = ';';
>> + }
>> + if (resctrl_arch_mon_capable()) {
>> + seq_printf(seq, "%cmon=%s", sep,
>> + resctrl_kmode_state_str(resctrl_kmode.mon));
>> + sep = ';';
>> + }
>> + if (resctrl_arch_mon_capable() &&
>> + resctrl_kmode.mon != KMODE_INHERIT)
>> + seq_printf(seq, "%cgroup=%s/%s/", sep, ctrl_grp, mon_grp);
>> + else
>> + seq_printf(seq, "%cgroup=%s/", sep, ctrl_grp);
>
> Above looks unnecessarily complicated. Why is the "sep" needed? Could this not be
> simplified to:
Ack.
> seq_putc(seq, ':');
> if (resctrl_arch_alloc_capable())
> seq_printf(seq, "ctrl=%s;",
> resctrl_kmode_state_str(resctrl_kmode.ctrl));
> if (resctrl_arch_mon_capable())
> seq_printf(seq, "mon=%s;",
> resctrl_kmode_state_str(resctrl_kmode.mon));
> seq_printf(seq, "group=%s/", ctrl_grp);
> if (resctrl_arch_mon_capable() &&
> resctrl_kmode.mon == KMODE_ASSIGN)
> seq_printf(seq, "%s/", mon_grp);
>
Sure. Will do.
Thanks
Babu
next prev parent reply other threads:[~2026-12-04 23:07 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 22:43 [PATCH v7 00/19] x86,fs/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem Babu Moger
2026-11-11 22:43 ` [PATCH v7 01/19] x86/cpufeatures: Support Privilege Level Zero Association (PLZA) Babu Moger
2026-11-11 22:43 ` [PATCH v7 02/19] x86/resctrl: Add PLZA support to command-line options Babu Moger
2026-11-11 22:43 ` [PATCH v7 03/19] x86/resctrl: Add PLZA MSR definition and field layout Babu Moger
2026-12-02 4:43 ` Reinette Chatre
2026-12-03 17:16 ` Babu Moger
2026-11-11 22:43 ` [PATCH v7 04/19] fs/resctrl: Introduce kernel mode enum Babu Moger
2026-11-16 20:07 ` Babu Moger
2026-12-02 4:44 ` Reinette Chatre
2026-12-03 19:45 ` Babu Moger
2026-11-11 22:43 ` [PATCH v7 05/19] arm,x86,fs/resctrl: Introduce arch hook to program global per-CPU kernel mode Babu Moger
2026-12-02 4:48 ` Reinette Chatre
2026-12-03 20:51 ` Babu Moger
2026-12-03 20:54 ` Babu Moger
2026-11-11 22:43 ` [PATCH v7 06/19] fs/resctrl: Introduce data structures for kernel mode configuration Babu Moger
2026-12-02 4:51 ` Reinette Chatre
2026-12-04 16:21 ` Moger, Babu
2026-12-04 16:33 ` Reinette Chatre
2026-12-04 17:24 ` Moger, Babu
2026-12-04 17:30 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 07/19] fs/resctrl: Introduce resctrl_set_kmode_support() to register supported modes Babu Moger
2026-12-02 4:52 ` Reinette Chatre
2026-12-04 18:18 ` Moger, Babu
2026-11-11 22:44 ` [PATCH v7 08/19] x86/resctrl: Register RESCTRL_GLOBAL_ENABLE_PER_CPU when PLZA is available Babu Moger
2026-11-11 22:44 ` [PATCH v7 09/19] fs/resctrl: Rearrange top-level files in info directory Babu Moger
2026-12-02 4:54 ` Reinette Chatre
2026-12-04 22:10 ` Moger, Babu
2026-11-11 22:44 ` [PATCH v7 10/19] fs/resctrl: Add interface to display kernel mode status Babu Moger
2026-12-02 4:56 ` Reinette Chatre
2026-12-04 23:07 ` Moger, Babu [this message]
2026-11-11 22:44 ` [PATCH v7 11/19] fs/resctrl: Add support for hidden resource group files Babu Moger
2026-12-02 4:57 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 12/19] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup Babu Moger
2026-12-02 5:00 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 13/19] x86,fs/resctrl: Add CPU hotplug support for kernel mode Babu Moger
2026-11-16 20:08 ` Babu Moger
2026-12-02 5:02 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 14/19] fs/resctrl: Deactivate kernel mode when the group is removed Babu Moger
2026-12-02 5:03 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 15/19] fs/resctrl: Extend info/kernel_mode to configure the kernel mode Babu Moger
2026-11-16 20:09 ` Babu Moger
2026-12-02 5:06 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 16/19] fs/resctrl: Reject mode changes for groups backing " Babu Moger
2026-12-02 5:07 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 17/19] fs/resctrl: Control visibility of global per-CPU kernel mode group files Babu Moger
2026-11-16 20:10 ` Babu Moger
2026-11-11 22:44 ` [PATCH v7 18/19] fs/resctrl: Allow userspace to write kmode_cpus/kmode_cpus_list Babu Moger
2026-12-02 5:11 ` Reinette Chatre
2026-11-11 22:44 ` [PATCH v7 19/19] fs/resctrl: Add kernel mode documentation and examples Babu Moger
2026-11-26 12:33 ` [External] [PATCH v7 00/19] x86,fs/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem yunhui cui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e82638df-b3ff-4df5-a3e8-602c1409557c@amd.com \
--to=bmoger@amd.com \
--cc=Dave.Martin@arm.com \
--cc=arnd@arndb.de \
--cc=ashish.kalra@amd.com \
--cc=babu.moger@amd.com \
--cc=ben.horgan@arm.com \
--cc=binbin.wu@linux.intel.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dapeng1.mi@linux.intel.com \
--cc=darwi@linutronix.de \
--cc=dave.hansen@linux.intel.com \
--cc=elver@google.com \
--cc=enelsonmoore@gmail.com \
--cc=ewanhai-oc@zhaoxin.com \
--cc=fenghuay@nvidia.com \
--cc=fustini@kernel.org \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jlayton@kernel.org \
--cc=kim.phillips@amd.com \
--cc=kmehltretter@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=peterz@infradead.org \
--cc=prathyushi.nangia@amd.com \
--cc=rdunlap@infradead.org \
--cc=reinette.chatre@intel.com \
--cc=ricardo.neri-calderon@linux.intel.com \
--cc=rppt@kernel.org \
--cc=seanjc@google.com \
--cc=skhan@linuxfoundation.org \
--cc=superm1@kernel.org \
--cc=tglx@kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox