]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
s390/bitops,atomic: add missing memory barriers
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Thu, 20 Mar 2014 07:55:00 +0000 (08:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 May 2014 14:59:24 +0000 (07:59 -0700)
commit90f13e94a66ccf503e1eb15a5c7577a95422f56d
treee2b97bf4ea1ee8f1aaa80ade975770844e9055a0
parent6d807fb1a3280648dffbdb78751d762d07048b5a
s390/bitops,atomic: add missing memory barriers

commit 0ccc8b7ac86053388e793bad20bd26bd777752eb upstream.

When reworking the bitops and atomic ops I missed that those instructions
that got atomic behaviour only perform a "specific-operand-serialization"
instead of a full "serialization".
The compare-and-swap instruction used before performs a full serialization
before and after the instruction is executed, which means it has full
memory barrier semantics.
In order to give the new bitops and atomic ops functions also full memory
barrier semantics add a "bcr 14,0" before and after each of those new
instructions which performs full serialization as well.

This restores memory barrier semantics for bitops and atomic ops functions
which return values, like e.g. atomic_add_return(), but not for functions
which do not return a value, like e.g. atomic_add().
This is consistent to other architectures and what common code requires.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/include/asm/atomic.h
arch/s390/include/asm/bitops.h