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

From: Huang, Kai
Date: Mon May 22 2023 - 09:15:56 EST


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@xxxxxxxxxx>

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

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)?