On Tue, Sep 13, 2022, Suthikulpanit, Suravee wrote: > > @@ -10122,7 +10136,15 @@ void __kvm_set_or_clear_apicv_inhibit(struct kvm *kvm, > > set_or_clear_apicv_inhibit(&new, reason, set); > > - if (!!old != !!new) { > > + /* > > + * If the overall "is APICv activated" status is unchanged, simply add > > + * or remove the inihbit from the pile. x2APIC is an exception, as it > > + * is a partial inhibit (only blocks SPTEs for the APIC access page). > > + * If x2APIC is the only inhibit in either the old or the new set, then > > + * vCPUs need to be kicked to transition between partially-inhibited > > + * and fully-inhibited. > > + */ > > + if ((!!old != !!new) || old == X2APIC_ENABLE || new == X2APIC_ENABLE) { > > Why are we comparing APICV inhibit reasons (old, new) with X2APIC_ENABLE > here? Do you mean to compare with APICV_INHIBIT_REASON_X2APIC? Heh, the truly hilarious part about this is that the code actually works, because by pure coincidence, X2APIC_ENABLE == BIT(APICV_INHIBIT_REASON_X2APIC). Obviously still needs to be changed, just found it amusing.