Re: [PATCH v2 05/18] x86/reboot: KVM: Disable SVM during reboot via virt/KVM reboot callback

From: Huang, Kai
Date: Tue Mar 14 2023 - 21:31:53 EST


On Tue, 2023-03-14 at 17:47 -0700, Sean Christopherson wrote:
> > Also, personally I don't particularly like the middle state in patch 04:
> >
> >   void cpu_emergency_disable_virtualization(void)
> >   {
> >   #if IS_ENABLED(CONFIG_KVM_INTEL)
> > - cpu_crash_vmclear_loaded_vmcss();
> > -#endif
> > + cpu_emergency_virt_cb *callback;
> >  
> > - cpu_emergency_vmxoff();
> > + rcu_read_lock();
> > + callback = rcu_dereference(cpu_emergency_virt_callback);
> > + if (callback)
> > + callback();
> > + rcu_read_unlock();
> > +#endif
> > + /* KVM_AMD doesn't yet utilize the common callback. */
> >    cpu_emergency_svm_disable();
> >   }
> >
> > Which eventually got fixed up in patch 05:
> >
> >   void cpu_emergency_disable_virtualization(void)
> >   {
> > -#if IS_ENABLED(CONFIG_KVM_INTEL)
> > +#if IS_ENABLED(CONFIG_KVM_INTEL) || IS_ENABLED(CONFIG_KVM_AMD)
> >    cpu_emergency_virt_cb *callback;
> >  
> >    rcu_read_lock();
> > @@ -830,8 +830,6 @@ void cpu_emergency_disable_virtualization(void)
> >    callback();
> >    rcu_read_unlock();
> >   #endif
> > - /* KVM_AMD doesn't yet utilize the common callback. */
> > - cpu_emergency_svm_disable();
> >   }
> >  
> > Could we just merge the two patches together?
>
> I'd prefer not to squash the two.  I agree it's ugly, but I dislike converting
> VMX and SVM at the same time.  I'm not totally opposed to moving everything in
> one fell swoop, but my preference is to keep them separate.

Sure.