Commit e0af21c5 authored by Christian Borntraeger's avatar Christian Borntraeger Committed by Martin Schwidefsky

s390/spinlock: use correct barriers

_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: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 9a212683
...@@ -197,7 +197,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw, unsigned int prev) ...@@ -197,7 +197,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw, unsigned int prev)
} }
old = ACCESS_ONCE(rw->lock); old = ACCESS_ONCE(rw->lock);
owner = ACCESS_ONCE(rw->owner); owner = ACCESS_ONCE(rw->owner);
smp_rmb(); smp_mb();
if ((int) old >= 0) { if ((int) old >= 0) {
prev = __RAW_LOCK(&rw->lock, 0x80000000, __RAW_OP_OR); prev = __RAW_LOCK(&rw->lock, 0x80000000, __RAW_OP_OR);
old = prev; old = prev;
...@@ -231,7 +231,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw) ...@@ -231,7 +231,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw)
_raw_compare_and_swap(&rw->lock, old, old | 0x80000000)) _raw_compare_and_swap(&rw->lock, old, old | 0x80000000))
prev = old; prev = old;
else else
smp_rmb(); smp_mb();
if ((old & 0x7fffffff) == 0 && (int) prev >= 0) if ((old & 0x7fffffff) == 0 && (int) prev >= 0)
break; break;
if (MACHINE_HAS_CAD) if (MACHINE_HAS_CAD)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment