Re: [PATCH] ARCv2: spinlock: remove the extra smp_mb before lock, after unlock

From: Peter Zijlstra
Date: Fri Mar 08 2019 - 03:37:57 EST


On Thu, Mar 07, 2019 at 05:35:46PM -0800, Vineet Gupta wrote:
> @@ -68,8 +72,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
> smp_mb();
>
> lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__;
> -
> - smp_mb();
> }
>
> /*

> @@ -226,8 +218,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)
> smp_mb();
>
> rw->counter = __ARCH_RW_LOCK_UNLOCKED__;
> -
> - smp_mb();
> }
>
> #else /* !CONFIG_ARC_HAS_LLSC */

I'm thinking those assignments should be WRITE_ONCE() at the very least.