From: Keir Fraser Date: Sat, 5 Mar 2011 16:02:33 +0000 (+0000) Subject: x86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check. X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e63aa7c25bcad93030b276c5fce6df175f4c4dd6;p=xen.git x86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check. Otherwise compiler may re-read cpu_state for the BUG_ON and see a modified value causing erroneous BUG. Signed-off-by: Keir Fraser Signed-off-by: Liu, Jinsong --- diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 7c14f06286..39eb583e84 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -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();