Re: [PATCH v4 07/19] x86/reboot: Disable virtualization during reboot iff callback is registered

From: Huang, Kai
Date: Mon Jul 24 2023 - 19:57:58 EST


On Fri, 2023-07-21 at 13:18 -0700, Sean Christopherson wrote:
> Attempt to disable virtualization during an emergency reboot if and only
> if there is a registered virt callback, i.e. iff a hypervisor (KVM) is
> active. If there's no active hypervisor, then the CPU can't be operating
> with VMX or SVM enabled (barring an egregious bug).
>
> Checking for a valid callback instead of simply for SVM or VMX support
> can also eliminates spurious NMIs by avoiding the unecessary call to
> nmi_shootdown_cpus_on_restart().
>
> Note, IRQs are disabled, which prevents KVM from coming along and
> enabling virtualization after the fact.
>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
>

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