[PATCH v12 02/25] x86/resctrl: Check if monitoring features are supported
From: Tony Luck
Date: Wed Sep 16 2026 - 19:19:38 EST
Both Intel and AMD manuals say that software must first check
CPUID(0x7,0x0).EBX[12] (Linux: X86_FEATURE_CQM) to see if any monitoring
features are supported before checking for specific features supported
in subleaves.
Each of the L3-based monitoring features is further gated by
CPUID(0xF,0x0).EDX[1] (Linux: X86_FEATURE_CQM_LLC).
Add checks for these feature bits.
Fixes: cbc82b172638 ("x86: Add support for Intel Cache QoS Monitoring (CQM) detection")
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
v12:
Revert X86_FEATURE name changes.
Invert the test for X86_FEATURE_CQM_LLC to avoid adding extra
indentation churn and keep call to rdt_get_l3_mon_config in
the X86_FEATURE_CQM_LLC code path.
---
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