Linux Documentation
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Babu Moger <babu.moger@amd.com>, <corbet@lwn.net>,
	<tony.luck@intel.com>, <Dave.Martin@arm.com>,
	<james.morse@arm.com>, <tglx@kernel.org>, <bp@alien8.de>,
	<ben.horgan@arm.com>, <fenghuay@nvidia.com>
Cc: <skhan@linuxfoundation.org>, <x86@kernel.org>, <mingo@redhat.com>,
	<dave.hansen@linux.intel.com>, <hpa@zytor.com>,
	<akpm@linux-foundation.org>, <rdunlap@infradead.org>,
	<peterz@infradead.org>, <feng.tang@linux.alibaba.com>,
	<dapeng1.mi@linux.intel.com>, <elver@google.com>,
	<enelsonmoore@gmail.com>, <kuba@kernel.org>,
	<ebiggers@kernel.org>, <lirongqing@baidu.com>,
	<seanjc@google.com>, <nikunj@amd.com>, <xin@zytor.com>,
	<pawan.kumar.gupta@linux.intel.com>, <tiala@microsoft.com>,
	<chang.seok.bae@intel.com>, <kprateek.nayak@amd.com>,
	<prathyushi.nangia@amd.com>, <kim.phillips@amd.com>,
	<naveen@kernel.org>, <darwi@linutronix.de>,
	<elena.reshetova@intel.com>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <thomas.lendacky@amd.com>,
	<eranian@google.com>, <peternewman@google.com>,
	<qinyuntan@linux.alibaba.com>
Subject: Re: [RESEND PATCH v4 06/15] fs/resctrl: Introduce resctrl_set_kmode_support() to initialize supported modes
Date: Mon, 10 Aug 2026 20:16:11 -0700	[thread overview]
Message-ID: <681e0257-80e0-44c3-b826-20e314a3eb0d@intel.com> (raw)
In-Reply-To: <f4926d9bc70261ba0245a1d1158d8bd3d09bdefb.1783461016.git.babu.moger@amd.com>

Hi Babu,

On 7/7/26 2:50 PM, Babu Moger wrote:
> Architectures need a way to advertise which kernel-mode resctrl policies

"kernel-mode resctrl policies" -> "kernel modes"?

> they support before generic resctrl exposes those policies through the

"policies" -> "modes" 
(this is related to the earlier "use consistent terminology comment" I
will stop highlighting instances)

> filesystem.
> 
> Add the `struct resctrl_kmode_cfg` to define the default mode statically,
> and introduce `resctrl_set_kmode_support()` so architecture code can
> register supported kernel-mode policies during resctrl initialization. The
> `INHERIT_CTRL_AND_MON` policy is supported by default, so architectures
> only need to register any additional modes.

Please keep changelog high level and not describe the code that can be seen from patch.
When doing so, please write in imperative tone.

> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v4: New patch to initialize supported kernel-mode's.
>     https://lore.kernel.org/lkml/737a4228-52fb-4583-ac64-8efe79c107e6@intel.com/
>     Changed the kmode_cur to enum resctrl_kernel_mode in resctrl_kmode_cfg.
>     Moved the resctrl_kmode_cfg to filesystem code.
> ---
>  fs/resctrl/internal.h   | 12 ++++++++++++
>  fs/resctrl/rdtgroup.c   | 23 +++++++++++++++++++++++
>  include/linux/resctrl.h | 10 ++++++++++
>  3 files changed, 45 insertions(+)
> 
> diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
> index 48af75b9dc85..178126bb2da5 100644
> --- a/fs/resctrl/internal.h
> +++ b/fs/resctrl/internal.h
> @@ -314,6 +314,18 @@ struct mbm_state {
>  	u32	prev_bw;
>  };
>  
> +/**
> + * struct resctrl_kmode_cfg - Kernel-mode policy snapshot from architecture
"policy snapshot"? what does this mean? This is not just from architecture either.

> + * @kmode:	Bitmap of supported &enum resctrl_kernel_mode values. Each
> + *		supported mode is represented by BIT(mode).
> + * @kmode_cur:	Currently selected kernel-mode policy.

How about "Active kernel mode"?

> + * @k_rdtgrp:	Resource group backing global-assign modes when applicable;

(stray semi-colon)

> + */
> +struct resctrl_kmode_cfg {
> +	unsigned long			kmode;

How about "kmode_sup" to complement the "kmode_cur"?

To make it obvious this is a bitmap you can use something like:
	DECLARE_BITMAP(kmode_sup, RESCTRL_NUM_KERNEL_MODES)


> +	enum resctrl_kernel_mode	kmode_cur;
> +	struct rdtgroup			*k_rdtgrp;
> +};
>  extern struct mutex rdtgroup_mutex;
>  
>  static inline const char *rdt_kn_name(const struct kernfs_node *kn)
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index cc9966ff6cdf..0ee0dfaf9065 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -78,6 +78,16 @@ static void mon_put_kn_priv(void);
>  
>  struct dentry *debugfs_resctrl;
>  
> +/*
> + * Global kernel-mode resctrl policy. Architectures add supported modes before
> + * resctrl is mounted; @kmode_cur tracks the active policy after user selection.

ah - above it is referred to as "active". I find "active" to be more descriptive than
"selected" as highlighted above. The "after user selection" seems distracting.
"@kmode_cur is the active kernel mode" is all that is necessary, no?

> + */
> +static struct resctrl_kmode_cfg resctrl_kcfg = {
> +	.kmode = BIT(INHERIT_CTRL_AND_MON),
> +	.kmode_cur = INHERIT_CTRL_AND_MON,
> +	.k_rdtgrp = NULL
> +};

This initialization needs to be reconsidered to take into account that system may not
support allocation or monitoring. 

Reinette

  reply	other threads:[~2026-08-11  3:16 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 21:50 [RESEND PATCH v4 00/15] x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem Babu Moger
2026-07-07 21:50 ` [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA) Babu Moger
2026-07-07 22:01   ` Borislav Petkov
2026-07-08 14:51     ` Babu Moger
2026-07-08 17:27       ` Borislav Petkov
2026-07-08 16:55   ` Babu Moger
2026-07-08 23:28     ` Borislav Petkov
2026-07-09  0:00       ` Namhyung Kim
2026-07-09  0:12         ` Borislav Petkov
2026-07-10  0:55           ` Namhyung Kim
2026-07-10  1:46             ` Borislav Petkov
2026-08-11  2:51   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 02/15] x86/resctrl: Add PLZA support to command-line options Babu Moger
2026-07-08 17:39   ` Babu Moger
2026-08-11  2:53   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 03/15] x86/resctrl: Add data structures and definitions for PLZA configuration Babu Moger
2026-07-08 20:20   ` Babu Moger
2026-08-11  2:58   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 04/15] fs/resctrl: Introduce kernel mode (kmode) data structures Babu Moger
2026-07-08 20:56   ` Babu Moger
2026-08-11  3:03   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 05/15] x86,fs/resctrl: Introduce architecture hooks to program kernel-mode Babu Moger
2026-07-08 23:04   ` Moger, Babu
2026-08-11  3:14   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 06/15] fs/resctrl: Introduce resctrl_set_kmode_support() to initialize supported modes Babu Moger
2026-08-11  3:16   ` Reinette Chatre [this message]
2026-07-07 21:50 ` [RESEND PATCH v4 07/15] x86/resctrl: Expose the supported PLZA kernel-mode policies during init Babu Moger
2026-07-09 15:15   ` Babu Moger
2026-07-07 21:50 ` [RESEND PATCH v4 08/15] fs/resctrl: Add interface to display supported and active kernel-mode policy Babu Moger
2026-08-11  3:18   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 09/15] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup Babu Moger
2026-08-11  3:20   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 10/15] fs/resctrl: Reset the kernel-mode binding when an rdtgroup is removed Babu Moger
2026-07-09 18:15   ` Babu Moger
2026-08-11  3:29   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 11/15] fs/resctrl: Program kernel-mode binding when CPU comes online Babu Moger
2026-07-09 20:01   ` Babu Moger
2026-07-07 21:50 ` [RESEND PATCH v4 12/15] fs/resctrl: Hide kmode_cpus[_list] on groups not bound to kernel-mode Babu Moger
2026-08-11  3:30   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 13/15] fs/resctrl: Add interface to modify kernel-mode via info/kernel_mode Babu Moger
2026-07-09 22:46   ` Moger, Babu
2026-08-11  3:40   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 14/15] fs/resctrl: Allow user space to write kmode_cpus/kmode_cpus_list Babu Moger
2026-07-09 23:14   ` Moger, Babu
2026-08-11  3:49   ` Reinette Chatre
2026-07-07 21:50 ` [RESEND PATCH v4 15/15] fs/resctrl: Add documentation on kernel_mode with example Babu Moger

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=681e0257-80e0-44c3-b826-20e314a3eb0d@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=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=eranian@google.com \
    --cc=feng.tang@linux.alibaba.com \
    --cc=fenghuay@nvidia.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=kim.phillips@amd.com \
    --cc=kprateek.nayak@amd.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=mingo@redhat.com \
    --cc=naveen@kernel.org \
    --cc=nikunj@amd.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=peternewman@google.com \
    --cc=peterz@infradead.org \
    --cc=prathyushi.nangia@amd.com \
    --cc=qinyuntan@linux.alibaba.com \
    --cc=rdunlap@infradead.org \
    --cc=seanjc@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=tiala@microsoft.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=xin@zytor.com \
    /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