s390/spinlock: use correct barriers
authorChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 11 Sep 2015 14:09:56 +0000 (16:09 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 14 Oct 2015 12:32:00 +0000 (14:32 +0200)
_raw_write_lock_wait first sets the high order bit to indicate a
pending writer and then waits for the reader to drop to zero.
smp_rmb by definition only orders reads against reads. Let's use
a full smp_mb instead. As right now smp_rmb is implemented
as full serialization, this needs no stable backport, but this
patch will be necessary if we reimplement smp_rmb.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/lib/spinlock.c

index d6c9991f77975e430f738bbbb802ae5e221ab46d..427aa44b35051ff01e745493bc89dbf5fc4c7d81 100644 (file)
@@ -197,7 +197,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw, unsigned int prev)
                }
                old = ACCESS_ONCE(rw->lock);
                owner = ACCESS_ONCE(rw->owner);
-               smp_rmb();
+               smp_mb();
                if ((int) old >= 0) {
                        prev = __RAW_LOCK(&rw->lock, 0x80000000, __RAW_OP_OR);
                        old = prev;
@@ -231,7 +231,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw)
                    _raw_compare_and_swap(&rw->lock, old, old | 0x80000000))
                        prev = old;
                else
-                       smp_rmb();
+                       smp_mb();
                if ((old & 0x7fffffff) == 0 && (int) prev >= 0)
                        break;
                if (MACHINE_HAS_CAD)