diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-12-04 14:36:04 +0100 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-09-28 07:29:44 +0200 |
commit | 8153380379ecc8381f6d55f6497de31a36c75aa5 (patch) | |
tree | 37dd4e46216cd29ebcecd564cfb9f29e58fcb801 | |
parent | 1887aa07b6765d345dd79f26017aa2d15d49d7af (diff) | |
download | linux-8153380379ecc8381f6d55f6497de31a36c75aa5.tar.gz linux-8153380379ecc8381f6d55f6497de31a36c75aa5.tar.bz2 linux-8153380379ecc8381f6d55f6497de31a36c75aa5.zip |
s390/spinlock: use the cpu number +1 as spinlock value
The queued spinlock code will come out simpler if the encoding of
the CPU that holds the spinlock is (cpu+1) instead of (~cpu).
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/spinlock.h | 2 | ||||
-rw-r--r-- | arch/s390/lib/spinlock.c | 32 |
2 files changed, 17 insertions, 17 deletions
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h index 8182b521c42f..6727cc30d59b 100644 --- a/arch/s390/include/asm/spinlock.h +++ b/arch/s390/include/asm/spinlock.h @@ -48,7 +48,7 @@ static inline void arch_spin_relax(arch_spinlock_t *lock) static inline u32 arch_spin_lockval(int cpu) { - return ~cpu; + return cpu + 1; } static inline int arch_spin_value_unlocked(arch_spinlock_t lock) diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index b12663d653d8..ee73bcca7e6f 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c @@ -67,8 +67,8 @@ void arch_spin_lock_wait(arch_spinlock_t *lp) /* Pass the virtual CPU to the lock holder if it is not running */ owner = arch_load_niai4(&lp->lock); - if (owner && arch_vcpu_is_preempted(~owner)) - smp_yield_cpu(~owner); + if (owner && arch_vcpu_is_preempted(owner - 1)) + smp_yield_cpu(owner - 1); count = spin_retry; while (1) { @@ -87,8 +87,8 @@ void arch_spin_lock_wait(arch_spinlock_t *lp) * yield the CPU unconditionally. For LPAR rely on the * sense running status. */ - if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(~owner)) - smp_yield_cpu(~owner); + if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(owner - 1)) + smp_yield_cpu(owner - 1); } } EXPORT_SYMBOL(arch_spin_lock_wait); @@ -102,8 +102,8 @@ void arch_spin_lock_wait_flags(arch_spinlock_t *lp, unsigned long flags) /* Pass the virtual CPU to the lock holder if it is not running */ owner = arch_load_niai4(&lp->lock); - if (owner && arch_vcpu_is_preempted(~owner)) - smp_yield_cpu(~owner); + if (owner && arch_vcpu_is_preempted(owner - 1)) + smp_yield_cpu(owner - 1); count = spin_retry; while (1) { @@ -124,8 +124,8 @@ void arch_spin_lock_wait_flags(arch_spinlock_t *lp, unsigned long flags) * yield the CPU unconditionally. For LPAR rely on the * sense running status. */ - if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(~owner)) - smp_yield_cpu(~owner); + if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(owner - 1)) + smp_yield_cpu(owner - 1); } } EXPORT_SYMBOL(arch_spin_lock_wait_flags); @@ -158,8 +158,8 @@ void _raw_read_lock_wait(arch_rwlock_t *rw) owner = 0; while (1) { if (count-- <= 0) { - if (owner && arch_vcpu_is_preempted(~owner)) - smp_yield_cpu(~owner); + if (owner && arch_vcpu_is_preempted(owner - 1)) + smp_yield_cpu(owner - 1); count = spin_retry; } old = ACCESS_ONCE(rw->lock); @@ -198,8 +198,8 @@ void _raw_write_lock_wait(arch_rwlock_t *rw, int prev) owner = 0; while (1) { if (count-- <= 0) { - if (owner && arch_vcpu_is_preempted(~owner)) - smp_yield_cpu(~owner); + if (owner && arch_vcpu_is_preempted(owner - 1)) + smp_yield_cpu(owner - 1); count = spin_retry; } old = ACCESS_ONCE(rw->lock); @@ -226,8 +226,8 @@ void _raw_write_lock_wait(arch_rwlock_t *rw) owner = 0; while (1) { if (count-- <= 0) { - if (owner && arch_vcpu_is_preempted(~owner)) - smp_yield_cpu(~owner); + if (owner && arch_vcpu_is_preempted(owner - 1)) + smp_yield_cpu(owner - 1); count = spin_retry; } old = ACCESS_ONCE(rw->lock); @@ -265,8 +265,8 @@ void arch_lock_relax(int cpu) { if (!cpu) return; - if (MACHINE_IS_LPAR && !arch_vcpu_is_preempted(~cpu)) + if (MACHINE_IS_LPAR && !arch_vcpu_is_preempted(cpu - 1)) return; - smp_yield_cpu(~cpu); + smp_yield_cpu(cpu - 1); } EXPORT_SYMBOL(arch_lock_relax); |