[PATCH v10 02/18] perf/x86/intel: Do not inflate capabilities for guests

From: Zide Chen

Date: Tue Nov 24 2026 - 16:53:36 EST


intel_pmu_broken_perf_cap() works around erratum RPL018 by forcing
perf_metrics on for RPL and MTL P-cores. When running as a guest, this
may erroneously advertise a feature the vCPU does not possess.

Skip the workaround when running under a hypervisor.

Fixes: 97588df87b56 ("perf/x86/intel: Add common intel_pmu_init_hybrid()")
Fixes: dd384d661f06 ("perf/x86/intel: Fix intel_cap handling on hybrid PMUs")
Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
---
v10: new patch.
---
arch/x86/events/intel/core.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index c76d9aa8e5eb..dbd84d82f36d 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -6163,6 +6163,10 @@ static void intel_pmu_check_extra_regs(struct extra_reg *extra_regs);

static inline bool intel_pmu_broken_perf_cap(void)
{
+ /* Don't inflate capabilities when running as a guest. */
+ if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
+ return false;
+
/*
* The Perf Metric (Bit 15) is always cleared on P-core of
* RPL and MTL. Details can be found in RPL018 erratum.
--
2.56.1