Skip to content

Commit

Permalink
KVM: x86: Force kvm_rebooting=true during emergency reboot/crash
Browse files Browse the repository at this point in the history
Set kvm_rebooting when virtualization is disabled in an emergency so that
KVM eats faults on virtualization instructions even if kvm_reboot() isn't
reached.

Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://lore.kernel.org/r/20230721201859.2307736-18-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
  • Loading branch information
sean-jc committed Aug 3, 2023
1 parent 76ab816 commit 6ae44e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/x86/kvm/svm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ static inline void kvm_cpu_svm_disable(void)

static void svm_emergency_disable(void)
{
kvm_rebooting = true;

kvm_cpu_svm_disable();
}

Expand Down
2 changes: 2 additions & 0 deletions arch/x86/kvm/vmx/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ static void vmx_emergency_disable(void)
int cpu = raw_smp_processor_id();
struct loaded_vmcs *v;

kvm_rebooting = true;

list_for_each_entry(v, &per_cpu(loaded_vmcss_on_cpu, cpu),
loaded_vmcss_on_cpu_link)
vmcs_clear(v->vmcs);
Expand Down

0 comments on commit 6ae44e0

Please sign in to comment.