]> git.baikalelectronics.ru Git - kernel.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)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 1 Apr 2014 07:23:35 +0000 (09:23 +0200)
commit7df1366809af95adcc0c796ba6c98a9eff32f76f
treeab5a74ecd88aba3d7060b2ff3cd7be60db8becc2
parentff97a3a1c823b7def6b764a68311d2347590c541
s390/bitops,atomic: add missing memory barriers

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.

Cc: stable@vger.kernel.org # v3.13+
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/atomic.h
arch/s390/include/asm/bitops.h