[PATCH v13 03/25] x86/resctrl: Check if monitoring features are supported
From: Tony Luck
Date: Mon Sep 28 2026 - 18:16:44 EST
Both Intel and AMD manuals say that software must first check
CPUID(0x7,0x0).EBX[12] to see if any monitoring features are supported before
checking for resource specific features supported in subleaves.
Each of the L3 monitoring features is further gated by CPUID(0xF,0x0).EDX[1].
Add checks for these feature bits.
Maintainer note: No need to backport this fix. No issues have been seen
from this failure to follow the exact enumeration process in the manual.
Fixes: cbc82b172638 ("x86: Add support for Intel Cache QoS Monitoring (CQM) detection")
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
v13:
Dropped (Linux: X86_FEATURE_*) from commit comment
s/specific features/resource specific features/
s/L3-based monitoring features/L3 monitoring features/
Added maintainer note about not back porting.
---
arch/x86/kernel/cpu/resctrl/core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 55214d6fdc49..34ca3c7cc046 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -968,6 +968,14 @@ static __init bool get_rdt_mon_resources(void)
struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
bool ret = false;
+ /* Any monitoring at all? */
+ if (!cpu_feature_enabled(X86_FEATURE_CQM))
+ return false;
+
+ /* Any of the L3 monitoring features? */
+ if (!cpu_feature_enabled(X86_FEATURE_CQM_LLC))
+ return false;
+
if (rdt_cpu_has(X86_FEATURE_CQM_OCCUP_LLC)) {
resctrl_enable_mon_event(QOS_L3_OCCUP_EVENT_ID, false, 0, NULL);
ret = true;
--
2.55.0