• Heiko Carstens's avatar
    s390/bitops,atomic: add missing memory barriers · 0ccc8b7a
    Heiko Carstens authored
    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: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    0ccc8b7a
bitops.h 12.2 KB