]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
x86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check.
authorKeir Fraser <keir@xen.org>
Sat, 5 Mar 2011 16:02:33 +0000 (16:02 +0000)
committerKeir Fraser <keir@xen.org>
Sat, 5 Mar 2011 16:02:33 +0000 (16:02 +0000)
Otherwise compiler may re-read cpu_state for the BUG_ON and see a
modified value causing erroneous BUG.

Signed-off-by: Keir Fraser <keir@xen.org>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
xen/arch/x86/smpboot.c

index 7c14f062868c10b924b9033de6eeac3a8f0a8c80..39eb583e84373f3fdae4440636c214fac328a955 100644 (file)
@@ -861,10 +861,11 @@ void __cpu_die(unsigned int cpu)
 {
     /* We don't do anything here: idle task is faking death itself. */
     unsigned int i = 0;
+    enum cpu_state seen_state;
 
-    while ( cpu_state != CPU_STATE_DEAD )
+    while ( (seen_state = cpu_state) != CPU_STATE_DEAD )
     {
-        BUG_ON(cpu_state != CPU_STATE_DYING);
+        BUG_ON(seen_state != CPU_STATE_DYING);
         mdelay(100);
         cpu_relax();
         process_pending_softirqs();