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

From: Mi, Dapeng

Date: Tue Dec 01 2026 - 00:44:14 EST


Reviewed-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>

On 11/25/2026 5:38 AM, Zide Chen wrote:
> 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.