public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Babu Moger <babu.moger@amd.com>, "Moger, Babu" <bmoger@amd.com>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"tony.luck@intel.com" <tony.luck@intel.com>,
	"Dave.Martin@arm.com" <Dave.Martin@arm.com>,
	"james.morse@arm.com" <james.morse@arm.com>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"juri.lelli@redhat.com" <juri.lelli@redhat.com>,
	"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
	"dietmar.eggemann@arm.com" <dietmar.eggemann@arm.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"bsegall@google.com" <bsegall@google.com>,
	"mgorman@suse.de" <mgorman@suse.de>,
	"vschneid@redhat.com" <vschneid@redhat.com>,
	"kas@kernel.org" <kas@kernel.org>,
	"rick.p.edgecombe@intel.com" <rick.p.edgecombe@intel.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"pmladek@suse.com" <pmladek@suse.com>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"dapeng1.mi@linux.intel.com" <dapeng1.mi@linux.intel.com>,
	"kees@kernel.org" <kees@kernel.org>,
	"elver@google.com" <elver@google.com>,
	"paulmck@kernel.org" <paulmck@kernel.org>,
	"lirongqing@baidu.com" <lirongqing@baidu.com>,
	"safinaskar@gmail.com" <safinaskar@gmail.com>,
	"fvdl@google.com" <fvdl@google.com>,
	"seanjc@google.com" <seanjc@google.com>,
	"pawan.kumar.gupta@linux.intel.com"
	<pawan.kumar.gupta@linux.intel.com>,
	"xin@zytor.com" <xin@zytor.com>,
	"tiala@microsoft.com" <tiala@microsoft.com>,
	"chang.seok.bae@intel.com" <chang.seok.bae@intel.com>,
	"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	"elena.reshetova@intel.com" <elena.reshetova@intel.com>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"eranian@google.com" <eranian@google.com>,
	"peternewman@google.com" <peternewman@google.com>
Subject: Re: [PATCH v2 00/16] fs,x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem
Date: Tue, 21 Apr 2026 09:15:54 -0700	[thread overview]
Message-ID: <8d969f11-4a7f-4e36-b85a-c3ed714fc603@intel.com> (raw)
In-Reply-To: <e624f652-f0a6-4926-a0ab-c4486d41eb6d@amd.com>

Hi Babu,

On 4/21/26 8:08 AM, Babu Moger wrote:
> Hi Reinette,
> 
> On 4/20/26 22:17, Reinette Chatre wrote:
>> Hi Babu,
>>
>> On 4/20/26 5:40 PM, Moger, Babu wrote:
>>>
>>> We already discussed moving back to the default group on every mode
>>> switch. Doing so here would once again cause extra MSR writes on
>>> each mode transition, which is undesirable.
>>>
>>
>> Needing to avoid extra MSR writes in resctrl is not so absolute. Consider, for
>> example, how resctrl initializes default allocations when a new resource group is
>> created. resctrl aims to initialize with sane defaults and the user is expected to
>> follow with desired allocations.
>>
>> I am not against optimizing, I just want to be careful with such general statements.
>>
>> Considering your proposal in https://lore.kernel.org/lkml/39e0c786-cc35-4555-bfb9-ff7cd758c423@amd.com/:
>>
>> I do not think we should make info/kernel_mode read-only. If I understand correctly
>> doing so would accommodate AMD PLZA but it ignores the discussions on how resctrl could
>> support MPAM ... or do you perhaps have proposal on how MPAM can be supported when considering
>> your proposal? Even if you do not want to consider MPAM - what if the PLZA_PQR register's
>> scope becomes per-CPU in the next version of AMD PLZA?
>>
>> The idea behind info/kernel_mode is that the active mode it identifies indicates which
>> configuration files exist to configure the active mode. Since the mode may not always
>> depend on global configuration, for which info/kernel_mode_assignment was created, but instead
>> rely on per-resource group files, I do not see how resctrl can build on a read-only
>> info/kernel_mode backed by a mode and group change via info/kernel_mode_assignment.
>> Specifically, MPAM support may not use info/kernel_mode_assignment at all.
>> Instead, MPAM may use something like described in https://lore.kernel.org/lkml/aYyxAPdTFejzsE42@e134344.arm.com/
>>
>> Could we perhaps consider dropping info/kernel_mode_assignment entirely for
>> AMD PLZA's global allocations? Similar to what you suggest, the mode and
>> group assignment could be done via the info/kernel_mode file instead?
>>
>> Thinking about this more since the CPUs allocation is global, these could *theoretically*
>> be included also (but see later).
>> This could mean that "kernel_mode_cpus" and "kernel_mode_cpus_list" could be dropped?
>> Although, this may complicate the interface since user space may want a convenient way
>> to modify just CPUs independently from needing to repeat the mode and group every time.
>>
>> Consider, for example:
>>
>> # echo "global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/;cpus_list=5-8" > info/kernel_mode
> 
> This looks reasonable.
> 
>>
>> Having named fields (a) makes this extensible, (b) output does not need to be split among files,
>> and (c) "inherit_ctrl_and_mon" can continue to be supported.
>>
>> The named fields could be made optional, if group is omitted then it will become the
>> default resource group, and if cpus/cpus_list is omitted then it will default to all CPUs.
>> This may not be intuitive since a user may expect that not mentioning a field means
>> that the field is left untouched. Have you considered this scenario in your proposal?
>>
>> As an alternative the group could be made a required field and "kernel_mode_cpus"/"kernel_mode_cpuslist"
>> can stay? This may be the simplest approach.
> 
> How about keeping a single option to update the CPUs using
> kernel_mode_cpus / kernel_mode_cpuslist within the group?
> 
> Should we consider removing the per‑CPU extension altogether? By
> default, the mode already applies to all online CPUs, and any
> per‑CPU requirements can be handled within the group using
> kernel_mode_cpus / kernel_mode_cpuslist.

It sounds like we are saying the same thing? 
When considering all the sharp corners I agree that keeping kernel_mode_cpus/kernel_mode_cpuslist
seems most user friendly. When doing so there is no need to include CPU assignment in the global
files.
 
> 
> # echo "global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/
> 
> Why do we still need to keep the "inherit_ctrl_and_mon"?  By default all the groups in the system falls in this category it is not plza enabled group.
> 
> 
> System boots up with following options if PLZA is supported.
> 
> # cat info/kernel_mode
>       global_assign_ctrl_assign_mon_per_cpu
>       global_assign_ctrl_inherit_mon_per_cpu
> 
> No groups are associated with kernel mode at this point.

To me it seems useful to be clear to user space on what the current mode is. If I understand correctly
above default scenario essentially means "inherit_ctrl_and_mon" but instead of adding it to this file
we will need to add documentation that describes to user space how this file should be interpreted.
It seems easier to me to just be clear via info/kernel_mode itself on what the current active mode is?

I think something like below will be more intuitive and not need much additional 
documentation to understand (I am just adding the "uninitialized" as an example to match text
printed in schemata file during pseudo-locking ... even if there is a group named "uninitialized"
the lack of "/" could be used to make it clear what this means?):

	# cat info/kernel_mode
	[inherit_ctrl_and_mon]
	global_assign_ctrl_assign_mon_per_cpu:group=uninitialized
	global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized

I also think an interface like this would be simpler for user space to use as it (user space) switches
between PLZA capable and non-PLZA capable systems since user space need not associate existence of
the file with some kernel mode state in addition to actual content of the file when it does exist.

I assumed that info/kernel_mode can just always be made visible and not depend on PLZA
capable hardware. This means that on Intel and Arm this file can show:

	# cat info/kernel_mode
	[inherit_ctrl_and_mon]

For Intel this is accurate and also for Arm if I interpret the Arm implementation correctly
(see mpam_thread_switch()) in  https://lore.kernel.org/lkml/20260313144617.3420416-7-ben.horgan@arm.com/

> 
> # echo "global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/" > info/kernel_mode
> 
> # cat info/kernel_mode
>   global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/
>   global_assign_ctrl_inherit_mon_per_cpu
> 
> 
> # echo "global_assign_ctrl_inherit_mon_per_cpu:group=//" > info/kernel_mode
> 
> 
> # cat info/kernel_mode
>   global_assign_ctrl_assign_mon_per_cpu
>   global_assign_ctrl_inherit_mon_per_cpu:group=//
> 
> 
> How does this look?

In addition to above I think it will be helpful to add a clear indication to user
space on what the current active mode is, for example, via the [] characters.

Reinette


  reply	other threads:[~2026-04-21 16:16 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 20:36 [PATCH v2 00/16] fs,x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem Babu Moger
2026-03-12 20:36 ` [PATCH v2 01/16] fs/resctrl: Add kernel mode (kmode) data structures and arch hook Babu Moger
2026-03-24 22:51   ` Reinette Chatre
2026-03-26 18:41     ` Babu Moger
2026-03-12 20:36 ` [PATCH v2 02/16] fs, x86/resctrl: Add architecture routines for kernel mode initialization Babu Moger
2026-03-24 22:53   ` Reinette Chatre
2026-03-26 19:10     ` Babu Moger
2026-03-12 20:36 ` [PATCH v2 03/16] fs/resctrl: Add info/kernel_mode file to show kernel mode options Babu Moger
2026-03-12 20:36 ` [PATCH v2 04/16] x86/resctrl: Support Privilege-Level Zero Association (PLZA) Babu Moger
2026-03-12 20:36 ` [PATCH v2 05/16] x86/resctrl: Initialize supported kernel modes when CPUID reports PLZA Babu Moger
2026-03-12 20:36 ` [PATCH v2 06/16] resctrl: Introduce kmode static key enable/disable helpers Babu Moger
2026-03-12 20:36 ` [PATCH v2 07/16] x86/resctrl: Add data structures and definitions for PLZA configuration Babu Moger
2026-03-12 20:36 ` [PATCH v2 08/16] x86/resctrl: Add per-CPU and per-task kernel mode state Babu Moger
2026-03-12 20:36 ` [PATCH v2 09/16] x86,fs/resctrl: Add the functionality to configure PLZA Babu Moger
2026-03-12 20:36 ` [PATCH v2 10/16] x86/resctrl: Add PLZA state tracking and context switch handling Babu Moger
2026-03-12 20:36 ` [PATCH v2 11/16] fs/resctrl: Add write handler for info/kernel_mode Babu Moger
2026-03-12 20:36 ` [PATCH v2 12/16] fs/resctrl: Add info/kernel_mode_assignment to show kernel-mode rdtgroup Babu Moger
2026-03-12 20:36 ` [PATCH v2 13/16] fs/resctrl: Add write interface for kernel_mode_assignment Babu Moger
2026-03-12 20:36 ` [PATCH v2 14/16] fs/resctrl: Update kmode configuration when cpu_mask changes Babu Moger
2026-03-12 20:37 ` [PATCH v2 15/16] x86/resctrl: Refactor show_rdt_tasks() to support PLZA tasks Babu Moger
2026-03-12 20:37 ` [PATCH v2 16/16] fs/resctrl: Add per-task kmode enable support via rdtgroup Babu Moger
2026-03-24  6:15 ` [PATCH v2 00/16] fs,x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem Askar Safin
2026-03-24 22:51 ` Reinette Chatre
2026-03-26 17:12   ` Babu Moger
2026-03-27 22:11     ` Reinette Chatre
2026-03-30 18:46       ` Babu Moger
2026-03-31 22:24         ` Reinette Chatre
2026-04-06 22:45           ` Babu Moger
2026-04-07 17:48             ` Reinette Chatre
2026-04-08  1:01               ` Babu Moger
2026-04-08  4:45                 ` Reinette Chatre
2026-04-08 20:45                   ` Babu Moger
2026-04-08 21:24                     ` Reinette Chatre
2026-04-08 23:07                       ` Moger, Babu
2026-04-08 23:41                         ` Reinette Chatre
2026-04-09 17:19                           ` Moger, Babu
2026-04-09 17:26                             ` Reinette Chatre
2026-04-09 18:05                               ` Moger, Babu
2026-04-09 20:50                                 ` Reinette Chatre
2026-04-09 23:42                                   ` Moger, Babu
2026-04-10  3:41                                     ` Reinette Chatre
2026-04-10 22:52                                       ` Moger, Babu
2026-04-20 19:38                                       ` Babu Moger
2026-04-20 22:03                                         ` Reinette Chatre
2026-04-20 22:59                                           ` Moger, Babu
2026-04-20 23:34                                             ` Reinette Chatre
2026-04-21  0:40                                               ` Moger, Babu
2026-04-21  3:17                                                 ` Reinette Chatre
2026-04-21 15:08                                                   ` Babu Moger
2026-04-21 16:15                                                     ` Reinette Chatre [this message]
2026-04-21 16:46                                                       ` Babu Moger
2026-04-21 17:35                                                         ` Reinette Chatre
2026-04-21  0:03                                             ` Luck, Tony
2026-04-21  0:21                                               ` Reinette Chatre
2026-04-21 15:11                                                 ` Luck, Tony
2026-04-21 16:12                                                   ` Reinette Chatre

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=8d969f11-4a7f-4e36-b85a-c3ed714fc603@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=babu.moger@amd.com \
    --cc=bmoger@amd.com \
    --cc=bp@alien8.de \
    --cc=bsegall@google.com \
    --cc=chang.seok.bae@intel.com \
    --cc=corbet@lwn.net \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=elena.reshetova@intel.com \
    --cc=elver@google.com \
    --cc=eranian@google.com \
    --cc=fvdl@google.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kas@kernel.org \
    --cc=kees@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=peternewman@google.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=safinaskar@gmail.com \
    --cc=seanjc@google.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=tiala@microsoft.com \
    --cc=tony.luck@intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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