Re: [PATCH v9 05/12] KVM: x86/pmu: Support PERF_METRICS MSR in mediated vPMU

From: Yosry Ahmed

Date: Thu Oct 29 2026 - 18:07:25 EST


> diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
> index 448044a2b121..f4d3801b97bc 100644
> --- a/arch/x86/kvm/pmu.c
> +++ b/arch/x86/kvm/pmu.c
> @@ -806,9 +806,16 @@ static bool kvm_need_any_pmc_intercept(struct kvm_vcpu *vcpu)
> pmu->nr_arch_fixed_counters != kvm_host_pmu.num_counters_fixed;
> }
>
> +static bool kvm_need_perf_metrics_intercept(struct kvm_vcpu *vcpu)

The name is confusing, this doesn't control the intercept of
PERF_METRICS (and it wouldn't be correct to use it for that AFAICT).

> +{
> + return (kvm_host.perf_capabilities & PERF_CAP_PERF_METRICS) &&
> + !kvm_vcpu_has_perf_metrics(vcpu);
> +}
>