Re: [PATCH v9 05/12] KVM: x86/pmu: Support PERF_METRICS MSR in mediated vPMU
From: Chen, Zide
Date: Fri Oct 30 2026 - 11:47:12 EST
On 10/29/2026 6:32 PM, Yosry Ahmed wrote:
> On Thu, Oct 29, 2026 at 4:26 PM Jim Mattson <jmattson@xxxxxxxxxx> wrote:
>>
>> On Thu, Oct 29, 2026 at 4:19 PM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
>>>
>>> On Thu, Oct 29, 2026 at 4:17 PM Chen, Zide <zide.chen@xxxxxxxxx> wrote:
>>>>
>>>>
>>>>
>>>> On 10/29/2026 5:06 PM, Yosry Ahmed wrote:
>>>>>> 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).
>>>>
>>>> Right, these two APIs do not directly determine whether the mentioned
>>>> resources need interception:
>>>>
>>>> kvm_need_any_pmc_intercept()
>>>> kvm_need_perf_metrics_intercept()
>>>
>>> Jim suggested folding kvm_need_perf_metrics_intercept() into
>>> kvm_need_any_pmc_intercept(). The name of kvm_need_any_pmc_intercept()
>>> might be confusing as well, but at least it's one less interface to
>>> worry about?
>>>
>>>>
>>>> This is different from kvm_need_perf_global_ctrl_intercept() and
>>>> kvm_need_rdpmc_intercept().
>>>>
>>>> How about change them to something like these?
>>>>
>>>> kvm_pmu_has_unexposed_pmcs()
>>>> kvm_pmu_has_unexposed_perf_metrics()
>>>>
>>>> Or merge them into one single API? kvm_pmu_has_unexposed_resources()
>>>
>>> I don't like this name any better, but I don't have better
>>> suggestions. Since we already have kvm_need_any_pmc_intercept(), let's
>>> just use it for now?
>>
>> How about kvm_pmu_incomplete_passthrough()?
>
> Better than kvm_need_any_pmc_intercept() imo.
OK, I can rename it in v3.