public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix reboot on Intel hosts
@ 2010-09-21 17:59 Avi Kivity
  2010-09-21 17:59 ` [PATCH 1/2] KVM: " Avi Kivity
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Avi Kivity @ 2010-09-21 17:59 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm

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

-- 
1.7.2.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] KVM: Fix reboot on Intel hosts
  2010-09-21 17:59 [PATCH 0/2] Fix reboot on Intel hosts Avi Kivity
@ 2010-09-21 17:59 ` Avi Kivity
  2010-09-21 17:59 ` [PATCH 2/2] KVM: cpu_relax() during spin waiting for reboot Avi Kivity
  2010-09-22 20:50 ` [PATCH 0/2] Fix reboot on Intel hosts Marcelo Tosatti
  2 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-09-21 17:59 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm

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.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 virt/kvm/kvm_main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 9a73b98..c7a57b4 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -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();
 }
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] KVM: cpu_relax() during spin waiting for reboot
  2010-09-21 17:59 [PATCH 0/2] Fix reboot on Intel hosts Avi Kivity
  2010-09-21 17:59 ` [PATCH 1/2] KVM: " Avi Kivity
@ 2010-09-21 17:59 ` Avi Kivity
  2010-09-22 20:50 ` [PATCH 0/2] Fix reboot on Intel hosts Marcelo Tosatti
  2 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-09-21 17:59 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm

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.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 virt/kvm/kvm_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c7a57b4..b8499f5 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -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();
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Fix reboot on Intel hosts
  2010-09-21 17:59 [PATCH 0/2] Fix reboot on Intel hosts Avi Kivity
  2010-09-21 17:59 ` [PATCH 1/2] KVM: " Avi Kivity
  2010-09-21 17:59 ` [PATCH 2/2] KVM: cpu_relax() during spin waiting for reboot Avi Kivity
@ 2010-09-22 20:50 ` Marcelo Tosatti
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2010-09-22 20:50 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On Tue, Sep 21, 2010 at 07:59:42PM +0200, Avi Kivity wrote:
> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-22 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-21 17:59 [PATCH 0/2] Fix reboot on Intel hosts Avi Kivity
2010-09-21 17:59 ` [PATCH 1/2] KVM: " Avi Kivity
2010-09-21 17:59 ` [PATCH 2/2] KVM: cpu_relax() during spin waiting for reboot Avi Kivity
2010-09-22 20:50 ` [PATCH 0/2] Fix reboot on Intel hosts Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox