From: "Luck, Tony" <tony.luck@intel.com>
To: Babu Moger <babu.moger@amd.com>
Cc: <corbet@lwn.net>, <reinette.chatre@intel.com>,
<Dave.Martin@arm.com>, <james.morse@arm.com>, <tglx@kernel.org>,
<bp@alien8.de>, <dave.hansen@linux.intel.com>,
<skhan@linuxfoundation.org>, <x86@kernel.org>, <mingo@redhat.com>,
<hpa@zytor.com>, <akpm@linux-foundation.org>,
<rdunlap@infradead.org>, <pawan.kumar.gupta@linux.intel.com>,
<feng.tang@linux.alibaba.com>, <dapeng1.mi@linux.intel.com>,
<kees@kernel.org>, <elver@google.com>, <lirongqing@baidu.com>,
<paulmck@kernel.org>, <bhelgaas@google.com>, <seanjc@google.com>,
<alexandre.chartre@oracle.com>, <yazen.ghannam@amd.com>,
<peterz@infradead.org>, <chang.seok.bae@intel.com>,
<kim.phillips@amd.com>, <xin@zytor.com>, <naveen@kernel.org>,
<thomas.lendacky@amd.com>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <eranian@google.com>,
<peternewman@google.com>,
<sos-linux-ext-patches@mailman-svr.amd.com>
Subject: Re: [PATCH v3 04/12] x86,fs/resctrl: Program PLZA through kmode arch hooks
Date: Wed, 20 May 2026 15:16:32 -0700 [thread overview]
Message-ID: <ag4ywKHsH1Fc15wH@agluck-desk3> (raw)
In-Reply-To: <1a410ca9-f4a2-4956-8477-033d61a733be@amd.com>
On Wed, May 20, 2026 at 12:49:25PM -0500, Babu Moger wrote:
> Hi Tony,
>
>
> On 5/19/26 15:59, Luck, Tony wrote:
> > On Thu, Apr 30, 2026 at 06:24:49PM -0500, Babu Moger wrote:
> > > +void resctrl_arch_configure_kmode(cpumask_var_t cpu_mask, u32 closid, u32 rmid, bool enable)
> > > +{
> > > + union msr_pqr_plza_assoc plza = { 0 };
> > > +
> > > + plza.split.rmid = rmid;
> > > + plza.split.rmid_en = 1;
> >
> > Shouldn't there be a parameter for the value of rmid_en?
>
>
> I realized that behavior is not required—it was actually due to a mistake in
> my v2 series implementation.
>
> Below are the relevant definitions:
>
>
> GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU:
> The CLOSID is applied to kernel work, while the RMID used for monitoring is
> inherited from the currently running user task.
> No separate monitoring group is assigned for kernel work, so kernel
> execution naturally inherits the user-space RMID.
>
>
> GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU:
> Both CLOSID and RMID are explicitly assigned to kernel work.
> This allows assigning a dedicated monitoring group for kernel execution and
> therefore requires a separate RMID.
>
> Example: For GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU:
>
> # mount -t resctrl resctrl /sys/fs/resctrl
>
> # cat /sys/fs/resctrl/info/kernel_mode
> [inherit_ctrl_and_mon:group=//]
> global_assign_ctrl_inherit_mon_per_cpu:group=none
> global_assign_ctrl_assign_mon_per_cpu:group=none
>
> # mkdir /sys/fs/resctrl/ctrl1 (PQR_ASSOC closid=1 rmid=1)
>
> This configures all the CPU threads to use closid=1 and rmid=1 for both
> allocation and monitoring across user and kernel modes.
>
>
> # echo "global_assign_ctrl_inherit_mon_per_cpu:group=ctrl1//" \
> > /sys/fs/resctrl/info/kernel_mode
>
> # cat /sys/fs/resctrl/info/kernel_mode
> inherit_ctrl_and_mon:group=none
> [global_assign_ctrl_inherit_mon_per_cpu:group=ctrl1//]
> global_assign_ctrl_assign_mon_per_cpu:group=none
>
> This overrides the previous configuration, and PQR_PLZA_ASSOC is written.
>
> Possible options:
>
> 1. (closid=1, rmid_en=0, rmid=1)
> Here, hardware uses closid=1 for kernel work, but RMID tracking is disabled
> for kernel mode.
>
> As a result, reading RMID 1 reports only user-mode activity
> This contradicts the definition of this mode, since kernel work is expected
> to inherit the user RMID for monitoring.
>
> 2. (closid=1, rmid_en=1, rmid=1)
> In this case, RMID tracking is enabled for both user and kernel modes.
>
> Reading RMID 1 reports combined user + kernel activity
> This aligns with the expected inherit_monitoring behavior
>
>
> The preferred approach is to separate kernel monitoring by assigning it a
> dedicated monitoring group and updating PQR_PLZA_ASSOC to use a different
> RMID (e.g., closid=1, rmid_en=1, rmid=2). This is exactly the behavior
> implemented by GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU.
So maybe I'm just confused by the name "global_assign_ctrl_inherit_mon_per_cpu"
That sounds like "Use the CLOSID from PLZA, but keep the RMID from
legacy PQR_ASSOC.
So:
# mkdir ctrl1 # maybe gets CLOSID=1, RMID=1
# echo global_assign_ctrl_inherit_mon_per_cpu:group=ctrl1//" > info/kernel_mode
# mkdir ctrl2 # maybe gets CLOSID=2, RMID=2
# echo $$ > ctrl2/tasks
My shell, and all children run with CLOSID=2 and RMID=2 from ctrl2. But
when they do system calls, take page faults or there is an interrupt I'd
expect the code in the kernel to run with the CLOSID=1, while inheriting
RMID=2.
To make that happen, I thing the PLZA MSR should have rmid_en = 0. But
the only code I see that sets this always sets rmid_en=1.
>
> Thanks
> Babu
-Tony
next prev parent reply other threads:[~2026-05-20 22:16 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 23:24 [PATCH v3 00/12] [PATCH v3 00/12] x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem Babu Moger
2026-04-30 23:24 ` [PATCH v3 01/12] x86/resctrl: Support Privilege-Level Zero Association (PLZA) Babu Moger
2026-06-11 23:23 ` Reinette Chatre
2026-06-12 16:56 ` Moger, Babu
2026-06-12 17:00 ` Moger, Babu
2026-06-17 0:00 ` Reinette Chatre
2026-06-17 16:28 ` Babu Moger
2026-04-30 23:24 ` [PATCH v3 02/12] x86/resctrl: Add data structures and definitions for PLZA configuration Babu Moger
2026-06-11 23:40 ` Reinette Chatre
2026-06-12 15:40 ` Luck, Tony
2026-06-12 17:46 ` Moger, Babu
2026-06-12 17:32 ` Moger, Babu
2026-06-12 17:49 ` Moger, Babu
2026-04-30 23:24 ` [PATCH v3 03/12] fs/resctrl: Add kernel mode (kmode) data structures and arch hook Babu Moger
2026-06-16 23:30 ` Reinette Chatre
2026-06-17 19:36 ` Babu Moger
2026-04-30 23:24 ` [PATCH v3 04/12] x86,fs/resctrl: Program PLZA through kmode arch hooks Babu Moger
2026-05-19 20:59 ` Luck, Tony
2026-05-20 17:49 ` Babu Moger
2026-05-20 22:16 ` Luck, Tony [this message]
2026-05-20 23:09 ` Moger, Babu
2026-06-11 11:44 ` Peter Newman
2026-06-11 14:46 ` Babu Moger
2026-06-16 23:33 ` Reinette Chatre
2026-06-17 23:15 ` Moger, Babu
2026-04-30 23:24 ` [PATCH v3 05/12] x86/resctrl: Initialize supported kernel modes for PLZA Babu Moger
2026-06-16 23:35 ` Reinette Chatre
2026-06-18 16:20 ` Babu Moger
2026-04-30 23:24 ` [PATCH v3 06/12] fs/resctrl: Initialize the global kernel-mode policy at subsystem init Babu Moger
2026-06-16 23:36 ` Reinette Chatre
2026-06-18 17:14 ` Babu Moger
2026-06-22 16:21 ` Reinette Chatre
2026-06-22 16:38 ` Babu Moger
2026-04-30 23:24 ` [PATCH v3 07/12] fs/resctrl: Add info/kernel_mode for kernel-mode policy introspection Babu Moger
2026-06-16 23:38 ` Reinette Chatre
2026-06-18 19:16 ` Babu Moger
2026-04-30 23:24 ` [PATCH v3 08/12] fs/resctrl: Make info/kernel_mode writable and identify the bound group Babu Moger
2026-06-16 23:42 ` Reinette Chatre
2026-06-19 1:29 ` Babu Moger
2026-06-22 16:47 ` Reinette Chatre
2026-06-22 19:03 ` Babu Moger
2026-04-30 23:24 ` [PATCH v3 09/12] fs/resctrl: Reset kernel-mode binding when its rdtgroup goes away Babu Moger
2026-06-16 23:42 ` Reinette Chatre
2026-06-19 20:22 ` Babu Moger
2026-04-30 23:24 ` [PATCH v3 10/12] fs/resctrl: Expose kmode_cpus / kmode_cpus_list per rdtgroup Babu Moger
2026-04-30 23:24 ` [PATCH v3 11/12] resctrl: Hide kmode_cpus[_list] on groups not bound to kernel-mode Babu Moger
2026-04-30 23:24 ` [PATCH v3 12/12] fs/resctrl: Allow user space to write kmode_cpus / kmode_cpus_list Babu Moger
2026-06-11 21:53 ` [PATCH v3 00/12] [PATCH v3 00/12] x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem Reinette Chatre
2026-06-12 15:37 ` Moger, Babu
2026-06-17 4:34 ` Reinette Chatre
2026-06-17 15:56 ` Babu Moger
2026-06-17 17:33 ` Reinette Chatre
2026-06-17 19:55 ` Babu Moger
2026-06-26 15:55 ` Luck, Tony
2026-06-29 13:20 ` 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=ag4ywKHsH1Fc15wH@agluck-desk3 \
--to=tony.luck@intel.com \
--cc=Dave.Martin@arm.com \
--cc=akpm@linux-foundation.org \
--cc=alexandre.chartre@oracle.com \
--cc=babu.moger@amd.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=chang.seok.bae@intel.com \
--cc=corbet@lwn.net \
--cc=dapeng1.mi@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=elver@google.com \
--cc=eranian@google.com \
--cc=feng.tang@linux.alibaba.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=kees@kernel.org \
--cc=kim.phillips@amd.com \
--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=paulmck@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peternewman@google.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=reinette.chatre@intel.com \
--cc=seanjc@google.com \
--cc=skhan@linuxfoundation.org \
--cc=sos-linux-ext-patches@mailman-svr.amd.com \
--cc=tglx@kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
--cc=xin@zytor.com \
--cc=yazen.ghannam@amd.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