From: Reinette Chatre <reinette.chatre@intel.com>
To: Babu Moger <babu.moger@amd.com>, <tony.luck@intel.com>,
<Dave.Martin@arm.com>, <james.morse@arm.com>, <bp@alien8.de>,
<ben.horgan@arm.com>
Cc: <corbet@lwn.net>, <skhan@linuxfoundation.org>,
<rdunlap@infradead.org>, <tglx@kernel.org>, <mingo@redhat.com>,
<dave.hansen@linux.intel.com>, <hpa@zytor.com>,
<fenghuay@nvidia.com>, <akpm@linux-foundation.org>,
<rppt@kernel.org>, <dapeng1.mi@linux.intel.com>,
<elver@google.com>, <jlayton@kernel.org>,
<enelsonmoore@gmail.com>, <kuba@kernel.org>,
<ebiggers@kernel.org>, <seanjc@google.com>,
<peterz@infradead.org>, <chao.gao@intel.com>,
<jmattson@google.com>, <naveen@kernel.org>,
<ricardo.neri-calderon@linux.intel.com>, <tiala@microsoft.com>,
<chang.seok.bae@intel.com>, <prathyushi.nangia@amd.com>,
<kim.phillips@amd.com>, <elena.reshetova@intel.com>,
<darwi@linutronix.de>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <x86@kernel.org>
Subject: Re: [PATCH v5 11/16] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup
Date: Tue, 15 Sep 2026 22:34:27 -0700 [thread overview]
Message-ID: <ef8804d5-f20c-49a1-87cf-ab39437a5f0d@intel.com> (raw)
In-Reply-To: <0ad1110a1fa2c041d71f50b0d756815676c4dee6.1787772750.git.babu.moger@amd.com>
Hi Babu,
On 8/26/26 12:32 PM, Babu Moger wrote:
> fs/resctrl/internal.h | 5 +++++
> fs/resctrl/rdtgroup.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 48 insertions(+)
>
> diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
> index b56f95625072..01f9f596f9b1 100644
> --- a/fs/resctrl/internal.h
> +++ b/fs/resctrl/internal.h
> @@ -216,6 +216,9 @@ struct mongroup {
> * @mon: mongroup related data
> * @mode: mode of resource group
> * @mba_mbps_event: input monitoring event id when mba_sc is enabled
> + * @kmode: true if this group has an active kernel-mode
> + * association
This really just seems specific to the global per-CPU kernel mode. Why is
it necessary? Is resctrl_kcfg.active.k_rdtgrp not sufficient by itself? (more below)
> + * @kmode_cpu_mask: CPUs in this group's kernel-mode association
> * @plr: pseudo-locked region
> */
> struct rdtgroup {
> @@ -229,6 +232,8 @@ struct rdtgroup {
> struct mongroup mon;
> enum rdtgrp_mode mode;
> enum resctrl_event_id mba_mbps_event;
> + bool kmode;
> + struct cpumask kmode_cpu_mask;
> struct pseudo_lock_region *plr;
> };
>
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index d2fff8adf915..06e74b027044 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -389,6 +389,32 @@ static int rdtgroup_cpus_show(struct kernfs_open_file *of,
> return ret;
> }
>
> +/*
> + * Display CPU masks for the kernel-mode associated resource group.
> + * Supports both "kmode_cpus" (bitmap format) and "kmode_cpus_list"
> + * (range list format); the output format is selected accordingly.
> + *
> + * Returns -ENOENT on error.
> + */
> +static int rdtgroup_kmode_cpus_show(struct kernfs_open_file *of,
> + struct seq_file *s, void *v)
> +{
> + struct rdtgroup *rdtgrp;
> + int ret = 0;
> +
> + rdtgrp = rdtgroup_kn_lock_live(of->kn);
> +
> + if (rdtgrp && rdtgrp->kmode) {
First, it would be helpful to explain why the second test is needed since it
is not obvious that a resource group may get re-assigned while a user has this
file open.
Second, could a check of rdtgrp->kmode be replaced with a comparison between
rdtgrp and resctrl_kcfg.active.k_rdtgrp ? If so, why is rdtgrp::kmode needed?
I think one part of this is how this series blurs between a generic
"kernel mode" and the specific only-supported global per-CPU kernel mode
that makes it difficult to know what state can be used.
> + seq_printf(s, is_cpu_list(of) ? "%*pbl\n" : "%*pb\n",
> + cpumask_pr_args(&rdtgrp->kmode_cpu_mask));
> + } else {
> + ret = -ENOENT;
> + }
> + rdtgroup_kn_unlock(of->kn);
> +
> + return ret;
> +}
> +
> /*
> * Update the PGR_ASSOC MSR on all cpus in @cpu_mask,
> *
> @@ -2288,6 +2314,23 @@ static struct rftype res_common_files[] = {
> .flags = RFTYPE_FLAGS_CPUS_LIST,
> .fflags = RFTYPE_BASE,
> },
> + {
> + .name = "kmode_cpus",
> + .mode = 0444,
> + .hidden = true,
> + .kf_ops = &rdtgroup_kf_single_ops,
> + .seq_show = rdtgroup_kmode_cpus_show,
> + .fflags = RFTYPE_BASE,
> + },
> + {
> + .name = "kmode_cpus_list",
> + .mode = 0444,
> + .hidden = true,
> + .kf_ops = &rdtgroup_kf_single_ops,
> + .seq_show = rdtgroup_kmode_cpus_show,
> + .flags = RFTYPE_FLAGS_CPUS_LIST,
> + .fflags = RFTYPE_BASE,
> + },
> {
> .name = "tasks",
> .mode = 0644,
Reinette
next prev parent reply other threads:[~2026-09-16 5:34 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 19:32 [PATCH v5 00/16] x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem Babu Moger
2026-08-26 19:32 ` [PATCH v5 01/16] x86/cpufeatures: Support Privilege Level Zero Association (PLZA) Babu Moger
2026-09-16 5:12 ` Reinette Chatre
2026-09-16 20:45 ` Babu Moger
2026-08-26 19:32 ` [PATCH v5 02/16] x86/resctrl: Add PLZA support to command-line options Babu Moger
2026-09-16 5:12 ` Reinette Chatre
2026-09-16 20:45 ` Babu Moger
2026-08-26 19:32 ` [PATCH v5 03/16] x86/resctrl: Add PLZA configuration definitions and data structures Babu Moger
2026-09-16 5:16 ` Reinette Chatre
2026-09-16 20:53 ` Babu Moger
2026-08-26 19:32 ` [PATCH v5 04/16] fs/resctrl: Introduce kernel mode policy enum Babu Moger
2026-09-16 5:14 ` Reinette Chatre
2026-09-16 20:53 ` Babu Moger
2026-08-26 19:32 ` [PATCH v5 05/16] x86,fs/resctrl: Introduce architecture hooks to program kernel mode Babu Moger
2026-09-16 5:26 ` Reinette Chatre
2026-09-16 20:57 ` Babu Moger
2026-08-26 19:32 ` [PATCH v5 06/16] fs/resctrl: Introduce kernel mode states for resctrl Babu Moger
2026-09-16 5:28 ` Reinette Chatre
2026-08-26 19:32 ` [PATCH v5 07/16] fs/resctrl: Introduce resctrl_set_kmode_support() to register supported modes Babu Moger
2026-09-16 5:29 ` Reinette Chatre
2026-08-26 19:32 ` [PATCH v5 08/16] x86/resctrl: Expose assign_global_enable_per_cpu when PLZA is available Babu Moger
2026-08-26 19:32 ` [PATCH v5 09/16] fs/resctrl: Add interface to display supported and active kernel modes Babu Moger
2026-09-16 5:32 ` Reinette Chatre
2026-08-26 19:32 ` [PATCH v5 10/16] fs/resctrl: Add support for hidden resource group files Babu Moger
2026-09-16 5:33 ` Reinette Chatre
2026-08-26 19:32 ` [PATCH v5 11/16] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup Babu Moger
2026-09-16 5:34 ` Reinette Chatre [this message]
2026-08-26 19:32 ` [PATCH v5 12/16] fs/resctrl: Program kernel mode assignments on CPU hotplug Babu Moger
2026-09-16 5:35 ` Reinette Chatre
2026-08-26 19:32 ` [PATCH v5 13/16] fs/resctrl: Deactivate the kernel mode association when a group is removed Babu Moger
2026-09-16 5:36 ` Reinette Chatre
2026-08-26 19:32 ` [PATCH v5 14/16] fs/resctrl: Add interface to modify kernel mode via info/kernel_mode Babu Moger
2026-09-16 5:50 ` Reinette Chatre
2026-08-26 19:32 ` [PATCH v5 15/16] fs/resctrl: Allow user space to write kmode_cpus/kmode_cpus_list Babu Moger
2026-08-26 19:32 ` [PATCH v5 16/16] fs/resctrl: Add documentation on kernel_mode with example Babu Moger
2026-09-01 21:14 ` Luck, Tony
2026-09-01 23:28 ` Moger, Babu
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=ef8804d5-f20c-49a1-87cf-ab39437a5f0d@intel.com \
--to=reinette.chatre@intel.com \
--cc=Dave.Martin@arm.com \
--cc=akpm@linux-foundation.org \
--cc=babu.moger@amd.com \
--cc=ben.horgan@arm.com \
--cc=bp@alien8.de \
--cc=chang.seok.bae@intel.com \
--cc=chao.gao@intel.com \
--cc=corbet@lwn.net \
--cc=dapeng1.mi@linux.intel.com \
--cc=darwi@linutronix.de \
--cc=dave.hansen@linux.intel.com \
--cc=ebiggers@kernel.org \
--cc=elena.reshetova@intel.com \
--cc=elver@google.com \
--cc=enelsonmoore@gmail.com \
--cc=fenghuay@nvidia.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jlayton@kernel.org \
--cc=jmattson@google.com \
--cc=kim.phillips@amd.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=naveen@kernel.org \
--cc=peterz@infradead.org \
--cc=prathyushi.nangia@amd.com \
--cc=rdunlap@infradead.org \
--cc=ricardo.neri-calderon@linux.intel.com \
--cc=rppt@kernel.org \
--cc=seanjc@google.com \
--cc=skhan@linuxfoundation.org \
--cc=tglx@kernel.org \
--cc=tiala@microsoft.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
all inboxes | Powered by JetHome®