[PATCH] PPC64: fix to Re: should cpus_in_xmon be volatile?

Paul Mackerras paulus at samba.org
Sat Nov 20 10:00:15 EST 2004


Linas Vepstas writes:

> Here's a patch that fixes a compiler warning.  It casts away volatile
> as per previous email.

I think this is a better approach: remove the volatile from
cpus_in_xmon, and put a barrier() in the loop that waits for the other
cpus to come in to xmon.

Signed-off-by: Paul Mackerras <paulus at samba.org>

diff -urN linux-2.5/arch/ppc64/xmon/xmon.c test/arch/ppc64/xmon/xmon.c
--- linux-2.5/arch/ppc64/xmon/xmon.c	2004-10-26 16:06:41.000000000 +1000
+++ test/arch/ppc64/xmon/xmon.c	2004-11-20 09:56:00.291426520 +1100
@@ -39,7 +39,7 @@
 #define skipbl	xmon_skipbl
 
 #ifdef CONFIG_SMP
-volatile cpumask_t cpus_in_xmon = CPU_MASK_NONE;
+cpumask_t cpus_in_xmon = CPU_MASK_NONE;
 static unsigned long xmon_taken = 1;
 static int xmon_owner;
 static int xmon_gate;
@@ -401,9 +401,11 @@
 		if (ncpus > 1) {
 			smp_send_debugger_break(MSG_ALL_BUT_SELF);
 			/* wait for other cpus to come in */
-			for (timeout = 100000000; timeout != 0; --timeout)
+			for (timeout = 100000000; timeout != 0; --timeout) {
 				if (cpus_weight(cpus_in_xmon) >= ncpus)
 					break;
+				barrier();
+			}
 		}
 		remove_bpts();
 		disable_surveillance();



More information about the Linuxppc64-dev mailing list