Re: [PATCH 02/19] KVM: SVM: Don't put/load AVIC when setting virtual APIC mode

From: Sean Christopherson
Date: Wed Aug 31 2022 - 12:33:37 EST


On Wed, Aug 31, 2022, Maxim Levitsky wrote:
> > @@ -1118,6 +1107,16 @@ void avic_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
> > avic_deactivate_vmcb(svm);
> > }
> > vmcb_mark_dirty(vmcb, VMCB_AVIC);
> > +}
> > +
> > +void avic_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
> > +{
> > + bool activated = kvm_vcpu_apicv_active(vcpu);
> > +
> > + if (!enable_apicv)
> > + return;
> > +
> > + avic_set_virtual_apic_mode(vcpu);
>
> This call is misleading - this will usually be called
> when avic mode didn't change - I think we need a better name for
> avic_set_virtual_apic_mode.

I don't disagree, but I'm having trouble coming up with a succinct alternative.
The helper primarily configures the VMCB, but the call to
avic_apicv_post_state_restore() makes avic_refresh_vmcb_controls() undesirable.

Maybe avic_refresh_virtual_apic_mode()?