The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [RESEND PATCH v4 00/15] x86/resctrl: Add kernel-mode (e.g., PLZA) support to the resctrl subsystem
@ 2026-07-07 21:50 Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA) Babu Moger
                   ` (14 more replies)
  0 siblings, 15 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan


Hi All,

Had some problem sending the patches earlier. Resending it again.

This series adds support for AMD's Privilege-Level Zero Association
(PLZA) so kernel work can be assigned to a resctrl group, and wires it
up through a small generic "kernel mode" (kmode) layer in fs/resctrl
so future architectures can plug in without touching core resctrl.

The features are documented in:

   AMD64 Zen6 Platform Quality of Service (PQOS) Extensions,
   Publication # 69193 Revision 1.00, Issue Date March 2026

available at https://bugzilla.kernel.org/show_bug.cgi?id=206537

The patches are based on top of commit (tip/master v7.2-rc2):

  f705c6728b35 Merge branch into tip/master: 'x86/msr'

Background
==========

Customers have identified an issue while using the QoS resource Control
feature. If a memory bandwidth associated with a CLOSID is aggressively
throttled, and it moves into Kernel mode, the Kernel operations are also
aggressively throttled. This can stall forward progress and eventually
degrade overall system performance.

Privilege-Level Zero Association (PLZA) allows the user to specify a CLOSID
and/or RMID for execution at Privilege Level Zero. When PLZA is enabled on
a CPU, kernel work at PL0 uses the CLOSID and/or RMID from MSR
PQR_PLZA_ASSOC; otherwise, the CPU uses the CLOSID and RMID from PQR_ASSOC.


Design
======

A new sysfs file, info/kernel_mode, holds the global policy for resource
allocation and monitoring of kernel work and the resource group (when
applicable) associated with the policy.  Reads list the supported modes
and the currently active binding; writes change the policy or rebind to a
different group.  Look at the thread below for design discussion.
https://lore.kernel.org/lkml/14a8ad0a-e842-4268-871a-0762f1169e03@intel.com/

Per-rdtgroup files kmode_cpus and kmode_cpus_list scope the binding
to a subset of online CPUs without unbind/rebind churn.  They are
visible only on the group that is currently the active kernel-mode
binding.

The arch hook, resctrl_arch_configure_kmode keep the fs/resctrl layer
arch-neutral.

Introduced `resctrl_set_kmode_support()` so architecture code
can register supported kernel-mode policies during resctrl initialization.

Only AMD PLZA is wired up here; Intel and ARM can add their own
support later by implementing the hooks.

Examples
========

(See Documentation/filesystems/resctrl.rst, "kernel_mode",
"kmode_cpus", and "Examples on working with kernel_mode", for the full
UAPI.)

  # Mount resctrl
  # mount -t resctrl resctrl /sys/fs/resctrl
  # cd /sys/fs/resctrl

  # Read the supported modes.  The active mode is bracketed for display
  # only.  Inactive global-assign modes report ":group=uninitialized".
  # cat info/kernel_mode
  [inherit_ctrl_and_mon]
  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized

  # Create a CTRL_MON group and bind kernel-mode allocation to it.
  # mkdir ctrl1
  # echo "global_assign_ctrl_inherit_mon_per_cpu:group=ctrl1//" \
          > info/kernel_mode
  # cat info/kernel_mode
  inherit_ctrl_and_mon
  [global_assign_ctrl_inherit_mon_per_cpu:group=ctrl1//]
  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized

  # kmode_cpus and kmode_cpus_list are visible only on the bound group.
  # ls ctrl1/kmode_cpus*
  ctrl1/kmode_cpus  ctrl1/kmode_cpus_list

  # Restrict the binding to a CPU subset; the write is incremental.
  # echo 0-3 > ctrl1/kmode_cpus_list
  # cat ctrl1/kmode_cpus
  f
  # cat ctrl1/kmode_cpus_list
  0-3

  # Return to the default inherit mode.
  # echo "inherit_ctrl_and_mon" > info/kernel_mode
  # cat info/kernel_mode
  [inherit_ctrl_and_mon]
  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized

Tested on AMD with PLZA; the generic bits build clean on x86 without
PLZA support and are no-ops at runtime.

Layout
======

  01-03  x86: PLZA CPU feature, command-line option, and MSR/data-structure
         plumbing.
  04-07  fs/resctrl + x86: kmode data structures, arch hooks, supported-mode
         initialization, and PLZA policy advertisement.
  08     fs/resctrl: info/kernel_mode read-only introspection.
  09-10  fs/resctrl: per-rdtgroup kmode_cpus[_list] exposure and reset of
         the binding when the bound rdtgroup is removed.
  11     fs/resctrl: program kernel-mode binding when a CPU comes online.
  12     resctrl: hide kmode_cpus[_list] on groups not bound to kernel-mode.
  13-14  fs/resctrl: info/kernel_mode write and incremental kmode_cpus[_list]
         writes.
  15     fs/resctrl: documentation and end-to-end examples.


Changelog
=========
v4:
  - Reorder and split the series into 15 patches: separate read-only
    info/kernel_mode display (08) from the write path (13);
    add hotplug support when a CPU comes online (11); add an end-to-end
    documentation/examples patch (15).

  - Introduced `resctrl_set_kmode_support()` so architecture code can
    register supported kernel-mode policies during resctrl initialization.

  - info/kernel_mode UAPI: inactive global-assign modes report
    ":group=uninitialized" (not ":group=none"); the inherit mode has
    no ":group=" suffix; square brackets mark the active mode on read
    only and must not be included when writing.

  - info/kernel_mode write: validate group type (assign_mon may bind an
    RDTMON_GROUP or RDTCTRL_GROUP; inherit_mon only RDTCTRL_GROUP);
    run fail paths before tearing down the active binding so errors
    retain the old binding; reset any active global-assign binding
    before reprogramming when rebinding.

  - kmode_cpus / kmode_cpus_list: writable with incremental
    enable/disable deltas; empty masks are allowed; offline CPUs and
    writes through stale file descriptors (opened before an
    info/kernel_mode change) are rejected; pseudo-locked and
    pseudo-lock-setup groups are rejected.

  - Hotplug: newly online CPUs are added to the bound group's
    kmode_cpu_mask and programmed when a global-assign policy is
    active.

  - Documentation updated alongside the UAPI changes, including an
    "Examples on working with kernel_mode" walk-through.

v3:
  - Generalise the layer beyond AMD: rename "PLZA mode" to "kernel
    mode" (kmode) in code, sysfs, and Documentation.  The public
    interface is now info/kernel_mode and per-group kmode_cpus[_list].
  - info/kernel_mode UAPI cleanups: designated initialisers +
    static_assert for the mode-name table; strim() the input; clearer
    error messages via last_cmd_status.
  - kmode_cpus / kmode_cpus_list: expose read-only, gate visibility on
    the bound group, and allow incremental writes.
  - Reset the binding when the bound rdtgroup is removed, instead of
    leaving stale state.
  - Kerneldoc/comment cleanups across the series.

v2:
  - Similar to RFC with a new proposal; interface names were not final.
  - Separated Global Bandwidth Enforcement (GLBE) from PLZA; this
    series only adds PLZA support.
  - Used "kmode" instead of "PLZA" in the generic layer.

Previous versions:
v3: https://lore.kernel.org/lkml/cover.1777591496.git.babu.moger@amd.com/
v2: https://lore.kernel.org/lkml/cover.1773347820.git.babu.moger@amd.com/
v1: https://lore.kernel.org/lkml/cover.1769029977.git.babu.moger@amd.com/


Babu Moger (15):
  x86/resctrl: Support Privilege Level Zero Association (PLZA)
  x86/resctrl: Add PLZA support to command-line options
  x86/resctrl: Add data structures and definitions for PLZA
    configuration
  fs/resctrl: Introduce kernel mode (kmode) data structures
  x86,fs/resctrl: Introduce architecture hooks to program kernel-mode
  fs/resctrl: Introduce resctrl_set_kmode_support() to initialize
    supported modes
  x86/resctrl: Expose the supported PLZA kernel-mode policies during
    init
  fs/resctrl: Add interface to display supported and active kernel-mode
    policy
  fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup
  fs/resctrl: Reset the kernel-mode binding when an rdtgroup is removed
  fs/resctrl: Program kernel-mode binding when CPU comes online
  fs/resctrl: Hide kmode_cpus[_list] on groups not bound to kernel-mode
  fs/resctrl: Add interface to modify kernel-mode via info/kernel_mode
  fs/resctrl: Allow user space to write kmode_cpus/kmode_cpus_list
  fs/resctrl: Add documentation on kernel_mode with example

 .../admin-guide/kernel-parameters.txt         |   2 +-
 Documentation/filesystems/resctrl.rst         | 195 ++++++
 arch/x86/include/asm/cpufeatures.h            |   1 +
 arch/x86/include/asm/msr-index.h              |   1 +
 arch/x86/kernel/cpu/resctrl/core.c            |   8 +
 arch/x86/kernel/cpu/resctrl/ctrlmondata.c     |  36 +
 arch/x86/kernel/cpu/resctrl/internal.h        |  37 +
 arch/x86/kernel/cpu/scattered.c               |   1 +
 drivers/resctrl/mpam_resctrl.c                |   5 +
 fs/resctrl/internal.h                         |  16 +
 fs/resctrl/rdtgroup.c                         | 663 ++++++++++++++++++
 include/linux/resctrl.h                       |  56 ++
 12 files changed, 1020 insertions(+), 1 deletion(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  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 ` Babu Moger
  2026-07-07 22:01   ` Borislav Petkov
  2026-07-08 16:55   ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 02/15] x86/resctrl: Add PLZA support to command-line options Babu Moger
                   ` (13 subsequent siblings)
  14 siblings, 2 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Customers have identified an issue while using the QoS resource control
feature. If memory bandwidth associated with a CLOSID is aggressively
throttled, and a task with that CLOSID moves into kernel mode, the kernel
operations are also aggressively throttled. This can stall forward progress
and eventually degrade overall system performance.

AMD hardware supports a feature Privilege Level Zero Association (PLZA),
which allows the CPU's CLOSID association to be changed during the
transition from user mode to kernel mode. This allows the kernel to run
using a different CLOSID than user space, which can improve system
performance in certain scenarios.

The feature is detected via CPUID_Fn80000020_EBX_x00 [Bit 9]:
Privilege Level Zero Association (PLZA).

The PLZA feature details are documented in [1] available from [2].

[1] AMD64 Zen6 Platform Quality of Service (PQOS) Extensions:
    Publication # 69193 Revision: 1.00, Issue Date: March 2026

Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Split the patch into 2. This patch only handles x86 changes.
    Re-wrote the changelog along the ABMC changes.

v3: Code did not change. Patch order changed.
    Added documentation link.

v2: Rebased on top of the latest tip.
---
 arch/x86/include/asm/cpufeatures.h | 1 +
 arch/x86/kernel/cpu/scattered.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 1b4a48bff18f..bf6fc71f87fa 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -517,6 +517,7 @@
 						      * and purposes if CLEAR_CPU_BUF_VM is set).
 						      */
 #define X86_FEATURE_X2AVIC_EXT		(21*32+20) /* AMD SVM x2AVIC support for 4k vCPUs */
+#define X86_FEATURE_PLZA		(21*32+21) /* Privilege Level Zero Association */
 
 /*
  * BUG word(s)
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index 937129ce6a96..1fa4d5aef17e 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -61,6 +61,7 @@ static const struct cpuid_bit cpuid_bits[] = {
 	{ X86_FEATURE_BMEC,			CPUID_EBX,  3, 0x80000020, 0 },
 	{ X86_FEATURE_ABMC,			CPUID_EBX,  5, 0x80000020, 0 },
 	{ X86_FEATURE_SDCIAE,			CPUID_EBX,  6, 0x80000020, 0 },
+	{ X86_FEATURE_PLZA,			CPUID_EBX,  9, 0x80000020, 0 },
 	{ X86_FEATURE_TSA_SQ_NO,		CPUID_ECX,  1, 0x80000021, 0 },
 	{ X86_FEATURE_TSA_L1_NO,		CPUID_ECX,  2, 0x80000021, 0 },
 	{ X86_FEATURE_AMD_WORKLOAD_CLASS,	CPUID_EAX, 22, 0x80000021, 0 },
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 02/15] x86/resctrl: Add PLZA support to command-line options
  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 21:50 ` Babu Moger
  2026-07-08 17:39   ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 03/15] x86/resctrl: Add data structures and definitions for PLZA configuration Babu Moger
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Add a kernel command-line parameter to enable or disable the exposure of
the PLZA (Privilege Level Zero Association) feature to resctrl.

This allows administrators to control PLZA visibility at boot time via the
rdt= option (e.g. rdt=plza or rdt=!plza).

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Split the patch 1 from v3 into 2 patches.
    This patch contains changes for resctrl subsystem.
---
 Documentation/admin-guide/kernel-parameters.txt | 2 +-
 Documentation/filesystems/resctrl.rst           | 1 +
 arch/x86/kernel/cpu/resctrl/core.c              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b5493a7f8f22..1de27055cb32 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -6401,7 +6401,7 @@ Kernel parameters
 	rdt=		[HW,X86,RDT]
 			Turn on/off individual RDT features. List is:
 			cmt, mbmtotal, mbmlocal, l3cat, l3cdp, l2cat, l2cdp,
-			mba, smba, bmec, abmc, sdciae, energy[:guid],
+			mba, smba, bmec, abmc, sdciae, plza, energy[:guid],
 			perf[:guid].
 			E.g. to turn on cmt and turn off mba use:
 				rdt=cmt,!mba
diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index e4b66af55ffb..f3e941404967 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -28,6 +28,7 @@ SMBA (Slow Memory Bandwidth Allocation)				""
 BMEC (Bandwidth Monitoring Event Configuration)			""
 ABMC (Assignable Bandwidth Monitoring Counters)			""
 SDCIAE (Smart Data Cache Injection Allocation Enforcement)	""
+PLZA (Privilege Level Zero Association)				""
 =============================================================== ================================
 
 Historically, new features were made visible by default in /proc/cpuinfo. This
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index f452e8ce4cef..27e09cded829 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -803,6 +803,7 @@ enum {
 	RDT_FLAG_BMEC,
 	RDT_FLAG_ABMC,
 	RDT_FLAG_SDCIAE,
+	RDT_FLAG_PLZA,
 };
 
 #define RDT_OPT(idx, n, f)	\
@@ -830,6 +831,7 @@ static struct rdt_options rdt_options[]  __ro_after_init = {
 	RDT_OPT(RDT_FLAG_BMEC,	    "bmec",	X86_FEATURE_BMEC),
 	RDT_OPT(RDT_FLAG_ABMC,	    "abmc",	X86_FEATURE_ABMC),
 	RDT_OPT(RDT_FLAG_SDCIAE,    "sdciae",	X86_FEATURE_SDCIAE),
+	RDT_OPT(RDT_FLAG_PLZA,	    "plza",	X86_FEATURE_PLZA),
 };
 #define NUM_RDT_OPTIONS ARRAY_SIZE(rdt_options)
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 03/15] x86/resctrl: Add data structures and definitions for PLZA configuration
  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 21:50 ` [RESEND PATCH v4 02/15] x86/resctrl: Add PLZA support to command-line options Babu Moger
@ 2026-07-07 21:50 ` Babu Moger
  2026-07-08 20:20   ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 04/15] fs/resctrl: Introduce kernel mode (kmode) data structures Babu Moger
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Privilege Level Zero Association (PLZA) allows the kernel to use a
different CLOSID (and optionally RMID) than user mode on entry to kernel
mode. The CLOSID/RMID association is programmed per CPU via
MSR_IA32_PQR_PLZA_ASSOC (0xc00003fc), using RMID/CLOSID values and their
respective enable bits.

Add the MSR definition and union msr_pqr_plza_assoc to represent the MSR
bitfield layout used by subsequent PLZA programming.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Re-wrote the changelog and code comment.

v3: No code changes. Patch order changed. Improved changelog.

v2: No changes. Just rebasing on top of the latest tip branch.
---
 arch/x86/include/asm/msr-index.h       |  1 +
 arch/x86/kernel/cpu/resctrl/internal.h | 37 ++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 18c4be75e927..2503451a95fe 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -1292,6 +1292,7 @@
 /* - AMD: */
 #define MSR_IA32_MBA_BW_BASE		0xc0000200
 #define MSR_IA32_SMBA_BW_BASE		0xc0000280
+#define MSR_IA32_PQR_PLZA_ASSOC		0xc00003fc
 #define MSR_IA32_L3_QOS_ABMC_CFG	0xc00003fd
 #define MSR_IA32_L3_QOS_EXT_CFG		0xc00003ff
 #define MSR_IA32_EVT_CFG_BASE		0xc0000400
diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index e3cfa0c10e92..020ebc2c8a1f 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -222,6 +222,43 @@ union l3_qos_abmc_cfg {
 	unsigned long full;
 };
 
+/*
+ * Privilege Level Zero Association (PLZA) is configured by writing to
+ * MSR_IA32_PQR_PLZA_ASSOC. The MSR must be programmed on every CPU in
+ * the QoS domain. Each domain supports only one PLZA CLOSID and/or RMID
+ * association. All fields other than PLZA_EN must hold the same value
+ * across the domain for consistent operation.
+ *
+ * When PLZA_EN is set, the CLOSID/RMID association used at CPL 0 is
+ * taken from MSR_IA32_PQR_PLZA_ASSOC instead of MSR_IA32_PQR_ASSOC.
+ *
+ * @rmid		: RMID associated with PLZA.
+ * @reserved1		: Reserved.
+ * @rmid_en		: Enable RMID association for PLZA.
+ * @closid		: CLOSID associated with PLZA.
+ * @reserved2		: Reserved.
+ * @closid_en		: Enable CLOSID association for PLZA.
+ * @reserved3		: Reserved.
+ * @plza_en		: Enable PLZA. When enabled, PLZA applies to the
+ *			  given CPU. When PLZA is disabled for a CPU, the
+ *			  CLOSID and RMID association defined in the
+ *			  PQR_ASSOC MSR applies, regardless of the CPU's
+ *			  privilege level.
+ */
+union msr_pqr_plza_assoc {
+	struct {
+		unsigned long rmid	:12,
+			      reserved1	:19,
+			      rmid_en	: 1,
+			      closid	: 4,
+			      reserved2	:11,
+			      closid_en	: 1,
+			      reserved3	:15,
+			      plza_en	: 1;
+	} split;
+	unsigned long full;
+};
+
 void rdt_ctrl_update(void *arg);
 
 int rdt_get_l3_mon_config(struct rdt_resource *r);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 04/15] fs/resctrl: Introduce kernel mode (kmode) data structures
  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
                   ` (2 preceding siblings ...)
  2026-07-07 21:50 ` [RESEND PATCH v4 03/15] x86/resctrl: Add data structures and definitions for PLZA configuration Babu Moger
@ 2026-07-07 21:50 ` Babu Moger
  2026-07-08 20:56   ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 05/15] x86,fs/resctrl: Introduce architecture hooks to program kernel-mode Babu Moger
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Kernel-mode traffic can use a different allocation and monitoring context
than the originating user task. On x86, Privilege Level Zero Association
(PLZA) enables the kernel to switch to a different CLOSID (and optionally
RMID) when entering kernel mode.

Architectures need a common way to name kernel-mode policies before resctrl
can report what is active or what the platform supports.

Introduce enum resctrl_kernel_mode:
  - INHERIT_CTRL_AND_MON: Kernel work inherits allocation and monitoring
    from the user task (current behavior).
  - GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU: Assign allocation for kernel
    work; inherit monitoring from the user task.
  - GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU: Assign a dedicated allocation
    and monitoring for kernel work.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Updated the changelog to be generic as possible.
    Moved the enum resctrl_kernel_mode to include/linux/resctrl.h.
    Updated the code comments to be generic.
    Removed resctrl_kmode_cfg from the code. This definition can be fs
    specific only and architectures dont need to know.
    Changed enum name to resctrl_kernel_mode from resctrl_kernel_modes.

v3: Removed resctrl_kmode definition.
    Changed the kernel mode definitions to enum resctrl_kernel_modes.
    Used BIT() to set/test the features.
    Added details to changelog.

v2: New patch to handle PLZA interfaces with /sys/fs/resctrl/info/ directory.
    https://lore.kernel.org/lkml/2ab556af-095b-422b-9396-f845c6fd0342@intel.com/
---
 include/linux/resctrl.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 73ff522448a0..c7abed51cd5f 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -703,6 +703,37 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable);
  */
 bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r);
 
+/**
+ * enum resctrl_kernel_mode - Kernel-mode control and monitor association
+ *			      policy.
+ *
+ * @INHERIT_CTRL_AND_MON:
+ *	Kernel work inherits the allocation and monitoring from the user space
+ *	task. On x86 this means that kernel work shares the same CLOSID and
+ *	RMID as the user space task. This matches today's resctrl behavior.
+ *
+ * @GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU:
+ *	Kernel work uses a globally assigned allocation while monitoring is
+ *	inherited from the user space task. On x86 this means a CLOSID is
+ *	assigned for kernel work and the RMID is inherited from the user space
+ *	task. Default scope is all online CPUs; a subset may be selected via
+ *	the resctrl group interface. A CTRL_MON group is bound to this mode.
+ *
+ * @GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU:
+ *	Kernel work uses globally assigned allocation and monitoring. On x86
+ *	this means both CLOSID and RMID are assigned for kernel work. Default
+ *	scope is all online CPUs; a subset may be selected via the resctrl
+ *	group interface. A CTRL_MON or MON group is bound to this mode.
+ */
+enum resctrl_kernel_mode {
+	INHERIT_CTRL_AND_MON,
+	GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU,
+	GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
+	RESCTRL_KMODE_LAST = GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
+};
+
+#define RESCTRL_NUM_KERNEL_MODES (RESCTRL_KMODE_LAST + 1)
+
 extern unsigned int resctrl_rmid_realloc_threshold;
 extern unsigned int resctrl_rmid_realloc_limit;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 05/15] x86,fs/resctrl: Introduce architecture hooks to program kernel-mode
  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
                   ` (3 preceding siblings ...)
  2026-07-07 21:50 ` [RESEND PATCH v4 04/15] fs/resctrl: Introduce kernel mode (kmode) data structures Babu Moger
@ 2026-07-07 21:50 ` Babu Moger
  2026-07-08 23:04   ` Moger, Babu
  2026-07-07 21:50 ` [RESEND PATCH v4 06/15] fs/resctrl: Introduce resctrl_set_kmode_support() to initialize supported modes Babu Moger
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Kernel-mode policies defined by enum resctrl_kernel_mode must be applied to
each affected CPU whenever a policy is selected or its scope changes.
Generic resctrl therefore requires an architecture-specific interface to
program allocation and monitoring associations in hardware across a given
CPU mask.

Introduce a helper, resctrl_arch_configure_kmode(),  to handle kernel-mode
programming. On x86/AMD systems, this helper programs the
MSR_IA32_PQR_PLZA_ASSOC register on all online CPUs in the specified mask
via on_each_cpu_mask(). Also provide a no-op stub for MPAM systems.

Generic resctrl does not invoke this hook yet; it will be used when user
space selects a kernel-mode policy or updates the associated CPU set.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Added assign_mon parameter in resctrl_arch_configure_kmode() to program the RMID
    as discussed in below.
    https://lore.kernel.org/lkml/20260605100642.1103628-1-qinyuntan@linux.alibaba.com/
    Changed cpumask type to "const struct cpumask *cpu_mask".
    Added MPAM stub to avoid any linking issues when resctrl_arch_configure_kmode()
    is called from FS layer. Thanks to Qinyun.
    Re-wrote the changelog to be generic.
    Updated code comments.

v3: Removed task based PLZA implementation so related changes are removed.
    Removed handling of rmid_en as it is not required. The group type assigned
    will be different so the monitoring part is already taken care.
    Updated the change log with details.
    Removed resctrl_arch_set_kmode() as arch only provides the modes supported.
    It is FS which decided which mode to apply.

v2: Updated the commit message to include the sequence of steps to enable PLZA.
    Added mode code comments for clarity.
    Added kmode to functin names to be generic.
---
 arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 36 +++++++++++++++++++++++
 drivers/resctrl/mpam_resctrl.c            |  5 ++++
 include/linux/resctrl.h                   | 15 ++++++++++
 3 files changed, 56 insertions(+)

diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index b20e705606b8..025f139434f2 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -131,3 +131,39 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable)
 
 	return 0;
 }
+
+static void resctrl_kmode_set_one_amd(void *arg)
+{
+	union msr_pqr_plza_assoc *plza = arg;
+
+	wrmsrq(MSR_IA32_PQR_PLZA_ASSOC, plza->full);
+}
+
+/*
+ * Program Privilege Level Zero Association (PLZA) on @cpu_mask.
+ *
+ * When @enable is true, CPL 0 allocation traffic on the targeted CPUs uses
+ * @closid from MSR_IA32_PQR_PLZA_ASSOC instead of the CLOSID from
+ * MSR_IA32_PQR_ASSOC. Monitoring is redirected to @rmid only when
+ * @assign_mon is true; otherwise kernel-mode monitoring continues to use the
+ * RMID associated with the current task.
+ *
+ * @cpu_mask:	CPUs whose PLZA MSR should be updated.
+ * @closid:	CLOSID to use for kernel-mode allocation when PLZA is enabled.
+ * @rmid:	RMID to use for kernel-mode monitoring when @assign_mon is true.
+ * @assign_mon:	Whether PLZA should provide the kernel-mode RMID.
+ * @enable:	Whether PLZA should provide the kernel-mode association.
+ */
+void resctrl_arch_configure_kmode(const struct cpumask *cpu_mask, u32 closid, u32 rmid,
+				  bool assign_mon, bool enable)
+{
+	union msr_pqr_plza_assoc plza = { 0 };
+
+	plza.split.rmid = rmid;
+	plza.split.rmid_en = assign_mon;
+	plza.split.closid = closid;
+	plza.split.closid_en = 1;
+	plza.split.plza_en = enable;
+
+	on_each_cpu_mask(cpu_mask, resctrl_kmode_set_one_amd, &plza, 1);
+}
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 226ff6f532fa..630b6cfc0269 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -158,6 +158,11 @@ bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r)
 	return false;
 }
 
+void resctrl_arch_configure_kmode(const struct cpumask *cpu_mask, u32 closid,
+				  u32 rmid, bool assign_mon, bool enable)
+{
+}
+
 void resctrl_arch_pre_mount(void)
 {
 }
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index c7abed51cd5f..47db34dd167e 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -734,6 +734,21 @@ enum resctrl_kernel_mode {
 
 #define RESCTRL_NUM_KERNEL_MODES (RESCTRL_KMODE_LAST + 1)
 
+/**
+ * resctrl_arch_configure_kmode() - Program kernel-mode association on CPUs
+ * @cpu_mask:	CPUs to update; the architecture applies the change on the
+ *		online subset of this mask.
+ * @closid:	Allocation class for kernel-mode traffic. On x86 this is the
+ *		CLOSID programmed when allocation is assigned for kernel work.
+ * @rmid:	Monitoring context for kernel-mode traffic. On x86 this is the
+ *		RMID programmed when monitoring is assigned for kernel work.
+ * @assign_mon:	true to assign @rmid for kernel work; false to inherit
+ *		monitoring from the user task.
+ * @enable:	true to enable kernel-mode association on the targeted CPUs.
+ */
+void resctrl_arch_configure_kmode(const struct cpumask *cpu_mask, u32 closid, u32 rmid,
+				  bool assign_mon, bool enable);
+
 extern unsigned int resctrl_rmid_realloc_threshold;
 extern unsigned int resctrl_rmid_realloc_limit;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 06/15] fs/resctrl: Introduce resctrl_set_kmode_support() to initialize supported modes
  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
                   ` (4 preceding siblings ...)
  2026-07-07 21:50 ` [RESEND PATCH v4 05/15] x86,fs/resctrl: Introduce architecture hooks to program kernel-mode Babu Moger
@ 2026-07-07 21:50 ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 07/15] x86/resctrl: Expose the supported PLZA kernel-mode policies during init Babu Moger
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Architectures need a way to advertise which kernel-mode resctrl policies
they support before generic resctrl exposes those policies through the
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.

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
+ * @kmode:	Bitmap of supported &enum resctrl_kernel_mode values. Each
+ *		supported mode is represented by BIT(mode).
+ * @kmode_cur:	Currently selected kernel-mode policy.
+ * @k_rdtgrp:	Resource group backing global-assign modes when applicable;
+ */
+struct resctrl_kmode_cfg {
+	unsigned long			kmode;
+	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.
+ */
+static struct resctrl_kmode_cfg resctrl_kcfg = {
+	.kmode = BIT(INHERIT_CTRL_AND_MON),
+	.kmode_cur = INHERIT_CTRL_AND_MON,
+	.k_rdtgrp = NULL
+};
+
 /*
  * Memory bandwidth monitoring event to use for the default CTRL_MON group
  * and each new CTRL_MON group created by the user.  Only relevant when
@@ -888,6 +898,19 @@ static int rdtgroup_rmid_show(struct kernfs_open_file *of,
 	return ret;
 }
 
+/**
+ * resctrl_set_kmode_support() - Advertise support for a kernel-mode policy
+ * @kmode:	Kernel-mode policy supported by the architecture.
+ *
+ * Architectures call this during resctrl initialization to make @kmode visible
+ * to the resctrl filesystem. INHERIT_CTRL_AND_MON is always supported.
+ */
+void resctrl_set_kmode_support(enum resctrl_kernel_mode kmode)
+{
+	if (kmode <= RESCTRL_KMODE_LAST)
+		__set_bit(kmode, &resctrl_kcfg.kmode);
+}
+
 #ifdef CONFIG_PROC_CPU_RESCTRL
 /*
  * A task can only be part of one resctrl control group and of one monitor
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 47db34dd167e..8dd02579f354 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -734,6 +734,16 @@ enum resctrl_kernel_mode {
 
 #define RESCTRL_NUM_KERNEL_MODES (RESCTRL_KMODE_LAST + 1)
 
+/**
+ * resctrl_set_kmode_support() - Advertise a supported kernel-mode policy
+ * @kmode:	Kernel-mode policy supported by the architecture.
+ *
+ * Architectures use this during resctrl initialization to make additional
+ * kernel-mode policies available to the filesystem. INHERIT_CTRL_AND_MON is
+ * supported by default and does not need to be registered.
+ */
+void resctrl_set_kmode_support(enum resctrl_kernel_mode kmode);
+
 /**
  * resctrl_arch_configure_kmode() - Program kernel-mode association on CPUs
  * @cpu_mask:	CPUs to update; the architecture applies the change on the
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 07/15] x86/resctrl: Expose the supported PLZA kernel-mode policies during init
  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
                   ` (5 preceding siblings ...)
  2026-07-07 21:50 ` [RESEND PATCH v4 06/15] fs/resctrl: Introduce resctrl_set_kmode_support() to initialize supported modes Babu Moger
@ 2026-07-07 21:50 ` 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
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Generic resctrl exposes kernel-mode policy options via sysfs only after
architectures indicate the set of supported policies using
resctrl_set_kmode_support().

On AMD systems, Privilege Level Zero Association (PLZA) provides two
global assignment modes:

- GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU: Assigns the resource allocation
  for kernel work; but monitoring is inherited from the user task.
- GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU: Assigns a dedicated resource
  allocation and monitoring for kernel work.

Expose these modes during resource discovery when PLZA is available.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: New patch to set the supported features during arch init.
---
 arch/x86/kernel/cpu/resctrl/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 27e09cded829..df7e19fe6007 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -962,6 +962,9 @@ static __init bool get_rdt_alloc_resources(void)
 	if (get_slow_mem_config())
 		ret = true;
 
+	if (ret && rdt_cpu_has(X86_FEATURE_PLZA))
+		resctrl_set_kmode_support(GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU);
+
 	return ret;
 }
 
@@ -988,6 +991,9 @@ static __init bool get_rdt_mon_resources(void)
 	if (!ret)
 		return false;
 
+	if (rdt_cpu_has(X86_FEATURE_PLZA))
+		resctrl_set_kmode_support(GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU);
+
 	return !rdt_get_l3_mon_config(r);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 08/15] fs/resctrl: Add interface to display supported and active kernel-mode policy
  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
                   ` (6 preceding siblings ...)
  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-07 21:50 ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 09/15] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup Babu Moger
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Kernel-mode resctrl policies define how kernel work is associated with
resource allocation and monitoring relative to the user task. Generic
resctrl tracks the supported policies, the active policy, and the resctrl
group backing any global assignment policy. However, this information is
not exposed to user space.

Introduce a new resctrl file, info/kernel_mode, to expose the global
kernel-mode policy and its associated resource group (when applicable).
This read-only sysfs file lists all supported policies, one per line, and
highlights the active policy using square brackets.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Fixed the display of inherit_ctrl_and_mon policy. It is not
    associated with any group.
    Added "uninitialized" for the non-active group.
    Rewrote the changelog.

v3: New patch to handle the changed interface file info/kernel_mode.
    Changed the group name to "none" if kmode binding is not done.
    Reinette suggested "uninitialized". "none" seemed more relevent.
---
 fs/resctrl/rdtgroup.c | 91 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 0ee0dfaf9065..346aa4df62a4 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1012,6 +1012,90 @@ static int rdt_last_cmd_status_show(struct kernfs_open_file *of,
 	return 0;
 }
 
+/* Sysfs lines for info/kernel_mode; indexed by enum resctrl_kernel_mode */
+static const char * const resctrl_mode_str[] = {
+	[INHERIT_CTRL_AND_MON]				= "inherit_ctrl_and_mon",
+	[GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU]	= "global_assign_ctrl_inherit_mon_per_cpu",
+	[GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU]		= "global_assign_ctrl_assign_mon_per_cpu",
+};
+
+static_assert(ARRAY_SIZE(resctrl_mode_str) == RESCTRL_NUM_KERNEL_MODES);
+
+/**
+ * resctrl_kernel_mode_show() - Display supported and active kernel-mode policies
+ * @of: kernfs open file
+ * @seq: output seq_file
+ * @v: unused
+ *
+ * Displays one line per mode set in resctrl_kcfg.kmode. Bracket the active
+ * policy (resctrl_kcfg.kmode_cur).
+ *
+ * INHERIT_CTRL_AND_MON is displayed as "[inherit_ctrl_and_mon]" when active
+ * or "inherit_ctrl_and_mon" when supported but inactive, with no :group=
+ * suffix in either case.
+ *
+ * Global-assign modes append :group=. An inactive mode is emitted as
+ * "<mode>:group=uninitialized". An active mode with a bound group is emitted
+ * as "[<mode>:group=<ctrl>/<mon>/]", where <ctrl>/<mon>/ is derived from
+ * resctrl_kcfg.k_rdtgrp.
+ *
+ * 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)
+{
+	enum resctrl_kernel_mode mode;
+	struct rdtgroup *rdtgrp;
+	const char *ctrl, *mon;
+	bool active;
+	int ret = 0;
+
+	mutex_lock(&rdtgroup_mutex);
+	for (mode = 0; mode < RESCTRL_NUM_KERNEL_MODES; mode++) {
+		if (!test_bit(mode, &resctrl_kcfg.kmode))
+			continue;
+
+		active = (resctrl_kcfg.kmode_cur == mode);
+
+		if (mode == INHERIT_CTRL_AND_MON) {
+			seq_printf(seq, active ? "[%s]\n" : "%s\n",
+				   resctrl_mode_str[mode]);
+			continue;
+		}
+
+		if (!active) {
+			seq_printf(seq, "%s:group=uninitialized\n",
+				   resctrl_mode_str[mode]);
+			continue;
+		}
+
+		/*
+		 * There should be a valid group when any of the global
+		 * assign mode is active; otherwise, report an error.
+		 */
+		rdtgrp = resctrl_kcfg.k_rdtgrp;
+		if (!rdtgrp) {
+			ret = -ENOENT;
+			goto out_unlock;
+		}
+
+		ctrl = "";
+		mon = "";
+		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);
+		}
+		seq_printf(seq, "[%s:group=%s/%s/]\n",
+			   resctrl_mode_str[mode], ctrl, mon);
+	}
+
+out_unlock:
+	mutex_unlock(&rdtgroup_mutex);
+	return ret;
+}
+
 void *rdt_kn_parent_priv(struct kernfs_node *kn)
 {
 	/*
@@ -1915,6 +1999,13 @@ static struct rftype res_common_files[] = {
 		.seq_show	= rdt_last_cmd_status_show,
 		.fflags		= RFTYPE_TOP_INFO,
 	},
+	{
+		.name		= "kernel_mode",
+		.mode		= 0444,
+		.kf_ops		= &rdtgroup_kf_single_ops,
+		.seq_show	= resctrl_kernel_mode_show,
+		.fflags		= RFTYPE_TOP_INFO,
+	},
 	{
 		.name		= "mbm_assign_on_mkdir",
 		.mode		= 0644,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 09/15] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup
  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
                   ` (7 preceding siblings ...)
  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-07-07 21:50 ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 10/15] fs/resctrl: Reset the kernel-mode binding when an rdtgroup is removed Babu Moger
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Kernel-mode resctrl policies allow kernel work to be associated with a
specific rdtgroup, optionally restricted to a subset of online CPUs.

While user space can query the active kernel-mode policy and its associated
rdtgroup through info/kernel_mode, it currently lacks visibility into the
CPU scope of that binding.

Introduce read-only kmode_cpus and kmode_cpus_list files for each rdtgroup.
These expose rdtgrp->kmode_cpu_mask in both bitmap and range-list formats,
consistent with the existing cpus and cpus_list interfaces.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Rewrote the change to be generic.

v3: New patch to add "kmode_cpus" and "kmode_cpus_list" to support
    kernel_modes.
---
 fs/resctrl/internal.h |  4 ++++
 fs/resctrl/rdtgroup.c | 46 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
index 178126bb2da5..12db6933bc54 100644
--- a/fs/resctrl/internal.h
+++ b/fs/resctrl/internal.h
@@ -216,6 +216,8 @@ 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 is bound to a kernel-mode policy
+ * @kmode_cpu_mask:		CPU scope for this group's kernel-mode binding
  * @plr:			pseudo-locked region
  */
 struct rdtgroup {
@@ -229,6 +231,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 346aa4df62a4..0d5c94169d03 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -392,6 +392,37 @@ static int rdtgroup_cpus_show(struct kernfs_open_file *of,
 	return ret;
 }
 
+/*
+ * Display per-rdtgroup CPU bindings for kernel-mode enabled groups.
+ * Supports both "kmode_cpus" (bitmap format) and "kmode_cpus_list"
+ * (range list format); the output format is selected accordingly.
+ *
+ * Returns -ENOENT if the group has been deleted, and -ENODEV for
+ * pseudo-locked groups, which cannot host a kernel-mode binding.
+ */
+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) {
+		if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) {
+			ret = -ENODEV;
+		} else {
+			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,
  *
@@ -2181,6 +2212,21 @@ static struct rftype res_common_files[] = {
 		.flags		= RFTYPE_FLAGS_CPUS_LIST,
 		.fflags		= RFTYPE_BASE,
 	},
+	{
+		.name		= "kmode_cpus",
+		.mode		= 0444,
+		.kf_ops		= &rdtgroup_kf_single_ops,
+		.seq_show	= rdtgroup_kmode_cpus_show,
+		.fflags		= RFTYPE_BASE,
+	},
+	{
+		.name		= "kmode_cpus_list",
+		.mode		= 0444,
+		.kf_ops		= &rdtgroup_kf_single_ops,
+		.seq_show	= rdtgroup_kmode_cpus_show,
+		.flags		= RFTYPE_FLAGS_CPUS_LIST,
+		.fflags		= RFTYPE_BASE,
+	},
 	{
 		.name		= "tasks",
 		.mode		= 0644,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 10/15] fs/resctrl: Reset the kernel-mode binding when an rdtgroup is removed
  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
                   ` (8 preceding siblings ...)
  2026-07-07 21:50 ` [RESEND PATCH v4 09/15] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup Babu Moger
@ 2026-07-07 21:50 ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 11/15] fs/resctrl: Program kernel-mode binding when CPU comes online Babu Moger
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Resctrl keeps track of the rdtgroup backing the active global kernel-mode
policy, including the group's CPU mask used to program kernel-mode
associations.

When that rdtgroup is deleted, resctrl must update both its internal state
and the hardware configuration associated with the group's kmode_cpu_mask.

Introduce rdtgroup_config_kmode_reset() to disable the active kernel-mode
association for the bound group's CPU mask and to clear its kernel-mode
state. Invoke this helper from rdtgroup_kmode_detach(), and reset
resctrl_kcfg to INHERIT_CTRL_AND_MON. Ensure rdtgroup_kmode_detach() is
called during group removal and filesystem teardown, before the bound
rdtgroup is freed.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Re-wrote the changelog.
    Added the call free_all_child_rdtgrp() and rmdir_all_sub()
    Simplified the code comments.

v3: New patch to handle the kernel_mode clean up.
---
 fs/resctrl/rdtgroup.c | 62 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 0d5c94169d03..21659fd75850 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1127,6 +1127,61 @@ static int resctrl_kernel_mode_show(struct kernfs_open_file *of,
 	return ret;
 }
 
+/**
+ * rdtgroup_config_kmode_reset() - Tear down the kernel-mode binding on @rdtgrp
+ * @rdtgrp:	Resctrl group whose kernel-mode binding is being released.
+ *		May be %NULL when no group is currently bound, in which case
+ *		this is a no-op.
+ * @kmode:	Kernel-mode policy currently active on @rdtgrp.
+ *
+ * Reset the kernel-mode binding on the CPUs in @rdtgrp's @kmode_cpu_mask.
+ */
+static void rdtgroup_config_kmode_reset(struct rdtgroup *rdtgrp,
+					enum resctrl_kernel_mode kmode)
+{
+	bool assign_mon = false;
+
+	if (!rdtgrp)
+		return;
+
+	if (kmode == INHERIT_CTRL_AND_MON)
+		goto out_clear;
+
+	if (kmode == GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU)
+		assign_mon = true;
+
+	resctrl_arch_configure_kmode(&rdtgrp->kmode_cpu_mask, rdtgrp->closid,
+				     rdtgrp->mon.rmid, assign_mon, false);
+
+out_clear:
+	cpumask_clear(&rdtgrp->kmode_cpu_mask);
+	rdtgrp->kmode = false;
+}
+
+/**
+ * rdtgroup_kmode_detach() - Detach @rdtgrp from kernel-mode assignment
+ * @rdtgrp: Resctrl group being removed or torn down
+ *
+ * If @rdtgrp is bound to the active kernel-mode assignment, disable the
+ * hardware association programmed for that group and reset the kernel-mode
+ * to INHERIT_CTRL_AND_MON.
+ */
+static void rdtgroup_kmode_detach(struct rdtgroup *rdtgrp)
+{
+	if (!rdtgrp || !rdtgrp->kmode)
+		return;
+
+	if (resctrl_kcfg.k_rdtgrp != rdtgrp) {
+		pr_warn("resctrl: kernel-mode group not valid\n");
+		return;
+	}
+
+	rdtgroup_config_kmode_reset(rdtgrp, resctrl_kcfg.kmode_cur);
+
+	resctrl_kcfg.k_rdtgrp = NULL;
+	resctrl_kcfg.kmode_cur = INHERIT_CTRL_AND_MON;
+}
+
 void *rdt_kn_parent_priv(struct kernfs_node *kn)
 {
 	/*
@@ -3215,6 +3270,7 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp)
 
 	head = &rdtgrp->mon.crdtgrp_list;
 	list_for_each_entry_safe(sentry, stmp, head, mon.crdtgrp_list) {
+		rdtgroup_kmode_detach(sentry);
 		rdtgroup_unassign_cntrs(sentry);
 		free_rmid(sentry->closid, sentry->mon.rmid);
 		list_del(&sentry->mon.crdtgrp_list);
@@ -3252,6 +3308,7 @@ static void rmdir_all_sub(void)
 		cpumask_or(&rdtgroup_default.cpu_mask,
 			   &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask);
 
+		rdtgroup_kmode_detach(rdtgrp);
 		rdtgroup_unassign_cntrs(rdtgrp);
 
 		if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP ||
@@ -3347,6 +3404,7 @@ static void resctrl_fs_teardown(void)
 		return;
 
 	rmdir_all_sub();
+	rdtgroup_kmode_detach(&rdtgroup_default);
 	rdtgroup_unassign_cntrs(&rdtgroup_default);
 	mon_put_kn_priv();
 	rdt_pseudo_lock_release();
@@ -4149,6 +4207,8 @@ static int rdtgroup_rmdir_mon(struct rdtgroup *rdtgrp, cpumask_var_t tmpmask)
 	u32 closid, rmid;
 	int cpu;
 
+	rdtgroup_kmode_detach(rdtgrp);
+
 	/* Give any tasks back to the parent group */
 	rdt_move_group_tasks(rdtgrp, prdtgrp, tmpmask);
 
@@ -4199,6 +4259,8 @@ static int rdtgroup_rmdir_ctrl(struct rdtgroup *rdtgrp, cpumask_var_t tmpmask)
 	u32 closid, rmid;
 	int cpu;
 
+	rdtgroup_kmode_detach(rdtgrp);
+
 	/* Give any tasks back to the default group */
 	rdt_move_group_tasks(rdtgrp, &rdtgroup_default, tmpmask);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 11/15] fs/resctrl: Program kernel-mode binding when CPU comes online
  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
                   ` (9 preceding siblings ...)
  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-07 21:50 ` 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
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Kernel-mode resctrl associations are programmed per CPU. When a
global-assign kernel-mode policy is selected, all CPUs that are online at
that time are configured; however, CPUs that come online later are not
automatically updated.

As a result, hot-added CPUs, or CPUs that were offline when the policy was
selected, can run without the active kernel-mode association even though
the resctrl policy is still in effect.

Add resctrl_kmode_online_cpu() and call it from resctrl_online_cpu(). When
a global-assign policy is active, add the newly online CPU to the bound
group's kmode_cpu_mask and program the kernel-mode association on that CPU.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: New patch in the series. Patch taken from:
    https://lore.kernel.org/lkml/20260611111706.1981788-5-qinyuntan@linux.alibaba.com/
    Updated the code to enable kernel-mode by default whenever a CPU comes online when
    one of global-assign mode is enabled.
---
 fs/resctrl/rdtgroup.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 21659fd75850..413d3ff14546 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -4722,11 +4722,40 @@ int resctrl_online_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *hdr
 	return err;
 }
 
+/*
+ * resctrl_kmode_online_cpu() - Configure kernel-mode binding for a CPU that
+ *				comes online
+ * @cpu: CPU that has just been brought online.
+ *
+ * Kernel-mode associations are maintained per CPU. When a CPU becomes
+ * online after a global-assign policy has been applied, it is updated
+ * with the current kernel-mode configuration. The CPU is then added to
+ * the bound group's kmode_cpu_mask, and the appropriate association is
+ * programmed for it.
+ */
+static void resctrl_kmode_online_cpu(unsigned int cpu)
+{
+	struct rdtgroup *rdtgrp = resctrl_kcfg.k_rdtgrp;
+	bool assign_mon = false;
+
+	if (resctrl_kcfg.kmode_cur == INHERIT_CTRL_AND_MON || !rdtgrp)
+		return;
+
+	assign_mon = (resctrl_kcfg.kmode_cur == GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU);
+
+	cpumask_set_cpu(cpu, &rdtgrp->kmode_cpu_mask);
+
+	resctrl_arch_configure_kmode(cpumask_of(cpu), rdtgrp->closid, rdtgrp->mon.rmid,
+				     assign_mon, true);
+}
+
 void resctrl_online_cpu(unsigned int cpu)
 {
 	mutex_lock(&rdtgroup_mutex);
 	/* The CPU is set in default rdtgroup after online. */
 	cpumask_set_cpu(cpu, &rdtgroup_default.cpu_mask);
+	/* Program any active kernel-mode binding on this CPU. */
+	resctrl_kmode_online_cpu(cpu);
 	mutex_unlock(&rdtgroup_mutex);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 12/15] fs/resctrl: Hide kmode_cpus[_list] on groups not bound to kernel-mode
  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
                   ` (10 preceding siblings ...)
  2026-07-07 21:50 ` [RESEND PATCH v4 11/15] fs/resctrl: Program kernel-mode binding when CPU comes online Babu Moger
@ 2026-07-07 21:50 ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 13/15] fs/resctrl: Add interface to modify kernel-mode via info/kernel_mode Babu Moger
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

kmode_cpus and kmode_cpus_list describe the CPU scope for the rdtgroup that
owns the active kernel-mode binding. They are meaningful only for
resctrl_kcfg.k_rdtgrp.

On groups that do not own the kernel-mode binding, they appear as inactive
stubs and can let user space inspect or update state that does not apply to
that group.

Hide kmode_cpus and kmode_cpus_list on groups that are not bound to
kernel-mode. Keep the files hidden when groups are created, show them when
rdtgroup_config_kmode() binds the group, and hide them again when the
binding is released.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Updated the changelog and code comments.

v3: New patch to hide/show "kmode_cpus" and "kmode_cpus_list" when kernel
    modes binding changes.
---
 fs/resctrl/rdtgroup.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 413d3ff14546..c537846d9264 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1127,6 +1127,35 @@ static int resctrl_kernel_mode_show(struct kernfs_open_file *of,
 	return ret;
 }
 
+/**
+ * resctrl_kmode_files_set_visible() - Toggle visibility of the per-group
+ *		kernel-mode CPU files under @rdtgrp.
+ * @rdtgrp:	Resctrl group whose "kmode_cpus" / "kmode_cpus_list" files
+ *		should be hidden or shown.
+ * @visible:	%true to expose the files, %false to hide them via
+ *		kernfs_show().
+ *
+ * Each file is resolved independently as a sibling under @rdtgrp->kn.
+ * Failures from kernfs_find_and_get() are deliberately ignored, allowing
+ * callers to invoke this before activation, during group creation, or when
+ * the kernel-mode binding is updated.
+ */
+static void resctrl_kmode_files_set_visible(struct rdtgroup *rdtgrp, bool visible)
+{
+	/* Keep in sync with res_common_files[] entries for these files. */
+	static const char * const files[] = { "kmode_cpus", "kmode_cpus_list" };
+	struct kernfs_node *kn;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(files); i++) {
+		kn = kernfs_find_and_get(rdtgrp->kn, files[i]);
+		if (!kn)
+			continue;
+		kernfs_show(kn, visible);
+		kernfs_put(kn);
+	}
+}
+
 /**
  * rdtgroup_config_kmode_reset() - Tear down the kernel-mode binding on @rdtgrp
  * @rdtgrp:	Resctrl group whose kernel-mode binding is being released.
@@ -1155,6 +1184,7 @@ static void rdtgroup_config_kmode_reset(struct rdtgroup *rdtgrp,
 
 out_clear:
 	cpumask_clear(&rdtgrp->kmode_cpu_mask);
+	resctrl_kmode_files_set_visible(rdtgrp, false);
 	rdtgrp->kmode = false;
 }
 
@@ -3068,6 +3098,7 @@ static int rdt_get_tree(struct fs_context *fc)
 	if (ret)
 		goto out_closid_exit;
 
+	resctrl_kmode_files_set_visible(&rdtgroup_default, false);
 	kernfs_activate(rdtgroup_default.kn);
 
 	ret = rdtgroup_create_info_dir(rdtgroup_default.kn);
@@ -4098,6 +4129,7 @@ static int rdtgroup_mkdir_mon(struct kernfs_node *parent_kn,
 		goto out_unlock;
 	}
 
+	resctrl_kmode_files_set_visible(rdtgrp, false);
 	kernfs_activate(rdtgrp->kn);
 
 	/*
@@ -4142,6 +4174,7 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn,
 	if (ret)
 		goto out_closid_free;
 
+	resctrl_kmode_files_set_visible(rdtgrp, false);
 	kernfs_activate(rdtgrp->kn);
 
 	ret = rdtgroup_init_alloc(rdtgrp);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 13/15] fs/resctrl: Add interface to modify kernel-mode via info/kernel_mode
  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
                   ` (11 preceding siblings ...)
  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-07-07 21:50 ` Babu Moger
  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-07 21:50 ` [RESEND PATCH v4 15/15] fs/resctrl: Add documentation on kernel_mode with example Babu Moger
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

info/kernel_mode reports which kernel-mode policies the platform supports
and which one is active, but it is read-only and does not show the rdtgroup
bound to the active kernel-mode policy.

User space needs both pieces to manage kernel-mode assignment: it must be
able to select a policy and bind the global-assign modes to a specific
resctrl group, and it must be able to read back which group is currently
bound.

Make info/kernel_mode writable and extend the read format to identify the
bound group for active global-assign modes.  Inactive global-assign modes
are reported as "group=uninitialized"; INHERIT has no group suffix because
it does not bind an rdtgroup.  Square brackets mark the active mode on read
only and must not be included when writing.

Document the interface in Documentation/filesystems/resctrl.rst.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Rewrote the changelog.
    Moved all the fail path earlier so that failures will retain the old
    binding.
    Taken care of requirement
    assign_mon can be  RDTMON_GROUP or RDTCTRL_GROUP.
    inherit_mon can only be RDTCTRL_GROUP.

v3: New patch to handle the changed interface file info/kernel_mode.
---
 Documentation/filesystems/resctrl.rst |  80 +++++++++
 fs/resctrl/rdtgroup.c                 | 238 +++++++++++++++++++++++++-
 2 files changed, 315 insertions(+), 3 deletions(-)

diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index f3e941404967..5a13814d1325 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -528,6 +528,86 @@ conveyed in the error returns from file operations. E.g.
 	# cat info/last_cmd_status
 	mask f7 has non-consecutive 1-bits
 
+"kernel_mode":
+	In the top level of the "info" directory, "kernel_mode" controls how
+	resource allocation and monitoring work in kernel mode. This is used on
+	some platforms to assign dedicated allocation and/or monitoring to
+	kernel-mode work.
+
+	Reading the file lists supported kernel modes, one per line.  The
+	currently active mode is wrapped in square brackets for display only.
+
+	The modes are displayed in the following format:
+	"<mode>:group=<ctrl>/<mon>/"
+
+	The inherit_ctrl_and_mon mode is shown as "<mode>" with no ":group=" suffix.
+	Inactive global-assign modes report "group=uninitialized".
+
+	The bound group path uses empty components when they do not apply:
+
+	"//":
+		The default (root) control group.
+	"<ctrl>//":
+		The control group named <ctrl>.
+	"/<mon>/":
+		The monitor group named <mon> under the default control group.
+	"<ctrl>/<mon>/":
+		The monitor group named <mon> under the control group named <ctrl>.
+
+	Modes:
+
+	- "inherit_ctrl_and_mon": Kernel work inherits allocation and monitoring
+	  from the current user-space task (default).
+	- "global_assign_ctrl_inherit_mon_per_cpu": A single allocation is
+	  assigned for all kernel work; monitoring is still inherited from user
+	  space.  Requires a CTRL_MON group.
+	- "global_assign_ctrl_assign_mon_per_cpu": A single resource group
+	  supplies both allocation and monitoring for all kernel work.  May be
+	  a CTRL_MON or MON group.
+
+	Only modes supported by the platform are listed on read.
+	Example::
+
+	  # mount -t resctrl resctrl /sys/fs/resctrl
+	  # cd /sys/fs/resctrl
+	  # cat info/kernel_mode
+	  [inherit_ctrl_and_mon]
+	  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
+	  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized
+
+	The modes and binding can be modified by writing to the interface. Writing
+	one line (terminated by a newline) selects the active mode and binds it to
+	a resctrl group.
+
+	Writes must follow the format:
+	"<mode>:group=<ctrl>/<mon>/"
+
+	The ":group=<spec>" suffix is optional; when omitted the default (root)
+	control group is used for global-assign modes. Selecting a new mode or group
+	tears down any active global-assign binding before programming the new one,
+	including when switching between global-assign modes on the same group.
+	The inherit_ctrl_and_mon mode ignores any supplied group and clears the
+	active kernel-mode binding.  The mode must match one of the supported names
+	exactly, and modes not advertised by the platform cannot be set. The
+	display-only "group=uninitialized" form is rejected. Errors are reported in
+	"info/last_cmd_status".
+	Example::
+
+	  # mkdir ctrl1
+	  # echo "global_assign_ctrl_assign_mon_per_cpu:group=ctrl1//" \
+	         > info/kernel_mode
+
+	  # cat info/kernel_mode
+	  inherit_ctrl_and_mon
+	  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
+	  [global_assign_ctrl_assign_mon_per_cpu:group=ctrl1//]
+
+	  # echo "inherit_ctrl_and_mon" > info/kernel_mode
+	  # cat info/kernel_mode
+	  [inherit_ctrl_and_mon]
+	  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
+	  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized
+
 Resource alloc and monitor groups
 =================================
 
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index c537846d9264..7b06c3b3f00e 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1059,7 +1059,8 @@ static_assert(ARRAY_SIZE(resctrl_mode_str) == RESCTRL_NUM_KERNEL_MODES);
  * @v: unused
  *
  * Displays one line per mode set in resctrl_kcfg.kmode. Bracket the active
- * policy (resctrl_kcfg.kmode_cur).
+ * policy (resctrl_kcfg.kmode_cur). Square brackets are display-only; writes
+ * to info/kernel_mode must not include them.
  *
  * INHERIT_CTRL_AND_MON is displayed as "[inherit_ctrl_and_mon]" when active
  * or "inherit_ctrl_and_mon" when supported but inactive, with no :group=
@@ -1068,7 +1069,7 @@ static_assert(ARRAY_SIZE(resctrl_mode_str) == RESCTRL_NUM_KERNEL_MODES);
  * Global-assign modes append :group=. An inactive mode is emitted as
  * "<mode>:group=uninitialized". An active mode with a bound group is emitted
  * as "[<mode>:group=<ctrl>/<mon>/]", where <ctrl>/<mon>/ is derived from
- * resctrl_kcfg.k_rdtgrp.
+ * resctrl_kcfg.k_rdtgrp. The bracketed form is not accepted on write.
  *
  * Return: 0 on success, or -ENOENT on error.
  */
@@ -1164,6 +1165,8 @@ static void resctrl_kmode_files_set_visible(struct rdtgroup *rdtgrp, bool visibl
  * @kmode:	Kernel-mode policy currently active on @rdtgrp.
  *
  * Reset the kernel-mode binding on the CPUs in @rdtgrp's @kmode_cpu_mask.
+ * Called from resctrl_kernel_mode_write() whenever an active global-assign
+ * policy is replaced, including a mode change on the same group.
  */
 static void rdtgroup_config_kmode_reset(struct rdtgroup *rdtgrp,
 					enum resctrl_kernel_mode kmode)
@@ -1212,6 +1215,234 @@ static void rdtgroup_kmode_detach(struct rdtgroup *rdtgrp)
 	resctrl_kcfg.kmode_cur = INHERIT_CTRL_AND_MON;
 }
 
+/**
+ * rdtgroup_config_kmode() - Push @rdtgrp's kernel CLOSID/RMID to hardware
+ * @rdtgrp:	Resctrl group whose CLOSID/RMID should be programmed.
+ * @kmode:	Kernel-mode policy to program for @rdtgrp.
+ *
+ * @rdtgrp carries the CLOSID/RMID to program. For monitor groups, the CLOSID
+ * matches the parent control group while the RMID belongs to the monitor group.
+ *
+ * The caller (resctrl_kernel_mode_write()) is responsible for validating that
+ * the (kmode, group type) pair is permitted before invoking this helper.
+ * This helper records the current online CPUs in @rdtgrp->kmode_cpu_mask and
+ * programs those CPUs with @rdtgrp's CLOSID/RMID.
+ */
+static void rdtgroup_config_kmode(struct rdtgroup *rdtgrp, enum resctrl_kernel_mode kmode)
+{
+	bool assign_mon = (kmode == GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU);
+
+	/* A new binding starts with all currently online CPUs in scope. */
+	cpumask_copy(&rdtgrp->kmode_cpu_mask, cpu_online_mask);
+
+	resctrl_arch_configure_kmode(&rdtgrp->kmode_cpu_mask, rdtgrp->closid,
+				     rdtgrp->mon.rmid, assign_mon, true);
+
+	rdtgrp->kmode = true;
+	resctrl_kmode_files_set_visible(rdtgrp, true);
+}
+
+/**
+ * rdtgroup_by_kmode_path() - Resolve a "<ctrl>/<mon>/" path to an rdtgroup
+ * @ctrl_name:	Control-group name, or "" for the default control group.
+ * @mon_name:	Monitor-group name, or "" to select the control group itself.
+ *
+ * Matches the path syntax emitted by resctrl_kernel_mode_show():
+ *   "//"            - the default control group
+ *   "<ctrl>//"      - control group @ctrl_name
+ *   "/<mon>/"       - monitor group @mon_name under the default control group
+ *   "<ctrl>/<mon>/" - monitor group @mon_name under control group @ctrl_name
+ *
+ * An empty @ctrl_name selects &rdtgroup_default. Otherwise @ctrl_name must
+ * match an existing control group. If @mon_name is empty, the selected control
+ * group is returned; otherwise @mon_name is looked up in the selected control
+ * group's monitor children.
+ *
+ * Return: Pointer to the matching rdtgroup, or NULL if no such group exists.
+ */
+static struct rdtgroup *rdtgroup_by_kmode_path(const char *ctrl_name,
+					       const char *mon_name)
+{
+	struct rdtgroup *rdtg, *parent = &rdtgroup_default;
+
+	if (*ctrl_name) {
+		parent = NULL;
+		list_for_each_entry(rdtg, &rdt_all_groups, rdtgroup_list) {
+			if (rdtg->type != RDTCTRL_GROUP)
+				continue;
+			if (!strcmp(rdt_kn_name(rdtg->kn), ctrl_name)) {
+				parent = rdtg;
+				break;
+			}
+		}
+	}
+	if (!parent)
+		return NULL;
+
+	if (!*mon_name)
+		return parent;
+
+	list_for_each_entry(rdtg, &parent->mon.crdtgrp_list, mon.crdtgrp_list)
+		if (!strcmp(rdt_kn_name(rdtg->kn), mon_name))
+			return rdtg;
+	return NULL;
+}
+
+/**
+ * resctrl_kernel_mode_write() - Select kernel mode and bind group via info/kernel_mode
+ * @of:		kernfs file handle.
+ * @buf:	One line of the form "<mode>[:group=<ctrl>/<mon>/]"; must end
+ *		with a newline. Do not include the square brackets used to mark
+ *		the active mode in resctrl_kernel_mode_show(). Leading and trailing
+ *		whitespace is ignored, as is whitespace between the mode name and
+ *		an optional ":group=" suffix. The ":group=<spec>" suffix is
+ *		optional; when omitted the default control group
+ *		(&rdtgroup_default) is used.
+ * @nbytes:	Length of @buf.
+ * @off:	File offset (unused).
+ *
+ * Parses @buf, validates that <mode> is listed in resctrl_mode_str[] and is
+ * supported by the platform (resctrl_kcfg.kmode), resolves <ctrl>/<mon>/ to
+ * an existing rdtgroup (or picks &rdtgroup_default if no group was specified),
+ * treats INHERIT as an unbound mode, tears down any active global-assign
+ * binding via rdtgroup_config_kmode_reset(), programs hardware via
+ * rdtgroup_config_kmode() when the new mode is not INHERIT_CTRL_AND_MON, and
+ * on success updates resctrl_kcfg.k_rdtgrp and resctrl_kcfg.kmode_cur. The
+ * display-only "group=uninitialized" form is rejected.  Errors are reported
+ * in last_cmd_status.
+ *
+ * Return: @nbytes on success, negative errno with last_cmd_status set on error.
+ */
+static ssize_t resctrl_kernel_mode_write(struct kernfs_open_file *of,
+					 char *buf, size_t nbytes, loff_t off)
+{
+	enum resctrl_kernel_mode mode;
+	char *mode_str, *group_str, *slash;
+	const char *ctrl_name, *mon_name;
+	struct rdtgroup *rdtgrp;
+	int ret = 0;
+
+	if (nbytes == 0 || buf[nbytes - 1] != '\n')
+		return -EINVAL;
+	buf[nbytes - 1] = '\0';
+
+	/* Tolerate surrounding whitespace before mode parsing. */
+	buf = strim(buf);
+
+	/*
+	 * Split "<mode>:group=<spec>"; the ":group=<spec>" suffix is optional
+	 * and when omitted the default control group (&rdtgroup_default) is used.
+	 * Trim mode_str after the split so whitespace before ":group=" is ignored.
+	 * Square brackets from resctrl_kernel_mode_show() are not accepted.
+	 */
+	group_str = strstr(buf, ":group=");
+	if (group_str) {
+		*group_str = '\0';
+		group_str += strlen(":group=");
+	}
+	mode_str = strim(buf);
+
+	mutex_lock(&rdtgroup_mutex);
+	rdt_last_cmd_clear();
+
+	for (mode = 0; mode < RESCTRL_NUM_KERNEL_MODES; mode++)
+		if (!strcmp(mode_str, resctrl_mode_str[mode]))
+			break;
+
+	if (mode == RESCTRL_NUM_KERNEL_MODES) {
+		rdt_last_cmd_puts("Unknown kernel mode\n");
+		ret = -EINVAL;
+		goto out_unlock;
+	}
+
+	if (!(test_bit(mode, &resctrl_kcfg.kmode))) {
+		rdt_last_cmd_puts("Kernel mode not available\n");
+		ret = -EINVAL;
+		goto out_unlock;
+	}
+
+	/*
+	 * INHERIT mode binds no rdtgroup. Ignore any user-supplied :group=
+	 * suffix and let show print the mode without a group.
+	 */
+	if (mode == INHERIT_CTRL_AND_MON) {
+		rdtgrp = NULL;
+		goto update_mode;
+	}
+
+	if (!group_str) {
+		/* No ":group=" suffix: fall back to the default control group. */
+		rdtgrp = &rdtgroup_default;
+	} else if (!strcmp(group_str, "uninitialized")) {
+		/* Display-only placeholder emitted by show; not selectable. */
+		rdt_last_cmd_puts("Cannot bind to 'uninitialized' group\n");
+		ret = -EINVAL;
+		goto out_unlock;
+	} else {
+		/* Require exactly "<ctrl>/<mon>/" format */
+		slash = strchr(group_str, '/');
+		if (!slash) {
+			rdt_last_cmd_puts("Group must be <ctrl>/<mon>/\n");
+			ret = -EINVAL;
+			goto out_unlock;
+		}
+		*slash = '\0';
+		ctrl_name = group_str;
+		mon_name = slash + 1;
+		slash = strchr(mon_name, '/');
+		if (!slash || slash[1] != '\0') {
+			rdt_last_cmd_puts("Group must be <ctrl>/<mon>/\n");
+			ret = -EINVAL;
+			goto out_unlock;
+		}
+		*slash = '\0';
+
+		rdtgrp = rdtgroup_by_kmode_path(ctrl_name, mon_name);
+		if (!rdtgrp) {
+			rdt_last_cmd_puts("Group not found\n");
+			ret = -EINVAL;
+			goto out_unlock;
+		}
+	}
+
+	if (mode == GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU &&
+	    rdtgrp->type != RDTCTRL_GROUP) {
+		rdt_last_cmd_puts("global_assign_ctrl_inherit_mon_per_cpu requires a control group\n");
+		ret = -EINVAL;
+		goto out_unlock;
+	}
+
+	if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED ||
+	    rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
+		rdt_last_cmd_puts("Pseudo-locking in progress\n");
+		ret = -EINVAL;
+		goto out_unlock;
+	}
+
+update_mode:
+	/* No-op if the same mode is already active on the same group. */
+	if (resctrl_kcfg.kmode_cur == mode && resctrl_kcfg.k_rdtgrp == rdtgrp)
+		goto out_unlock;
+
+	/*
+	 * Tear down any active global-assign binding before applying the new
+	 * policy, including when only the mode changes on the same group.
+	 */
+	if (resctrl_kcfg.kmode_cur != INHERIT_CTRL_AND_MON)
+		rdtgroup_config_kmode_reset(resctrl_kcfg.k_rdtgrp,
+					    resctrl_kcfg.kmode_cur);
+
+	if (mode != INHERIT_CTRL_AND_MON)
+		rdtgroup_config_kmode(rdtgrp, mode);
+
+	resctrl_kcfg.k_rdtgrp = rdtgrp;
+	resctrl_kcfg.kmode_cur = mode;
+
+out_unlock:
+	mutex_unlock(&rdtgroup_mutex);
+	return ret ?: nbytes;
+}
+
 void *rdt_kn_parent_priv(struct kernfs_node *kn)
 {
 	/*
@@ -2117,9 +2348,10 @@ static struct rftype res_common_files[] = {
 	},
 	{
 		.name		= "kernel_mode",
-		.mode		= 0444,
+		.mode		= 0644,
 		.kf_ops		= &rdtgroup_kf_single_ops,
 		.seq_show	= resctrl_kernel_mode_show,
+		.write		= resctrl_kernel_mode_write,
 		.fflags		= RFTYPE_TOP_INFO,
 	},
 	{
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 14/15] fs/resctrl: Allow user space to write kmode_cpus/kmode_cpus_list
  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
                   ` (12 preceding siblings ...)
  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-07 21:50 ` Babu Moger
  2026-07-07 21:50 ` [RESEND PATCH v4 15/15] fs/resctrl: Add documentation on kernel_mode with example Babu Moger
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

kmode_cpus and kmode_cpus_list expose the CPU scope for the rdtgroup bound
to the active kernel-mode policy. They are currently read-only, so changing
the scope requires rebinding through info/kernel_mode, which reprograms the
whole binding instead of only the CPUs whose state changes.

Make kmode_cpus and kmode_cpus_list writable. Parse writes as a bitmap or
CPU range list. Reject pseudo-locked and pseudo-lock-setup groups, writes
to a group other than resctrl_kcfg.k_rdtgrp (including stale file
descriptors left open across an info/kernel_mode change), malformed input,
and masks that name offline CPUs.

Update the bound group's kmode_cpu_mask and reprogram hardware
incrementally: disable kernel-mode association on CPUs in the old mask but
not the new mask, and enable it on CPUs in the new mask but not the old
mask.

Document the interface in Documentation/filesystems/resctrl.rst.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: Empty masks are now allowed and updated masks are in rdtgroup->kmode_cpu_mask.
    Updated the changelog.

v3: New patch to add "kmode_cpus" and "kmode_cpus_list" to support
    kernel_modes.
---
 Documentation/filesystems/resctrl.rst |  30 +++++
 fs/resctrl/rdtgroup.c                 | 151 +++++++++++++++++++++++++-
 2 files changed, 179 insertions(+), 2 deletions(-)

diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index 5a13814d1325..4a2bdd74d4aa 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -676,6 +676,36 @@ All groups contain the following files:
 "cpus_list":
 	Just like "cpus", only using ranges of CPUs instead of bitmasks.
 
+"kmode_cpus":
+	Visible only on the rdtgroup currently bound to the active kernel
+	mode (see "info/kernel_mode"); hidden on every other rdtgroup,
+	including when "inherit_ctrl_and_mon" is active.
+
+	Bitmask of the logical CPUs scoped for this group's kernel-mode
+	binding.  At bind time through info/kernel_mode, every currently
+	online CPU is included in the scope.  CPUs that come online later
+	are automatically added to the scope and programmed with the binding.
+
+	Writing a mask reprograms the binding incrementally: it enables on
+	the CPUs newly added by the write and disables on the CPUs dropped
+	from the previous mask.  An empty mask disables the binding on all
+	CPUs in the current scope.  The mask must contain only online CPUs;
+	masks naming offline CPUs are rejected.
+	Errors are reported in "info/last_cmd_status".  Example::
+
+	  # mkdir ctrl1
+	  # echo "global_assign_ctrl_inherit_mon_per_cpu:group=ctrl1//" \
+	        > info/kernel_mode
+	  # echo 0-3 > ctrl1/kmode_cpus_list
+	  # cat ctrl1/kmode_cpus
+	  f
+	  # cat ctrl1/kmode_cpus_list
+	  0-3
+
+"kmode_cpus_list":
+	Just like "kmode_cpus", only using ranges of CPUs instead of bitmasks.
+	Writable with the same semantics and restrictions as "kmode_cpus".
+
 
 When control is enabled all CTRL_MON groups will also contain:
 
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 7b06c3b3f00e..8ecd107368b3 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -423,6 +423,151 @@ static int rdtgroup_kmode_cpus_show(struct kernfs_open_file *of,
 	return ret;
 }
 
+/**
+ * kmode_cpus_write() - Update @rdtgrp's kmode_cpu_mask from @newmask
+ * @rdtgrp:	Resctrl group whose kmode_cpu_mask is being updated.
+ * @kmode:	Kernel-mode policy currently active on @rdtgrp.
+ * @newmask:	Set of online CPUs scoped for @rdtgrp's kernel-mode binding.
+ * @tmpmask:	Caller-allocated scratch cpumask used to compute the
+ *		incremental enable/disable deltas; contents on entry are
+ *		ignored and on return are unspecified.
+ *
+ * Compute the difference between @rdtgrp->kmode_cpu_mask and @newmask
+ * and call resctrl_arch_configure_kmode() only on the CPUs whose enable
+ * state actually changes:
+ *
+ *   - disable on (old & ~new)
+ *   - enable on (new & ~old)
+ *
+ * Then copy @newmask into @rdtgrp->kmode_cpu_mask so subsequent
+ * show/write operations reflect the updated scope.
+ */
+static void kmode_cpus_write(struct rdtgroup *rdtgrp, enum resctrl_kernel_mode kmode,
+			     cpumask_var_t newmask, cpumask_var_t tmpmask)
+{
+	bool assign_mon = (kmode == GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU);
+	u32 closid, rmid;
+
+	closid = rdtgrp->closid;
+	rmid = rdtgrp->mon.rmid;
+
+	/* CPUs dropped from this group: old & ~newmask. */
+	cpumask_andnot(tmpmask, &rdtgrp->kmode_cpu_mask, newmask);
+	if (!cpumask_empty(tmpmask))
+		resctrl_arch_configure_kmode(tmpmask, closid, rmid, assign_mon, false);
+
+	/* CPUs newly added: newmask & ~old. */
+	cpumask_andnot(tmpmask, newmask, &rdtgrp->kmode_cpu_mask);
+	if (!cpumask_empty(tmpmask))
+		resctrl_arch_configure_kmode(tmpmask, closid, rmid, assign_mon, true);
+
+	cpumask_copy(&rdtgrp->kmode_cpu_mask, newmask);
+}
+
+/**
+ * rdtgroup_kmode_cpus_write() - Sysfs write handler for kmode_cpus[_list]
+ * @of:		kernfs open file (selects bitmap vs range-list parsing via
+ *		is_cpu_list()).
+ * @buf:	NUL-terminated input from userspace.
+ * @nbytes:	Length of @buf, returned on success.
+ * @off:	File offset (unused).
+ *
+ * Parses @buf into a cpumask and rejects:
+ *   - pseudo-locked / pseudo-lock-setup groups,
+ *   - writes when INHERIT_CTRL_AND_MON is active or to a group other than
+ *     resctrl_kcfg.k_rdtgrp (stale fds opened before an info/kernel_mode
+ *     change),
+ *   - malformed input,
+ *   - masks containing offline CPUs.
+ *
+ * Validated masks are passed to kmode_cpus_write() to update
+ * @rdtgrp->kmode_cpu_mask and reprogram hardware incrementally.
+ * Errors are reported in last_cmd_status.
+ *
+ * Return: @nbytes on success, -ENOENT if the group has been deleted,
+ * -EINVAL for pseudo-locked or pseudo-lock-setup groups, malformed input, or
+ * offline CPUs in the requested mask, -EBUSY if INHERIT_CTRL_AND_MON is active
+ * or the group is not resctrl_kcfg.k_rdtgrp, and -ENOMEM if the scratch
+ * cpumasks cannot be allocated.
+ */
+static ssize_t rdtgroup_kmode_cpus_write(struct kernfs_open_file *of,
+					 char *buf, size_t nbytes, loff_t off)
+{
+	cpumask_var_t tmpmask, newmask;
+	struct rdtgroup *rdtgrp;
+	int ret;
+
+	if (!buf)
+		return -EINVAL;
+
+	if (!zalloc_cpumask_var(&tmpmask, GFP_KERNEL))
+		return -ENOMEM;
+	if (!zalloc_cpumask_var(&newmask, GFP_KERNEL)) {
+		free_cpumask_var(tmpmask);
+		return -ENOMEM;
+	}
+
+	rdtgrp = rdtgroup_kn_lock_live(of->kn);
+	if (!rdtgrp) {
+		ret = -ENOENT;
+		goto unlock;
+	}
+
+	rdt_last_cmd_clear();
+
+	if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED ||
+	    rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
+		ret = -EINVAL;
+		rdt_last_cmd_puts("Pseudo-locked group cannot host kernel-mode binding\n");
+		goto unlock;
+	}
+
+	if (resctrl_kcfg.kmode_cur == INHERIT_CTRL_AND_MON) {
+		ret = -EBUSY;
+		rdt_last_cmd_puts("No active kernel-mode binding\n");
+		goto unlock;
+	}
+
+	/*
+	 * The visibility layer (kernfs_show()) prevents fresh open() on a
+	 * non-bound group, but file descriptors opened while the group was
+	 * bound stay valid across an info/kernel_mode change.  Reject those
+	 * stale-fd writes so they cannot corrupt the now-active binding.
+	 */
+	if (resctrl_kcfg.k_rdtgrp != rdtgrp) {
+		ret = -EBUSY;
+		rdt_last_cmd_puts("Group is not the active kernel-mode binding\n");
+		goto unlock;
+	}
+
+	if (is_cpu_list(of))
+		ret = cpulist_parse(buf, newmask);
+	else
+		ret = cpumask_parse(buf, newmask);
+
+	if (ret) {
+		rdt_last_cmd_puts("Bad CPU list/mask\n");
+		goto unlock;
+	}
+
+	/* kernel-mode binding is only programmed on online CPUs. */
+	cpumask_andnot(tmpmask, newmask, cpu_online_mask);
+	if (!cpumask_empty(tmpmask)) {
+		ret = -EINVAL;
+		rdt_last_cmd_puts("Can only assign online CPUs\n");
+		goto unlock;
+	}
+
+	kmode_cpus_write(rdtgrp, resctrl_kcfg.kmode_cur, newmask, tmpmask);
+
+unlock:
+	rdtgroup_kn_unlock(of->kn);
+	free_cpumask_var(tmpmask);
+	free_cpumask_var(newmask);
+
+	return ret ?: nbytes;
+}
+
 /*
  * Update the PGR_ASSOC MSR on all cpus in @cpu_mask,
  *
@@ -2531,15 +2676,17 @@ static struct rftype res_common_files[] = {
 	},
 	{
 		.name		= "kmode_cpus",
-		.mode		= 0444,
+		.mode		= 0644,
 		.kf_ops		= &rdtgroup_kf_single_ops,
+		.write		= rdtgroup_kmode_cpus_write,
 		.seq_show	= rdtgroup_kmode_cpus_show,
 		.fflags		= RFTYPE_BASE,
 	},
 	{
 		.name		= "kmode_cpus_list",
-		.mode		= 0444,
+		.mode		= 0644,
 		.kf_ops		= &rdtgroup_kf_single_ops,
+		.write		= rdtgroup_kmode_cpus_write,
 		.seq_show	= rdtgroup_kmode_cpus_show,
 		.flags		= RFTYPE_FLAGS_CPUS_LIST,
 		.fflags		= RFTYPE_BASE,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [RESEND PATCH v4 15/15] fs/resctrl: Add documentation on kernel_mode with example
  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
                   ` (13 preceding siblings ...)
  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-07 21:50 ` Babu Moger
  14 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-07 21:50 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, babu.moger, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

The kernel-mode resctrl interface now includes multiple related controls:
info/kernel_mode selects the active kernel-mode policy and bound rdtgroup,
while kmode_cpus and kmode_cpus_list adjust the CPU scope for that binding.

The individual file descriptions document the formats and error cases, but
there is no end-to-end example showing how user space should discover the
supported policies, bind kernel-mode allocation or monitoring to a group,
adjust the CPU scope, and return to the default inherit mode.

Add an "Examples on working with kernel_mode" section to
Documentation/filesystems/resctrl.rst.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v4: New patch. Added examples in the documentation.
---
 Documentation/filesystems/resctrl.rst | 84 +++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index 4a2bdd74d4aa..e9f7048a62e2 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -1891,6 +1891,90 @@ View the llc occupancy snapshot::
   11234000
 
 
+Examples on working with kernel_mode
+====================================
+
+The resctrl file, ``info/kernel_mode``, holds the global policy for
+resource allocation and monitoring of kernel work and the resource group
+(when applicable) associated with the policy. The bound group's
+``kmode_cpus`` and ``kmode_cpus_list`` files adjust the CPU scope for that
+binding when a global-assign policy is active.
+
+a. Check the kernel-mode policies supported by the platform.
+::
+
+  # mount -t resctrl resctrl /sys/fs/resctrl/
+
+  # cat /sys/fs/resctrl/info/kernel_mode
+  [inherit_ctrl_and_mon]
+  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
+  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized
+
+The "inherit_ctrl_and_mon" policy is active. Kernel work inherits the
+resource allocation and monitoring of the current user-space task.
+
+b. Create a CTRL_MON group and bind kernel-mode allocation to it.
+::
+
+  # mkdir /sys/fs/resctrl/ctrl1
+  # 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
+  [global_assign_ctrl_inherit_mon_per_cpu:group=ctrl1//]
+  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized
+
+The "global_assign_ctrl_inherit_mon_per_cpu" policy globally assigns resource
+allocation for kernel work; monitoring is inherited from the user task.
+The group path format is "<ctrl>/<mon>/". A control group has no monitor
+group component, so it is written as "ctrl1//". When a global-assign policy is
+selected, the bound group's "kmode_cpus" and "kmode_cpus_list" files become
+visible.
+
+c. Restrict the kernel-mode binding to CPUs 0-3.
+::
+
+  # echo 0-3 > /sys/fs/resctrl/ctrl1/kmode_cpus_list
+  # cat /sys/fs/resctrl/ctrl1/kmode_cpus
+  f
+  # cat /sys/fs/resctrl/ctrl1/kmode_cpus_list
+  0-3
+
+The write updates the CPU scope incrementally. CPUs added to the mask have the
+kernel-mode association enabled, and CPUs removed from the mask have it
+disabled. The mask must not name offline CPUs.
+
+d. Bind kernel-mode allocation and monitoring to a monitor group.
+::
+
+  # mkdir /sys/fs/resctrl/ctrl1/mon_groups/mon1
+  # echo "global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/" > \
+        /sys/fs/resctrl/info/kernel_mode
+
+  # cat /sys/fs/resctrl/info/kernel_mode
+  inherit_ctrl_and_mon
+  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
+  [global_assign_ctrl_assign_mon_per_cpu:group=ctrl1/mon1/]
+
+The "global_assign_ctrl_assign_mon_per_cpu" policy assigns a dedicated
+resource allocation and monitoring for kernel work.  Rebinding through
+info/kernel_mode resets the CPU scope to all currently online CPUs, and
+the "kmode_cpus" and "kmode_cpus_list" files move from ctrl1 to mon1.
+
+e. Return to the default inherit mode.
+::
+
+  # echo "inherit_ctrl_and_mon" > /sys/fs/resctrl/info/kernel_mode
+  # cat /sys/fs/resctrl/info/kernel_mode
+  [inherit_ctrl_and_mon]
+  global_assign_ctrl_inherit_mon_per_cpu:group=uninitialized
+  global_assign_ctrl_assign_mon_per_cpu:group=uninitialized
+
+Switching back to "inherit_ctrl_and_mon" clears the active kernel-mode
+binding. The "kmode_cpus" and "kmode_cpus_list" files are hidden again because
+no rdtgroup owns kernel-mode.
+
 Examples on working with mbm_assign_mode
 ========================================
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  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 16:55   ` Babu Moger
  1 sibling, 1 reply; 27+ messages in thread
From: Borislav Petkov @ 2026-07-07 22:01 UTC (permalink / raw)
  To: Babu Moger
  Cc: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, ben.horgan, fenghuay, skhan, x86, mingo, dave.hansen, hpa,
	akpm, rdunlap, peterz, feng.tang, dapeng1.mi, elver, enelsonmoore,
	kuba, ebiggers, lirongqing, seanjc, nikunj, xin,
	pawan.kumar.gupta, tiala, chang.seok.bae, kprateek.nayak,
	prathyushi.nangia, kim.phillips, naveen, darwi, elena.reshetova,
	linux-doc, linux-kernel, thomas.lendacky, eranian, peternewman,
	qinyuntan

On Tue, Jul 07, 2026 at 04:50:02PM -0500, Babu Moger wrote:
> Customers have identified an issue while using the QoS resource control

Please drop the "customers" speak from kernel code.

> feature. If memory bandwidth associated with a CLOSID is aggressively
> throttled, and a task with that CLOSID moves into kernel mode, the kernel
> operations are also aggressively throttled. This can stall forward progress
> and eventually degrade overall system performance.
> 
> AMD hardware supports a feature Privilege Level Zero Association (PLZA),
> which allows the CPU's CLOSID association to be changed during the
> transition from user mode to kernel mode. This allows the kernel to run
> using a different CLOSID than user space, which can improve system
> performance in certain scenarios.
> 
> The feature is detected via CPUID_Fn80000020_EBX_x00 [Bit 9]:
> Privilege Level Zero Association (PLZA).
> 
> The PLZA feature details are documented in [1] available from [2].
> 
> [1] AMD64 Zen6 Platform Quality of Service (PQOS) Extensions:
>     Publication # 69193 Revision: 1.00, Issue Date: March 2026
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v4: Split the patch into 2. This patch only handles x86 changes.
>     Re-wrote the changelog along the ABMC changes.
> 
> v3: Code did not change. Patch order changed.
>     Added documentation link.
> 
> v2: Rebased on top of the latest tip.
> ---
>  arch/x86/include/asm/cpufeatures.h | 1 +
>  arch/x86/kernel/cpu/scattered.c    | 1 +
>  2 files changed, 2 insertions(+)

With that addressed:

Acked-by: Borislav Petkov (AMD) <bp@alien8.de>

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  2026-07-07 22:01   ` Borislav Petkov
@ 2026-07-08 14:51     ` Babu Moger
  2026-07-08 17:27       ` Borislav Petkov
  0 siblings, 1 reply; 27+ messages in thread
From: Babu Moger @ 2026-07-08 14:51 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, ben.horgan, fenghuay, skhan, x86, mingo, dave.hansen, hpa,
	akpm, rdunlap, peterz, feng.tang, dapeng1.mi, elver, enelsonmoore,
	kuba, ebiggers, lirongqing, seanjc, nikunj, xin,
	pawan.kumar.gupta, tiala, chang.seok.bae, kprateek.nayak,
	prathyushi.nangia, kim.phillips, naveen, darwi, elena.reshetova,
	linux-doc, linux-kernel, thomas.lendacky, eranian, peternewman,
	qinyuntan

Hi Boris,

On 7/7/26 17:01, Borislav Petkov wrote:
> On Tue, Jul 07, 2026 at 04:50:02PM -0500, Babu Moger wrote:
>> Customers have identified an issue while using the QoS resource control
> 
> Please drop the "customers" speak from kernel code.

Will change the text to:

When memory bandwidth associated with a CLOSID is aggressively
throttled, and a task with that CLOSID moves into kernel mode, the 
kernel operations are also aggressively throttled. This can stall 
forward progress and eventually degrade overall system performance.


> 
>> feature. If memory bandwidth associated with a CLOSID is aggressively
>> throttled, and a task with that CLOSID moves into kernel mode, the kernel
>> operations are also aggressively throttled. This can stall forward progress
>> and eventually degrade overall system performance.
>>
>> AMD hardware supports a feature Privilege Level Zero Association (PLZA),
>> which allows the CPU's CLOSID association to be changed during the
>> transition from user mode to kernel mode. This allows the kernel to run
>> using a different CLOSID than user space, which can improve system
>> performance in certain scenarios.
>>
>> The feature is detected via CPUID_Fn80000020_EBX_x00 [Bit 9]:
>> Privilege Level Zero Association (PLZA).
>>
>> The PLZA feature details are documented in [1] available from [2].
>>
>> [1] AMD64 Zen6 Platform Quality of Service (PQOS) Extensions:
>>      Publication # 69193 Revision: 1.00, Issue Date: March 2026
>>
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
>> v4: Split the patch into 2. This patch only handles x86 changes.
>>      Re-wrote the changelog along the ABMC changes.
>>
>> v3: Code did not change. Patch order changed.
>>      Added documentation link.
>>
>> v2: Rebased on top of the latest tip.
>> ---
>>   arch/x86/include/asm/cpufeatures.h | 1 +
>>   arch/x86/kernel/cpu/scattered.c    | 1 +
>>   2 files changed, 2 insertions(+)
> 
> With that addressed:
> 
> Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
> 

Thanks
Babu

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  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 16:55   ` Babu Moger
  2026-07-08 23:28     ` Borislav Petkov
  1 sibling, 1 reply; 27+ messages in thread
From: Babu Moger @ 2026-07-08 16:55 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, mingo, dave.hansen, hpa, akpm, rdunlap, peterz,
	feng.tang, dapeng1.mi, elver, enelsonmoore, kuba, ebiggers,
	lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta, tiala,
	chang.seok.bae, kprateek.nayak, prathyushi.nangia, kim.phillips,
	naveen, darwi, elena.reshetova, linux-doc, linux-kernel,
	thomas.lendacky, eranian, peternewman, qinyuntan



On 7/7/26 16:50, Babu Moger wrote:
> Customers have identified an issue while using the QoS resource control
> feature. If memory bandwidth associated with a CLOSID is aggressively
> throttled, and a task with that CLOSID moves into kernel mode, the kernel
> operations are also aggressively throttled. This can stall forward progress
> and eventually degrade overall system performance.
> 
> AMD hardware supports a feature Privilege Level Zero Association (PLZA),
> which allows the CPU's CLOSID association to be changed during the
> transition from user mode to kernel mode. This allows the kernel to run
> using a different CLOSID than user space, which can improve system
> performance in certain scenarios.
> 
> The feature is detected via CPUID_Fn80000020_EBX_x00 [Bit 9]:
> Privilege Level Zero Association (PLZA).
> 
> The PLZA feature details are documented in [1] available from [2].
> 
> [1] AMD64 Zen6 Platform Quality of Service (PQOS) Extensions:
>      Publication # 69193 Revision: 1.00, Issue Date: March 2026
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v4: Split the patch into 2. This patch only handles x86 changes.
>      Re-wrote the changelog along the ABMC changes.
> 
> v3: Code did not change. Patch order changed.
>      Added documentation link.
> 
> v2: Rebased on top of the latest tip.
> ---
>   arch/x86/include/asm/cpufeatures.h | 1 +
>   arch/x86/kernel/cpu/scattered.c    | 1 +
>   2 files changed, 2 insertions(+)
> 
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index 1b4a48bff18f..bf6fc71f87fa 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -517,6 +517,7 @@
>   						      * and purposes if CLEAR_CPU_BUF_VM is set).
>   						      */
>   #define X86_FEATURE_X2AVIC_EXT		(21*32+20) /* AMD SVM x2AVIC support for 4k vCPUs */
> +#define X86_FEATURE_PLZA		(21*32+21) /* Privilege Level Zero Association */
>   
>   /*
>    * BUG word(s)
> diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
> index 937129ce6a96..1fa4d5aef17e 100644
> --- a/arch/x86/kernel/cpu/scattered.c
> +++ b/arch/x86/kernel/cpu/scattered.c
> @@ -61,6 +61,7 @@ static const struct cpuid_bit cpuid_bits[] = {
>   	{ X86_FEATURE_BMEC,			CPUID_EBX,  3, 0x80000020, 0 },
>   	{ X86_FEATURE_ABMC,			CPUID_EBX,  5, 0x80000020, 0 },
>   	{ X86_FEATURE_SDCIAE,			CPUID_EBX,  6, 0x80000020, 0 },
> +	{ X86_FEATURE_PLZA,			CPUID_EBX,  9, 0x80000020, 0 },
>   	{ X86_FEATURE_TSA_SQ_NO,		CPUID_ECX,  1, 0x80000021, 0 },
>   	{ X86_FEATURE_TSA_L1_NO,		CPUID_ECX,  2, 0x80000021, 0 },
>   	{ X86_FEATURE_AMD_WORKLOAD_CLASS,	CPUID_EAX, 22, 0x80000021, 0 },

Sashiko reported:

--- Patch [1]: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege 
Level Zero Association (PLZA) ---
commit 0f2aa093b81d7a2e0dc203ce3466562f708898df
Author: Babu Moger <babu.moger@amd.com>
x86/resctrl: Support Privilege Level Zero Association (PLZA)
This commit adds support for AMD's Privilege Level Zero Association (PLZA)
feature. It detects the feature via CPUID_Fn80000020_EBX_x00 [Bit 9] and
adds the corresponding feature flag to the x86 cpufeatures array.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
 > diff --git a/arch/x86/include/asm/cpufeatures.h 
b/arch/x86/include/asm/cpufeatures.h
 > index 1b4a48bff18f7..bf6fc71f87fab 100644
 > --- a/arch/x86/include/asm/cpufeatures.h
 > +++ b/arch/x86/include/asm/cpufeatures.h
 > @@ -517,6 +517,7 @@
 >  						      * and purposes if CLEAR_CPU_BUF_VM is set).
 >  						      */
 >  #define X86_FEATURE_X2AVIC_EXT		(21*32+20) /* AMD SVM x2AVIC support 
for 4k vCPUs */
 > +#define X86_FEATURE_PLZA		(21*32+21) /* Privilege Level Zero 
Association */
Should this addition also be mirrored in the tools directory copies of
cpufeatures.h and kcpuid.csv?
If tools/arch/x86/include/asm/cpufeatures.h is not updated to match, 
tools like
perf can generate build warnings during check-headers.sh verification. Also,
without updating tools/arch/x86/kcpuid/cpuid.csv, the kcpuid tool will be
unaware of the new PLZA feature bit when users query CPU capabilities.


I thought tools/arch/x86/include/asm/cpufeatures.h would be synced after 
the changes to arch/x86/include/asm/cpufeatures.h are merged. Has that 
process changed?

If the expectation is to update tools/arch/x86/include/asm/cpufeatures.h 
as part of this patch, I can add those changes as well.

Thanks,
Babu


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  2026-07-08 14:51     ` Babu Moger
@ 2026-07-08 17:27       ` Borislav Petkov
  0 siblings, 0 replies; 27+ messages in thread
From: Borislav Petkov @ 2026-07-08 17:27 UTC (permalink / raw)
  To: Babu Moger
  Cc: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, ben.horgan, fenghuay, skhan, x86, mingo, dave.hansen, hpa,
	akpm, rdunlap, peterz, feng.tang, dapeng1.mi, elver, enelsonmoore,
	kuba, ebiggers, lirongqing, seanjc, nikunj, xin,
	pawan.kumar.gupta, tiala, chang.seok.bae, kprateek.nayak,
	prathyushi.nangia, kim.phillips, naveen, darwi, elena.reshetova,
	linux-doc, linux-kernel, thomas.lendacky, eranian, peternewman,
	qinyuntan

On July 8, 2026 2:51:02 PM UTC, Babu Moger <babu.moger@amd.com> wrote:
>Will change the text to:
>
>When memory bandwidth associated with a CLOSID is aggressively
>throttled, and a task with that CLOSID moves into kernel mode, the kernel operations are also aggressively throttled. This can stall forward progress and eventually degrade overall system performance.

Yes, pls keep it generic. 

Thx.

-- 
Small device. Typos and formatting crap

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 02/15] x86/resctrl: Add PLZA support to command-line options
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-08 17:39 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, mingo, dave.hansen, hpa, akpm, rdunlap, peterz,
	feng.tang, dapeng1.mi, elver, enelsonmoore, kuba, ebiggers,
	lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta, tiala,
	chang.seok.bae, kprateek.nayak, prathyushi.nangia, kim.phillips,
	naveen, darwi, elena.reshetova, linux-doc, linux-kernel,
	thomas.lendacky, eranian, peternewman, qinyuntan



On 7/7/26 16:50, Babu Moger wrote:
> Add a kernel command-line parameter to enable or disable the exposure of
> the PLZA (Privilege Level Zero Association) feature to resctrl.
> 
> This allows administrators to control PLZA visibility at boot time via the
> rdt= option (e.g. rdt=plza or rdt=!plza).
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v4: Split the patch 1 from v3 into 2 patches.
>      This patch contains changes for resctrl subsystem.
> ---
>   Documentation/admin-guide/kernel-parameters.txt | 2 +-
>   Documentation/filesystems/resctrl.rst           | 1 +
>   arch/x86/kernel/cpu/resctrl/core.c              | 2 ++
>   3 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index b5493a7f8f22..1de27055cb32 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -6401,7 +6401,7 @@ Kernel parameters
>   	rdt=		[HW,X86,RDT]
>   			Turn on/off individual RDT features. List is:
>   			cmt, mbmtotal, mbmlocal, l3cat, l3cdp, l2cat, l2cdp,
> -			mba, smba, bmec, abmc, sdciae, energy[:guid],
> +			mba, smba, bmec, abmc, sdciae, plza, energy[:guid],
>   			perf[:guid].
>   			E.g. to turn on cmt and turn off mba use:
>   				rdt=cmt,!mba
> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
> index e4b66af55ffb..f3e941404967 100644
> --- a/Documentation/filesystems/resctrl.rst
> +++ b/Documentation/filesystems/resctrl.rst
> @@ -28,6 +28,7 @@ SMBA (Slow Memory Bandwidth Allocation)				""
>   BMEC (Bandwidth Monitoring Event Configuration)			""
>   ABMC (Assignable Bandwidth Monitoring Counters)			""
>   SDCIAE (Smart Data Cache Injection Allocation Enforcement)	""
> +PLZA (Privilege Level Zero Association)				""
>   =============================================================== ================================
>   
>   Historically, new features were made visible by default in /proc/cpuinfo. This
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index f452e8ce4cef..27e09cded829 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -803,6 +803,7 @@ enum {
>   	RDT_FLAG_BMEC,
>   	RDT_FLAG_ABMC,
>   	RDT_FLAG_SDCIAE,
> +	RDT_FLAG_PLZA,
>   };
>   
>   #define RDT_OPT(idx, n, f)	\
> @@ -830,6 +831,7 @@ static struct rdt_options rdt_options[]  __ro_after_init = {
>   	RDT_OPT(RDT_FLAG_BMEC,	    "bmec",	X86_FEATURE_BMEC),
>   	RDT_OPT(RDT_FLAG_ABMC,	    "abmc",	X86_FEATURE_ABMC),
>   	RDT_OPT(RDT_FLAG_SDCIAE,    "sdciae",	X86_FEATURE_SDCIAE),
> +	RDT_OPT(RDT_FLAG_PLZA,	    "plza",	X86_FEATURE_PLZA),
>   };
>   #define NUM_RDT_OPTIONS ARRAY_SIZE(rdt_options)
>   

Sashiko reported:

https://sashiko.dev/#/patchset/cover.1783461016.git.babu.moger%40amd.com?part=2
===================================================================
Is X86_FEATURE_PLZA actually evaluated anywhere in the resctrl subsystem?
The commit message indicates this allows administrators to control PLZA
visibility, but it appears there are no checks for this flag (e.g., using
rdt_cpu_has(X86_FEATURE_PLZA)) in this patch or within the subsystem
initialization logic to act on the administrator's input.
Does this implementation actually configure the hardware and expose the
feature, or is there a missing patch in this series that evaluates this 
flag?
======================================================================

This flag is passed to rdt_set_options and can be enabled or disabled 
using the rdt= boot parameter.

This comment can be ignored.

Thanks
Babu

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 03/15] x86/resctrl: Add data structures and definitions for PLZA configuration
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-08 20:20 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, mingo, dave.hansen, hpa, akpm, rdunlap, peterz,
	feng.tang, dapeng1.mi, elver, enelsonmoore, kuba, ebiggers,
	lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta, tiala,
	chang.seok.bae, kprateek.nayak, prathyushi.nangia, kim.phillips,
	naveen, darwi, elena.reshetova, linux-doc, linux-kernel,
	thomas.lendacky, eranian, peternewman, qinyuntan



On 7/7/26 16:50, Babu Moger wrote:
> Privilege Level Zero Association (PLZA) allows the kernel to use a
> different CLOSID (and optionally RMID) than user mode on entry to kernel
> mode. The CLOSID/RMID association is programmed per CPU via
> MSR_IA32_PQR_PLZA_ASSOC (0xc00003fc), using RMID/CLOSID values and their
> respective enable bits.
> 
> Add the MSR definition and union msr_pqr_plza_assoc to represent the MSR
> bitfield layout used by subsequent PLZA programming.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v4: Re-wrote the changelog and code comment.
> 
> v3: No code changes. Patch order changed. Improved changelog.
> 
> v2: No changes. Just rebasing on top of the latest tip branch.
> ---
>   arch/x86/include/asm/msr-index.h       |  1 +
>   arch/x86/kernel/cpu/resctrl/internal.h | 37 ++++++++++++++++++++++++++
>   2 files changed, 38 insertions(+)
> 
> diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
> index 18c4be75e927..2503451a95fe 100644
> --- a/arch/x86/include/asm/msr-index.h
> +++ b/arch/x86/include/asm/msr-index.h
> @@ -1292,6 +1292,7 @@
>   /* - AMD: */
>   #define MSR_IA32_MBA_BW_BASE		0xc0000200
>   #define MSR_IA32_SMBA_BW_BASE		0xc0000280
> +#define MSR_IA32_PQR_PLZA_ASSOC		0xc00003fc
>   #define MSR_IA32_L3_QOS_ABMC_CFG	0xc00003fd
>   #define MSR_IA32_L3_QOS_EXT_CFG		0xc00003ff
>   #define MSR_IA32_EVT_CFG_BASE		0xc0000400
> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> index e3cfa0c10e92..020ebc2c8a1f 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -222,6 +222,43 @@ union l3_qos_abmc_cfg {
>   	unsigned long full;
>   };
>   
> +/*
> + * Privilege Level Zero Association (PLZA) is configured by writing to
> + * MSR_IA32_PQR_PLZA_ASSOC. The MSR must be programmed on every CPU in
> + * the QoS domain. Each domain supports only one PLZA CLOSID and/or RMID
> + * association. All fields other than PLZA_EN must hold the same value
> + * across the domain for consistent operation.
> + *
> + * When PLZA_EN is set, the CLOSID/RMID association used at CPL 0 is
> + * taken from MSR_IA32_PQR_PLZA_ASSOC instead of MSR_IA32_PQR_ASSOC.
> + *
> + * @rmid		: RMID associated with PLZA.
> + * @reserved1		: Reserved.
> + * @rmid_en		: Enable RMID association for PLZA.
> + * @closid		: CLOSID associated with PLZA.
> + * @reserved2		: Reserved.
> + * @closid_en		: Enable CLOSID association for PLZA.
> + * @reserved3		: Reserved.
> + * @plza_en		: Enable PLZA. When enabled, PLZA applies to the
> + *			  given CPU. When PLZA is disabled for a CPU, the
> + *			  CLOSID and RMID association defined in the
> + *			  PQR_ASSOC MSR applies, regardless of the CPU's
> + *			  privilege level.
> + */
> +union msr_pqr_plza_assoc {
> +	struct {
> +		unsigned long rmid	:12,
> +			      reserved1	:19,
> +			      rmid_en	: 1,
> +			      closid	: 4,
> +			      reserved2	:11,
> +			      closid_en	: 1,
> +			      reserved3	:15,
> +			      plza_en	: 1;
> +	} split;
> +	unsigned long full;
> +};
> +

Sashiko reported:

https://sashiko.dev/#/patchset/cover.1783461016.git.babu.moger%40amd.com?part=3

 > This is a pre-existing issue, but does this union truncate data on 
32-> bit x86 builds? On 32-bit kernels, unsigned long is 32 bits, but the
 > bitfields sum to  64 bits.

Will change the union to use 'u64' type for 'unsigned long'.

It also reported problem with "l3_qos_abmc_cfg".

Will fix that as well.

thanks
Babu



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 04/15] fs/resctrl: Introduce kernel mode (kmode) data structures
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Babu Moger @ 2026-07-08 20:56 UTC (permalink / raw)
  To: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, mingo, dave.hansen, hpa, akpm, rdunlap, peterz,
	feng.tang, dapeng1.mi, elver, enelsonmoore, kuba, ebiggers,
	lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta, tiala,
	chang.seok.bae, kprateek.nayak, prathyushi.nangia, kim.phillips,
	naveen, darwi, elena.reshetova, linux-doc, linux-kernel,
	thomas.lendacky, eranian, peternewman, qinyuntan



On 7/7/26 16:50, Babu Moger wrote:
> Kernel-mode traffic can use a different allocation and monitoring context
> than the originating user task. On x86, Privilege Level Zero Association
> (PLZA) enables the kernel to switch to a different CLOSID (and optionally
> RMID) when entering kernel mode.
> 
> Architectures need a common way to name kernel-mode policies before resctrl
> can report what is active or what the platform supports.
> 
> Introduce enum resctrl_kernel_mode:
>    - INHERIT_CTRL_AND_MON: Kernel work inherits allocation and monitoring
>      from the user task (current behavior).
>    - GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU: Assign allocation for kernel
>      work; inherit monitoring from the user task.
>    - GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU: Assign a dedicated allocation
>      and monitoring for kernel work.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v4: Updated the changelog to be generic as possible.
>      Moved the enum resctrl_kernel_mode to include/linux/resctrl.h.
>      Updated the code comments to be generic.
>      Removed resctrl_kmode_cfg from the code. This definition can be fs
>      specific only and architectures dont need to know.
>      Changed enum name to resctrl_kernel_mode from resctrl_kernel_modes.
> 
> v3: Removed resctrl_kmode definition.
>      Changed the kernel mode definitions to enum resctrl_kernel_modes.
>      Used BIT() to set/test the features.
>      Added details to changelog.
> 
> v2: New patch to handle PLZA interfaces with /sys/fs/resctrl/info/ directory.
>      https://lore.kernel.org/lkml/2ab556af-095b-422b-9396-f845c6fd0342@intel.com/
> ---
>   include/linux/resctrl.h | 31 +++++++++++++++++++++++++++++++
>   1 file changed, 31 insertions(+)
> 
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index 73ff522448a0..c7abed51cd5f 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -703,6 +703,37 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable);
>    */
>   bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r);
>   
> +/**
> + * enum resctrl_kernel_mode - Kernel-mode control and monitor association
> + *			      policy.
> + *
> + * @INHERIT_CTRL_AND_MON:
> + *	Kernel work inherits the allocation and monitoring from the user space
> + *	task. On x86 this means that kernel work shares the same CLOSID and
> + *	RMID as the user space task. This matches today's resctrl behavior.
> + *
> + * @GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU:
> + *	Kernel work uses a globally assigned allocation while monitoring is
> + *	inherited from the user space task. On x86 this means a CLOSID is
> + *	assigned for kernel work and the RMID is inherited from the user space
> + *	task. Default scope is all online CPUs; a subset may be selected via
> + *	the resctrl group interface. A CTRL_MON group is bound to this mode.
> + *
> + * @GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU:
> + *	Kernel work uses globally assigned allocation and monitoring. On x86
> + *	this means both CLOSID and RMID are assigned for kernel work. Default
> + *	scope is all online CPUs; a subset may be selected via the resctrl
> + *	group interface. A CTRL_MON or MON group is bound to this mode.
> + */
> +enum resctrl_kernel_mode {
> +	INHERIT_CTRL_AND_MON,
> +	GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU,
> +	GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
> +	RESCTRL_KMODE_LAST = GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
> +};
> +
> +#define RESCTRL_NUM_KERNEL_MODES (RESCTRL_KMODE_LAST + 1)
> +
>   extern unsigned int resctrl_rmid_realloc_threshold;
>   extern unsigned int resctrl_rmid_realloc_limit;
>   

Sashiko reported:

https://sashiko.dev/#/patchset/cover.1783461016.git.babu.moger%40amd.com?part=4

--- Patch [4]: [RESEND PATCH v4 04/15] fs/resctrl: Introduce kernel mode 
(kmode) data structures ---
commit 1114f46dcb9c990326351e5e6fea6cb114024be3
Author: Babu Moger <babu.moger@amd.com>
fs/resctrl: Introduce kernel mode (kmode) data structures
This commit introduces the resctrl_kernel_mode enum to define policies for
allocating and monitoring contexts for kernel-mode traffic. It enables the
kernel to either inherit contexts from the user task or use globally 
assigned
allocations.
 > diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
 > index 73ff522448a02..c7abed51cd5f0 100644
 > --- a/include/linux/resctrl.h
 > +++ b/include/linux/resctrl.h
[ ... ]
 > +enum resctrl_kernel_mode {
 > +	INHERIT_CTRL_AND_MON,
 > +	GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU,
 > +	GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
 > +	RESCTRL_KMODE_LAST = GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU,
 > +};

This isn't a bug, but does this risk polluting the global kernel namespace?
The enumerators INHERIT_CTRL_AND_MON, 
GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU,
and GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU are defined in a globally included
kernel header without a subsystem-specific prefix.
Should these be prefixed with something like RESCTRL_ (similar to
RESCTRL_KMODE_LAST) to prevent potential name collisions with other kernel
code?

Yes, agreed. These names need another look. They are quite long, and we 
should try to shorten them without losing their meaning or context.

I'm looking for suggestions as well.

Can this be something like:

enum                      sysfs
KMODE_INHERIT_CTRL_MON  "inherit_ctrl_mon"
KMODE_ASSIGN_CTRL_INHERIT_MON "assign_ctrl_inherit_mon"
KMODE_ASSIGN_CTRL_MON "assign_ctrl_mon"


CPU scope is already handled by kmode_cpus.

Thanks
Babu


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 05/15] x86,fs/resctrl: Introduce architecture hooks to program kernel-mode
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Moger, Babu @ 2026-07-08 23:04 UTC (permalink / raw)
  To: Babu Moger, corbet, tony.luck, reinette.chatre, Dave.Martin,
	james.morse, tglx, bp, ben.horgan, fenghuay
  Cc: skhan, x86, mingo, dave.hansen, hpa, akpm, rdunlap, peterz,
	feng.tang, dapeng1.mi, elver, enelsonmoore, kuba, ebiggers,
	lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta, tiala,
	chang.seok.bae, kprateek.nayak, prathyushi.nangia, kim.phillips,
	naveen, darwi, elena.reshetova, linux-doc, linux-kernel,
	thomas.lendacky, eranian, peternewman, qinyuntan



On 7/7/2026 4:50 PM, Babu Moger wrote:
> Kernel-mode policies defined by enum resctrl_kernel_mode must be applied to
> each affected CPU whenever a policy is selected or its scope changes.
> Generic resctrl therefore requires an architecture-specific interface to
> program allocation and monitoring associations in hardware across a given
> CPU mask.
> 
> Introduce a helper, resctrl_arch_configure_kmode(),  to handle kernel-mode
> programming. On x86/AMD systems, this helper programs the
> MSR_IA32_PQR_PLZA_ASSOC register on all online CPUs in the specified mask
> via on_each_cpu_mask(). Also provide a no-op stub for MPAM systems.
> 
> Generic resctrl does not invoke this hook yet; it will be used when user
> space selects a kernel-mode policy or updates the associated CPU set.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v4: Added assign_mon parameter in resctrl_arch_configure_kmode() to program the RMID
>      as discussed in below.
>      https://lore.kernel.org/lkml/20260605100642.1103628-1-qinyuntan@linux.alibaba.com/
>      Changed cpumask type to "const struct cpumask *cpu_mask".
>      Added MPAM stub to avoid any linking issues when resctrl_arch_configure_kmode()
>      is called from FS layer. Thanks to Qinyun.
>      Re-wrote the changelog to be generic.
>      Updated code comments.
> 
> v3: Removed task based PLZA implementation so related changes are removed.
>      Removed handling of rmid_en as it is not required. The group type assigned
>      will be different so the monitoring part is already taken care.
>      Updated the change log with details.
>      Removed resctrl_arch_set_kmode() as arch only provides the modes supported.
>      It is FS which decided which mode to apply.
> 
> v2: Updated the commit message to include the sequence of steps to enable PLZA.
>      Added mode code comments for clarity.
>      Added kmode to functin names to be generic.
> ---
>   arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 36 +++++++++++++++++++++++
>   drivers/resctrl/mpam_resctrl.c            |  5 ++++
>   include/linux/resctrl.h                   | 15 ++++++++++
>   3 files changed, 56 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
> index b20e705606b8..025f139434f2 100644
> --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
> +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
> @@ -131,3 +131,39 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable)
>   
>   	return 0;
>   }
> +
> +static void resctrl_kmode_set_one_amd(void *arg)
> +{
> +	union msr_pqr_plza_assoc *plza = arg;
> +
> +	wrmsrq(MSR_IA32_PQR_PLZA_ASSOC, plza->full);
> +}
> +

Sashiko reported:

https://sashiko.dev/#/patchset/cover.1783461016.git.babu.moger%40amd.com?part=5

--- Patch [5]: [RESEND PATCH v4 05/15] x86,fs/resctrl: Introduce 
architecture hooks to program kernel-mode ---
commit 97958c0d99b7e538d1f8d019e6c63712b44a6289
Author: Babu Moger <babu.moger@amd.com>
x86,fs/resctrl: Introduce architecture hooks to program kernel-mode

Kernel-mode policies defined by enum resctrl_kernel_mode must be applied to
each affected CPU whenever a policy is selected or its scope changes. 
Generic
resctrl therefore requires an architecture-specific interface to program
allocation and monitoring associations in hardware across a given CPU mask.
This patch introduces resctrl_arch_configure_kmode() to handle this.
 > diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c 
b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
 > --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
 > +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
[ ... ]
 > +static void resctrl_kmode_set_one_amd(void *arg)
 > +{
 > +	union msr_pqr_plza_assoc *plza = arg;
 > +
 > +	wrmsrq(MSR_IA32_PQR_PLZA_ASSOC, plza->full);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Will this truncate the upper 32 bits of the MSR on 32-bit x86 builds?
It appears that union msr_pqr_plza_assoc in
arch/x86/kernel/cpu/resctrl/internal.h uses unsigned long for both the
bitfields and the full variable. On 32-bit x86 architectures, unsigned long
is 32 bits, which means reading plza->full will truncate the 64-bit value.
When this is implicitly zero-extended to u64 and passed to wrmsrq(), the
upper 32 bits of the MSR, which contain plza_en, closid_en, and closid,
will be overwritten with zeros.

Will change the union msr_pqr_plza_assoc to use u64 instead on unsigned 
long. It should take care of this.

Thanks
Babu

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  2026-07-08 16:55   ` Babu Moger
@ 2026-07-08 23:28     ` Borislav Petkov
  2026-07-09  0:00       ` Namhyung Kim
  0 siblings, 1 reply; 27+ messages in thread
From: Borislav Petkov @ 2026-07-08 23:28 UTC (permalink / raw)
  To: Babu Moger, Arnaldo Carvalho de Melo, Namhyung Kim
  Cc: corbet, tony.luck, reinette.chatre, Dave.Martin, james.morse,
	tglx, ben.horgan, fenghuay, skhan, x86, mingo, dave.hansen, hpa,
	akpm, rdunlap, peterz, feng.tang, dapeng1.mi, elver, enelsonmoore,
	kuba, ebiggers, lirongqing, seanjc, nikunj, xin,
	pawan.kumar.gupta, tiala, chang.seok.bae, kprateek.nayak,
	prathyushi.nangia, kim.phillips, naveen, darwi, elena.reshetova,
	linux-doc, linux-kernel, thomas.lendacky, eranian, peternewman,
	qinyuntan

On Wed, Jul 08, 2026 at 11:55:30AM -0500, Babu Moger wrote:
> > diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> > index 1b4a48bff18f..bf6fc71f87fa 100644
> > --- a/arch/x86/include/asm/cpufeatures.h
> > +++ b/arch/x86/include/asm/cpufeatures.h
> > @@ -517,6 +517,7 @@
> >   						      * and purposes if CLEAR_CPU_BUF_VM is set).
> >   						      */
> >   #define X86_FEATURE_X2AVIC_EXT		(21*32+20) /* AMD SVM x2AVIC support for 4k vCPUs */
> > +#define X86_FEATURE_PLZA		(21*32+21) /* Privilege Level Zero Association */
> >   /*
> >    * BUG word(s)
> > diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
> > index 937129ce6a96..1fa4d5aef17e 100644
> > --- a/arch/x86/kernel/cpu/scattered.c
> > +++ b/arch/x86/kernel/cpu/scattered.c
> > @@ -61,6 +61,7 @@ static const struct cpuid_bit cpuid_bits[] = {
> >   	{ X86_FEATURE_BMEC,			CPUID_EBX,  3, 0x80000020, 0 },
> >   	{ X86_FEATURE_ABMC,			CPUID_EBX,  5, 0x80000020, 0 },
> >   	{ X86_FEATURE_SDCIAE,			CPUID_EBX,  6, 0x80000020, 0 },
> > +	{ X86_FEATURE_PLZA,			CPUID_EBX,  9, 0x80000020, 0 },
> >   	{ X86_FEATURE_TSA_SQ_NO,		CPUID_ECX,  1, 0x80000021, 0 },
> >   	{ X86_FEATURE_TSA_L1_NO,		CPUID_ECX,  2, 0x80000021, 0 },
> >   	{ X86_FEATURE_AMD_WORKLOAD_CLASS,	CPUID_EAX, 22, 0x80000021, 0 },
> 
> Sashiko reported:
> 
> --- Patch [1]: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level
> Zero Association (PLZA) ---
> commit 0f2aa093b81d7a2e0dc203ce3466562f708898df
> Author: Babu Moger <babu.moger@amd.com>
> x86/resctrl: Support Privilege Level Zero Association (PLZA)
> This commit adds support for AMD's Privilege Level Zero Association (PLZA)
> feature. It detects the feature via CPUID_Fn80000020_EBX_x00 [Bit 9] and
> adds the corresponding feature flag to the x86 cpufeatures array.
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
> > diff --git a/arch/x86/include/asm/cpufeatures.h
> b/arch/x86/include/asm/cpufeatures.h
> > index 1b4a48bff18f7..bf6fc71f87fab 100644
> > --- a/arch/x86/include/asm/cpufeatures.h
> > +++ b/arch/x86/include/asm/cpufeatures.h
> > @@ -517,6 +517,7 @@
> >  						      * and purposes if CLEAR_CPU_BUF_VM is set).
> >  						      */
> >  #define X86_FEATURE_X2AVIC_EXT		(21*32+20) /* AMD SVM x2AVIC support for
> 4k vCPUs */
> > +#define X86_FEATURE_PLZA		(21*32+21) /* Privilege Level Zero Association
> */
> Should this addition also be mirrored in the tools directory copies of
> cpufeatures.h and kcpuid.csv?
> If tools/arch/x86/include/asm/cpufeatures.h is not updated to match, tools
> like
> perf can generate build warnings during check-headers.sh verification. Also,
> without updating tools/arch/x86/kcpuid/cpuid.csv, the kcpuid tool will be
> unaware of the new PLZA feature bit when users query CPU capabilities.
> 
> 
> I thought tools/arch/x86/include/asm/cpufeatures.h would be synced after the
> changes to arch/x86/include/asm/cpufeatures.h are merged. Has that process
> changed?

I guess that hasn't changed:

tools/include/uapi/README

Let's add those perf tools hackers to confirm.

> If the expectation is to update tools/arch/x86/include/asm/cpufeatures.h as
> part of this patch, I can add those changes as well.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  2026-07-08 23:28     ` Borislav Petkov
@ 2026-07-09  0:00       ` Namhyung Kim
  2026-07-09  0:12         ` Borislav Petkov
  0 siblings, 1 reply; 27+ messages in thread
From: Namhyung Kim @ 2026-07-09  0:00 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Babu Moger, Arnaldo Carvalho de Melo, corbet, tony.luck,
	reinette.chatre, Dave.Martin, james.morse, tglx, ben.horgan,
	fenghuay, skhan, x86, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Hello,

On Wed, Jul 08, 2026 at 04:28:06PM -0700, Borislav Petkov wrote:
> On Wed, Jul 08, 2026 at 11:55:30AM -0500, Babu Moger wrote:
> > > diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> > > index 1b4a48bff18f..bf6fc71f87fa 100644
> > > --- a/arch/x86/include/asm/cpufeatures.h
> > > +++ b/arch/x86/include/asm/cpufeatures.h
> > > @@ -517,6 +517,7 @@
> > >   						      * and purposes if CLEAR_CPU_BUF_VM is set).
> > >   						      */
> > >   #define X86_FEATURE_X2AVIC_EXT		(21*32+20) /* AMD SVM x2AVIC support for 4k vCPUs */
> > > +#define X86_FEATURE_PLZA		(21*32+21) /* Privilege Level Zero Association */
> > >   /*
> > >    * BUG word(s)
> > > diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
> > > index 937129ce6a96..1fa4d5aef17e 100644
> > > --- a/arch/x86/kernel/cpu/scattered.c
> > > +++ b/arch/x86/kernel/cpu/scattered.c
> > > @@ -61,6 +61,7 @@ static const struct cpuid_bit cpuid_bits[] = {
> > >   	{ X86_FEATURE_BMEC,			CPUID_EBX,  3, 0x80000020, 0 },
> > >   	{ X86_FEATURE_ABMC,			CPUID_EBX,  5, 0x80000020, 0 },
> > >   	{ X86_FEATURE_SDCIAE,			CPUID_EBX,  6, 0x80000020, 0 },
> > > +	{ X86_FEATURE_PLZA,			CPUID_EBX,  9, 0x80000020, 0 },
> > >   	{ X86_FEATURE_TSA_SQ_NO,		CPUID_ECX,  1, 0x80000021, 0 },
> > >   	{ X86_FEATURE_TSA_L1_NO,		CPUID_ECX,  2, 0x80000021, 0 },
> > >   	{ X86_FEATURE_AMD_WORKLOAD_CLASS,	CPUID_EAX, 22, 0x80000021, 0 },
> > 
> > Sashiko reported:
> > 
> > --- Patch [1]: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level
> > Zero Association (PLZA) ---
> > commit 0f2aa093b81d7a2e0dc203ce3466562f708898df
> > Author: Babu Moger <babu.moger@amd.com>
> > x86/resctrl: Support Privilege Level Zero Association (PLZA)
> > This commit adds support for AMD's Privilege Level Zero Association (PLZA)
> > feature. It detects the feature via CPUID_Fn80000020_EBX_x00 [Bit 9] and
> > adds the corresponding feature flag to the x86 cpufeatures array.
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 # [2]
> > > diff --git a/arch/x86/include/asm/cpufeatures.h
> > b/arch/x86/include/asm/cpufeatures.h
> > > index 1b4a48bff18f7..bf6fc71f87fab 100644
> > > --- a/arch/x86/include/asm/cpufeatures.h
> > > +++ b/arch/x86/include/asm/cpufeatures.h
> > > @@ -517,6 +517,7 @@
> > >  						      * and purposes if CLEAR_CPU_BUF_VM is set).
> > >  						      */
> > >  #define X86_FEATURE_X2AVIC_EXT		(21*32+20) /* AMD SVM x2AVIC support for
> > 4k vCPUs */
> > > +#define X86_FEATURE_PLZA		(21*32+21) /* Privilege Level Zero Association
> > */
> > Should this addition also be mirrored in the tools directory copies of
> > cpufeatures.h and kcpuid.csv?
> > If tools/arch/x86/include/asm/cpufeatures.h is not updated to match, tools
> > like
> > perf can generate build warnings during check-headers.sh verification. Also,
> > without updating tools/arch/x86/kcpuid/cpuid.csv, the kcpuid tool will be
> > unaware of the new PLZA feature bit when users query CPU capabilities.
> > 
> > 
> > I thought tools/arch/x86/include/asm/cpufeatures.h would be synced after the
> > changes to arch/x86/include/asm/cpufeatures.h are merged. Has that process
> > changed?
> 
> I guess that hasn't changed:
> 
> tools/include/uapi/README
> 
> Let's add those perf tools hackers to confirm.

Well.. it's changed as Linus wanted to not update the headers for
trivial changes.  The script is still there but it's not running
automatically.  For perf, we used to check ioctl and other user-visible
changes for system call tracing.  And some headers moved to the
tools/perf/trace/beauty/include directory to sync separately.

I think the headers will be sync-ed less frequently.  So you may need to
update the header for tooling changes manually.

Thanks,
Namhyung


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RESEND PATCH v4 01/15] x86/resctrl: Support Privilege Level Zero Association (PLZA)
  2026-07-09  0:00       ` Namhyung Kim
@ 2026-07-09  0:12         ` Borislav Petkov
  0 siblings, 0 replies; 27+ messages in thread
From: Borislav Petkov @ 2026-07-09  0:12 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Babu Moger, Arnaldo Carvalho de Melo, corbet, tony.luck,
	reinette.chatre, Dave.Martin, james.morse, tglx, ben.horgan,
	fenghuay, skhan, x86, mingo, dave.hansen, hpa, akpm, rdunlap,
	peterz, feng.tang, dapeng1.mi, elver, enelsonmoore, kuba,
	ebiggers, lirongqing, seanjc, nikunj, xin, pawan.kumar.gupta,
	tiala, chang.seok.bae, kprateek.nayak, prathyushi.nangia,
	kim.phillips, naveen, darwi, elena.reshetova, linux-doc,
	linux-kernel, thomas.lendacky, eranian, peternewman, qinyuntan

Hey Namhyung,

On Wed, Jul 08, 2026 at 05:00:00PM -0700, Namhyung Kim wrote:
> Well.. it's changed as Linus wanted to not update the headers for
> trivial changes.  The script is still there but it's not running
> automatically.  For perf, we used to check ioctl and other user-visible
> changes for system call tracing.  And some headers moved to the
> tools/perf/trace/beauty/include directory to sync separately.
> 
> I think the headers will be sync-ed less frequently.  So you may need to
> update the header for tooling changes manually.

I'm reading this as, we should not touch cpufeatures.h in tools/ and let you
guys decide when you actually need bits from it? In the sense: only when you
really need bits from it, you'll update it and other, unrelated bits which are
not needed, can remain different...

Or?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2026-07-09  0:13 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-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-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-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-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-07-07 21:50 ` [RESEND PATCH v4 06/15] fs/resctrl: Introduce resctrl_set_kmode_support() to initialize supported modes Babu Moger
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-07 21:50 ` [RESEND PATCH v4 08/15] fs/resctrl: Add interface to display supported and active kernel-mode policy Babu Moger
2026-07-07 21:50 ` [RESEND PATCH v4 09/15] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup Babu Moger
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-07 21:50 ` [RESEND PATCH v4 11/15] fs/resctrl: Program kernel-mode binding when CPU comes online 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-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-07 21:50 ` [RESEND PATCH v4 14/15] fs/resctrl: Allow user space to write kmode_cpus/kmode_cpus_list Babu Moger
2026-07-07 21:50 ` [RESEND PATCH v4 15/15] fs/resctrl: Add documentation on kernel_mode with example Babu Moger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox