Re: [PATCH v2 2/8] x86/resctrl: Add RESCTRL_NPS_NODE scope for AMD NPS-aligned domains
From: Moger, Babu
Date: Tue Apr 28 2026 - 19:53:57 EST
Hi Peter,
On 4/28/2026 5:16 AM, Peter Newman wrote:
Hi Babu,
On Fri, Apr 24, 2026 at 3:42 AM Babu Moger <babu.moger@xxxxxxx> wrote:
Global Memory Bandwidth Allocation (GMBA) control domains on AMD follow the
Nodes Per Socket (NPS) configuration. With NPS 4 there is a single domain
per package; otherwise the domain aligns with the NUMA node.
My mistake. It should be system wide. Confirmed with team also. Line from spec. Will fix it.
When configured, each NUMA node functions as an individual GLBE domain, except when the system is configured in NPS=4 mode in which case only a single GLBE domain exists which contains all QOS Domains in the system.
By default, all QOS Domains in the system are included in a single GLBE
Control Domain. However, BIOS options may establish several GLBE Control
Domains within the system using NPS configuration. When configured, each
NUMA node functions as an individual GLBE domain, except when the system is
configured in NPS=4 mode in which case only a single GLBE domain exists
which contains all QOS Domains in the system.
The previous paragraph said NPS 4 is a single domain per package, not
system-wide.
Add RESCTRL_NPS_NODE to enum resctrl_scope and implement
get_domain_id_nps().
Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
---
v2: Add RESCTRL_NPS_NODE scope to add support for NPS-aligned resource.
---
arch/x86/kernel/cpu/resctrl/core.c | 20 ++++++++++++++++++++
include/linux/resctrl.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 269265d98ad7..0f58f5e3b853 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -451,6 +451,24 @@ static int l3_mon_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_l3_mon_domain *hw
return -ENOMEM;
}
+/**
+ * get_domain_id_nps() - Domain id for %RESCTRL_NPS_NODE (AMD NPS / GMBA)
+ * @cpu: CPU to query.
+ *
+ * Global memory bandwidth allocation (GMBA) control domains on AMD follow
+ * the socket NPS layout. With NPS 4 there is a single control domain per
+ * package, so every CPU maps to domain id 0. For other NPS settings the
+ * domain matches the CPU's NUMA node.
Need to fix this text also.
+ *
+ * Return: 0 when NPS is 4, otherwise the NUMA node id for @cpu.
+ */
+static int get_domain_id_nps(int cpu)
+{
+ if (topology_num_nodes_per_package() == 4)
+ return 0;
ID is 0 regardless of the number of packages, unlike the
RESCTRL_PACKAGE case below?
Code is correct. Will fix the comments and commit message.
Thanks
Babu