]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ARM: 6194/1: change definition of cpu_relax() for ARM11MPCore
authorWill Deacon <will.deacon@arm.com>
Mon, 21 Jun 2010 14:29:03 +0000 (15:29 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 1 Jul 2010 09:13:52 +0000 (10:13 +0100)
Linux expects that if a CPU modifies a memory location, then that
modification will eventually become visible to other CPUs in the system.

On an ARM11MPCore processor, loads are prioritised over stores so it is
possible for a store operation to be postponed if a polling loop immediately
follows it. If the variable being polled indirectly depends on the outstanding
store [for example, another CPU may be polling the variable that is pending
modification] then there is the potential for deadlock if interrupts are
disabled. This deadlock occurs in the KGDB testsuire when executing on an
SMP ARM11MPCore configuration.

This patch changes the definition of cpu_relax() to smp_mb() for ARMv6 cores,
forcing a flushing of the write buffer on SMP systems before the next load
takes place. If the Kernel is not compiled for SMP support, this will expand
to a barrier() as before.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/processor.h

index 6a89567ffc5bc49a326c0a56747aced339fd53db..7bed3daf83b8f27547ac608d574ffb00de8d1871 100644 (file)
@@ -91,7 +91,11 @@ extern void release_thread(struct task_struct *);
 
 unsigned long get_wchan(struct task_struct *p);
 
+#if __LINUX_ARM_ARCH__ == 6
+#define cpu_relax()                    smp_mb()
+#else
 #define cpu_relax()                    barrier()
+#endif
 
 /*
  * Create a new kernel thread