Re: [RESEND PATCH v4 07/15] x86/resctrl: Expose the supported PLZA kernel-mode policies during init
From: Babu Moger
Date: Thu Jul 09 2026 - 11:15:23 EST
On 7/7/26 16:50, Babu Moger wrote:
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@xxxxxxx>
---
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);
}
Sashiko reported:
https://sashiko.dev/#/patchset/cover.1783461016.git.babu.moger%40amd.com?part=7
--- Patch [7]: [RESEND PATCH v4 07/15] x86/resctrl: Expose the supported PLZA kernel-mode policies during init ---
commit 6d029d053cc0d67da93c0b4ae5419b85cfaeb5aa
Author: Babu Moger <babu.moger@xxxxxxx>
x86/resctrl: Expose the supported PLZA kernel-mode policies during init
This commit updates the generic resctrl subsystem to expose PLZA
kernel-mode policies during resource discovery. When X86_FEATURE_PLZA
is present, it sets up support for GLOBAL_ASSIGN_CTRL_INHERIT_MON_PER_CPU
and GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU policies.
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 27e09cded8299..df7e19fe60078 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
[ ... ]
> @@ -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);
Is it possible for GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU to be advertised
here even if resource allocation features are disabled on the system?
Because this policy assigns a dedicated resource allocation for kernel work,
should this check verify rdt_alloc_capable before exposing the policy?
If allocation is disabled via kernel command-line parameters (like
rdt=!l3cat), but monitoring features are present, it seems like we might
expose an allocation-dependent policy to userspace incorrectly.
------------------------------------------------------------------------
PLZA is really meaningful when allocation is enabled. I think it would be better to check rdt_alloc_capable before enabling GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU. Will add the check.
if (rdt_alloc_capable && rdt_cpu_has(X86_FEATURE_PLZA)) resctrl_set_kmode_support(GLOBAL_ASSIGN_CTRL_ASSIGN_MON_PER_CPU);
Thanks
Babu