Skip to contentSkip to conversation

Fix reboot on Intel hosts

PATCH Applied Avi Kivity 2 participants 4 messages Sep 21, 2010 – Sep 22, 2010 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

cover Fix reboot on Intel hosts

For a while (how long?) reboots with active guests are broken on Intel hosts. This patch set fixes the problem.

Avi Kivity (2):
KVM: Fix reboot on Intel hosts
KVM: cpu_relax() during spin waiting for reboot

 virt/kvm/kvm_main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.2.3
author
#1 lore raw

PATCH 1/2 KVM: Fix reboot on Intel hosts

When we reboot, we disable vmx extensions or otherwise INIT gets blocked. If a task on another cpu hits a vmx instruction, it will fault if vmx is disabled. We trap that to avoid a nasty oops and spin until the reboot completes.

Problem is, we sleep with interrupts disabled. This blocks smp_send_stop() from running, and the reboot process halts.

Fix by enabling interrupts before spinning.

KVM-Stable-Tag.

---
 virt/kvm/kvm_main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +3 -1
index 9a73b98..c7a57b4 100644
@@ -2018,10 +2018,12 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val,
 
 asmlinkage void kvm_handle_fault_on_reboot(void)
 {
-	if (kvm_rebooting)
+	if (kvm_rebooting) {
 		/* spin while reset goes on */
+		local_irq_enable();
 		while (true)
 			;
+	}
 	/* Fault while not rebooting.  We want the trace. */
 	BUG();
 }
Signature · 1 line
1.7.2.3
author
#2 lore raw

PATCH 2/2 KVM: cpu_relax() during spin waiting for reboot

In reply to Avi Kivity

It doesn't really matter, but if we spin, we should spin in a more relaxed manner. This way, if something goes wrong at least it won't contribute to global warming.

---
 virt/kvm/kvm_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +1 -1
index c7a57b4..b8499f5 100644
@@ -2022,7 +2022,7 @@ asmlinkage void kvm_handle_fault_on_reboot(void)
 		/* spin while reset goes on */
 		local_irq_enable();
 		while (true)
-			;
+			cpu_relax();
 	}
 	/* Fault while not rebooting.  We want the trace. */
 	BUG();
Signature · 1 line
1.7.2.3
#3 lore raw
In reply to Avi Kivity
Quoted 9 lines · Avi Kivity

For a while (how long?) reboots with active guests are broken on Intel hosts. This patch set fixes the problem.

Avi Kivity (2):
KVM: Fix reboot on Intel hosts
KVM: cpu_relax() during spin waiting for reboot

 virt/kvm/kvm_main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.