Re: [PATCH v3 10/18] x86/virt: KVM: Move VMXOFF helpers into KVM VMX

Huang, Kai
2023-05-22T13:15:56Z

On Fri, 2023-05-12 at 16:50 -0700, Sean Christopherson wrote:
> Now that VMX is disabled in emergencies via the virt callbacks, move the
> VMXOFF helpers into KVM, the only remaining user.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Kai Huang <kai.huang@intel.com>

One nit ...

[...]

> static void vmx_emergency_disable(void)
> {
> int cpu = raw_smp_processor_id();
> @@ -753,7 +775,8 @@ static void vmx_emergency_disable(void)
> loaded_vmcss_on_cpu_link)
> vmcs_clear(v->vmcs);
>
> - __cpu_emergency_vmxoff();
> + if (__read_cr4() & X86_CR4_VMXE)
> + kvm_cpu_vmxoff();
> }

As replied to patch 3, is it better to move CR4.VMXE bit check before VMCLEAR
(can be done in either patch 3, or here)?