Re: [PATCH v3 04/18] KVM: x86/pmu: Add PMC bitmap accessor helpers
From: Chen, Zide
Date: Mon Nov 09 2026 - 12:57:59 EST
On 11/9/2026 1:53 AM, Mi, Dapeng wrote:
>
> On 11/7/2026 6:35 AM, Yosry Ahmed wrote:
>> On Fri, Nov 6, 2026 at 2:19 PM Chen, Zide <zide.chen@xxxxxxxxx> wrote:
>>>
>>>
>>> On 11/6/2026 1:09 PM, Yosry Ahmed wrote:
>>>>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>>>>> index b8875ed5502c..4f192429ed93 100644
>>>>> --- a/arch/x86/include/asm/kvm_host.h
>>>>> +++ b/arch/x86/include/asm/kvm_host.h
>>>>> @@ -595,7 +595,10 @@ struct kvm_pmu {
>>>>> DECLARE_BITMAP(reprogram_pmi, X86_PMC_IDX_MAX);
>>>>> atomic64_t __reprogram_pmi;
>>>>> };
>>>>> - DECLARE_BITMAP(pmc_exists, X86_PMC_IDX_MAX);
>>>>> + union {
>>>>> + DECLARE_BITMAP(pmc_exists, X86_PMC_IDX_MAX);
>>>>> + u64 pmc_exists64;
>>>> __pmc_exists would be more consistent with __reprogam_pmi above.
>>> I used the *64 suffix and without '__' to match the cntr_mask/cntr_mask64
>>> and fixed_cntr_mask/fixed_cntr_mask64 pattern in struct x86_pmu_capability
>>> (patch 7), whereas __reprogram_pmi used '__' because it is an atomic64_t
>>> rather than a scalar mask.
>> I don't follow why the '__' prefix is specific to atomics, but anyway,
>> I will leave this up to you and Sean.
>
> Per my understanding, '__' prefix hints this function/variable should not
> be accessed directly, it should be accessed via some wrapper helpers. So I
> think it depends on if we hope the variable pmc_exists64 should be accessed
> directly.
Agree, I vote for pmc_exists64 over __pmc_exists.
> Thanks.
>