Patch "powerpc: Make value-returning atomics fully ordered" has been added to the 3.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
powerpc: Make value-returning atomics fully ordered
to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
powerpc-make-value-returning-atomics-fully-ordered.patch
and it can be found in the queue-3.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
49e9cf3f0c04bf76ffa59242254110309554861dMon Sep 17 00:00:00 2001
From: Boqun Feng <[email protected]>
Date: Mon, 2 Nov 2015 09:30:31 +0800
Subject: powerpc: Make value-returning atomics fully ordered
From: Boqun Feng <[email protected]>
commit 49e9cf3f0c04bf76ffa59242254110309554861d upstream.
According to memory-barriers.txt:
Quoted 4 lines
Any atomic operation that modifies some state in memory and returns information about the state (old or new) implies an SMP-conditional general memory barrier (
smp_mb()) on each side of the actual operation ...
Which mean these operations should be fully ordered. However on PPC, PPC_ATOMIC_ENTRY_BARRIER is the barrier before the actual operation, which is currently "lwsync" if SMP=y. The leading "lwsync" can not guarantee fully ordered atomics, according to Paul Mckenney:
https://lkml.org/lkml/2015/10/14/970
To fix this, we define PPC_ATOMIC_ENTRY_BARRIER as "sync" to guarantee the fully-ordered semantics.
This also makes futex atomics fully ordered, which can avoid possible memory ordering problems if userspace code relies on futex system call for fully ordered semantics.
--- arch/powerpc/include/asm/synch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/synch.h +1 -1
@@ -44,7 +44,7 @@ static inline void isync(void)MAKE_LWSYNC_SECTION_ENTRY (97 , __lwsync_fixup);#define PPC_ACQUIRE_BARRIER "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER)#define PPC_RELEASE_BARRIER stringify_in_c(LWSYNC) "\n" -#define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(LWSYNC) "\n" +#define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(sync) "\n"#define PPC_ATOMIC_EXIT_BARRIER "\n" stringify_in_c(sync) "\n"#else #define PPC_ACQUIRE_BARRIER
Patches currently in stable-queue which might be from [email protected] are
queue-3.14/powerpc-make-value-returning-atomics-fully-ordered.patch queue-3.14/powerpc-make-cmp-xchg-and-their-atomic_-versions-fully.patch