Mailing List Archive

[xen-4.1-testing] x86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check.
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1299341152 0
# Node ID 0f9f2248127e91ae95ca9b8b9b2db17ad0719bcb
# Parent 9d4cdf7d70b9ef9e2907954e42600a2eed71947d
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 <keir@xen.org>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
xen-unstable changeset: 22977:bbc03993d31f
xen-unstable date: Sat Mar 05 16:02:33 2011 +0000
---


diff -r 9d4cdf7d70b9 -r 0f9f2248127e xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c Sat Mar 05 11:37:42 2011 +0000
+++ b/xen/arch/x86/smpboot.c Sat Mar 05 16:05:52 2011 +0000
@@ -861,10 +861,11 @@
{
/* 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();

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog