Skip to contentSkip to conversation

bug# 228 (enable disabled DOM0 CPU)

PATCH New Ryan Harper 1 participant 2 messages Sep 26, 2005 – Sep 28, 2005

lore
Share & tools
lore
#0 lore raw

This changeset breaks vcpu-hotplug for dom0.

changeset:   6464:b3785cbb723b8b355c1282232de0bd1cfbfb3556
user:        [email protected]
date:        Mon Aug 29 12:40:47 2005
summary:     Simplify and fix SMP irq and ipi teardown/setup on suspend/resume.

Specifically, calling vcpu-enable on DOM0 vcpu that has been disabled hangs DOM0:

Disabling SMP...
CPU0 attaching sched-domain:
domain 0: span 01
groups: 01
CPU0 attaching sched-domain:
domain 0: does not load-balance
Enabling SMP...
send_IPI to unbound port 1/3

Signature · 5 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]
#1 lore raw

PATCH 1/1 fix race with smp_resume()

Quoted 9 lines · Ryan Harper

This changeset breaks vcpu-hotplug for dom0.

changeset:   6464:b3785cbb723b8b355c1282232de0bd1cfbfb3556
user:        [email protected]
date:        Mon Aug 29 12:40:47 2005
summary:     Simplify and fix SMP irq and ipi teardown/setup on suspend/resume.

Specifically, calling vcpu-enable on DOM0 vcpu that has been disabled hangs DOM0:

This patch fixes a race between when the disable cpu is marked online and binding IPIs back to the CPU. In some cases, an IPI would be sent to CPU1 before it had allocated a new evtchn. Moving smp_resume() call before setting the cpu online fixes this race. This fixes [1]bug#228

Please apply.

1. http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=228

Signature · 61 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[email protected]


diffstat output:
 process.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

Signed-off-by: Ryan Harper <[email protected]>
---
diff -r ce54669c70fc linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c	Wed Sep 28 15:15:20 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c	Wed Sep 28 11:25:51 2005
@@ -112,6 +112,10 @@
 
 #ifdef CONFIG_HOTPLUG_CPU
 #include <asm/nmi.h>
+#ifdef CONFIG_SMP
+extern void smp_suspend(void);
+extern void smp_resume(void);
+#endif
 /* We don't actually take CPU down, just spin without interrupts. */
 static inline void play_dead(void)
 {
@@ -120,6 +124,13 @@
 		HYPERVISOR_yield();
 
 	__flush_tlb_all();
+   /* 
+    * Restore IPI/IRQ mappings before marking online to prevent 
+    * race between pending interrupts and restoration of handler. 
+    */
+#ifdef CONFIG_SMP
+	smp_resume();
+#endif
 	cpu_set(smp_processor_id(), cpu_online_map);
 }
 #else
@@ -135,10 +146,6 @@
  * low exit latency (ie sit in a loop waiting for
  * somebody to say that they'd like to reschedule)
  */
-#ifdef CONFIG_SMP
-extern void smp_suspend(void);
-extern void smp_resume(void);
-#endif
 void cpu_idle (void)
 {
 	int cpu = _smp_processor_id();
@@ -166,9 +173,6 @@
 				HYPERVISOR_vcpu_down(cpu);
 #endif
 				play_dead();
-#ifdef CONFIG_SMP
-				smp_resume();
-#endif
 				local_irq_enable();
 			}