Skip to content

KVM: Fix race between reboot and hardware enabling

Sean Christopherson kexec kvm kvm-riscv kvmarm lkml 2 versions – Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 13 repliesApplied
  2. v12 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Rename KVM's callback to kvm_shutdown() to match the hook. [Marc]
- Don't add a spurious newline. [Marc]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: Use syscore_ops instead of reboot_notifier to hook restart/shutdownvirt/kvm/kvm_main.c+11 -1511 replies
2/2KVM: Don't enable hardware after a restart/shutdown is initiatedvirt/kvm/kvm_main.c+16 -10 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMarc Zyngier
SeriesA-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] KVM: Fix race between reboot and hardware enabling

Fix a bug where enabling hardware virtualization can race with a forced reboot, e.g. reboot -f, and result in virt hardware being enabled when the reboot is attempted, and thus hanging the reboot.

Found by inspection, confirmed by hacking the reboot flow to wait until KVM loads (the problematic window is ridiculously small).

Fully tested only on x86, compile tested on other architectures.

v2:
- Rename KVM's callback to kvm_shutdown() to match the hook. [Marc]
- Don't add a spurious newline. [Marc]

v1: https://lore.kernel.org/all/20230310221414.811690-1-seanjc at google.com

Sean Christopherson (2):
KVM: Use syscore_ops instead of reboot_notifier to hook
restart/shutdown
KVM: Don't enable hardware after a restart/shutdown is initiated

 virt/kvm/kvm_main.c | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

base-commit: b3c98052d46948a8d65d2778c7f306ff38366aac

Signature · 1 line
2.40.1.606.ga4b1b128d6-goog