Re: [PATCH 2/3] KVM: x86: Introduce definitions to support static calls for kvm_pmu_ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 08, 2021, Like Xu wrote:
> On 5/11/2021 11:48 pm, Sean Christopherson wrote:
> > On Wed, Nov 03, 2021, Like Xu wrote:
> > > diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
> > > index 0db1887137d9..b6f08c719125 100644
> > > --- a/arch/x86/kvm/pmu.c
> > > +++ b/arch/x86/kvm/pmu.c
> > > @@ -50,6 +50,13 @@
> > >   struct kvm_pmu_ops kvm_pmu_ops __read_mostly;
> > >   EXPORT_SYMBOL_GPL(kvm_pmu_ops);
> > > +#define	KVM_X86_PMU_OP(func)	\
> > > +	DEFINE_STATIC_CALL_NULL(kvm_x86_pmu_##func,	\
> > > +				*(((struct kvm_pmu_ops *)0)->func))
> > > +#define	KVM_X86_PMU_OP_NULL	KVM_X86_PMU_OP
> > 
> > More of a question for the existing code, what's the point of KVM_X86_OP_NULL?
> 
> The comment says:
> 
>  * KVM_X86_OP_NULL() can leave a NULL definition for the
>  * case where there is no definition or a function name that
>  * doesn't match the typical naming convention is supplied.
> 
> Does it help ?

No.  I understand the original intent of KVM_X86_OP_NULL, but unless there's some
form of enforcement, it does more harm than good because it can very easily become
stale, e.g. see get_cs_db_l_bits().  I guess "what's the point of KVM_X86_OP_NULL?"
was somewhat of a rhetorical question.

> > AFAICT, it always resolves to KVM_X86_OP.  Unless there's some magic I'm missing,
> > I vote we remove KVM_X86_OP_NULL and then not introduce KVM_X86_PMU_OP_NULL.
> > And I'm pretty sure it's useless, e.g. get_cs_db_l_bits is defined with the NULL




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux