PR target/42263 - Patch backport fix for memory barriers to 4.4 branch

Ramana Radhakrishnan ramana.r@gmail.com
Fri Dec 11 00:17:00 GMT 2009


Hi,

This backports the fix for atomic operations and memory barriers to the 4.4 branch. Ok to commit after a round of testing ? 

cheers
Ramana


2009-12-11  Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>

	PR target/42263
	Backport from trunk.
	2009-12-03  Richard Earnshaw  <rearnsha@arm.com>

	* arm/linux-atomic.c (SYNC_LOCK_RELEASE): Place memory barrier
	before the lock release.


 
 /* On AAPCS systems, this is the "struct __va_list".  */
Index: gcc/config/arm/linux-atomic.c
===================================================================
--- gcc/config/arm/linux-atomic.c	(revision 155138)
+++ gcc/config/arm/linux-atomic.c	(working copy)
@@ -266,8 +266,10 @@
   void HIDDEN								\
   __sync_lock_release_##WIDTH (TYPE *ptr)				\
   {									\
+    /* All writes before this point must be seen before we release	\
+       the lock itself.  */						\
+    __kernel_dmb ();							\
     *ptr = 0;								\
-    __kernel_dmb ();							\
   }
 
 SYNC_LOCK_RELEASE (int,   4)





More information about the Gcc-patches mailing list