* [PATCH RFC 11/26] arm: Remove spin_unlock_wait() arch-specific definitions [not found] <20170629235918.GA6445@linux.vnet.ibm.com> @ 2017-06-30 0:01 ` Paul E. McKenney 2017-06-30 0:01 ` [PATCH RFC 12/26] arm64: " Paul E. McKenney 1 sibling, 0 replies; 4+ messages in thread From: Paul E. McKenney @ 2017-06-30 0:01 UTC (permalink / raw) To: linux-arm-kernel There is no agreed-upon definition of spin_unlock_wait()'s semantics, and it appears that all callers could do just as well with a lock/unlock pair. This commit therefore removes the underlying arch-specific arch_spin_unlock_wait(). Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Russell King <linux@armlinux.org.uk> Cc: <linux-arm-kernel@lists.infradead.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Andrea Parri <parri.andrea@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> --- arch/arm/include/asm/spinlock.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h index 4bec45442072..c030143c18c6 100644 --- a/arch/arm/include/asm/spinlock.h +++ b/arch/arm/include/asm/spinlock.h @@ -52,22 +52,6 @@ static inline void dsb_sev(void) * memory. */ -static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) -{ - u16 owner = READ_ONCE(lock->tickets.owner); - - for (;;) { - arch_spinlock_t tmp = READ_ONCE(*lock); - - if (tmp.tickets.owner == tmp.tickets.next || - tmp.tickets.owner != owner) - break; - - wfe(); - } - smp_acquire__after_ctrl_dep(); -} - #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) static inline void arch_spin_lock(arch_spinlock_t *lock) -- 2.5.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH RFC 12/26] arm64: Remove spin_unlock_wait() arch-specific definitions [not found] <20170629235918.GA6445@linux.vnet.ibm.com> 2017-06-30 0:01 ` [PATCH RFC 11/26] arm: Remove spin_unlock_wait() arch-specific definitions Paul E. McKenney @ 2017-06-30 0:01 ` Paul E. McKenney 2017-06-30 9:20 ` Will Deacon 1 sibling, 1 reply; 4+ messages in thread From: Paul E. McKenney @ 2017-06-30 0:01 UTC (permalink / raw) To: linux-arm-kernel There is no agreed-upon definition of spin_unlock_wait()'s semantics, and it appears that all callers could do just as well with a lock/unlock pair. This commit therefore removes the underlying arch-specific arch_spin_unlock_wait(). Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: <linux-arm-kernel@lists.infradead.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Andrea Parri <parri.andrea@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> --- arch/arm64/include/asm/spinlock.h | 58 ++++----------------------------------- 1 file changed, 5 insertions(+), 53 deletions(-) diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index cae331d553f8..f445bd7f2b9f 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h @@ -26,58 +26,6 @@ * The memory barriers are implicit with the load-acquire and store-release * instructions. */ -static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) -{ - unsigned int tmp; - arch_spinlock_t lockval; - u32 owner; - - /* - * Ensure prior spin_lock operations to other locks have completed - * on this CPU before we test whether "lock" is locked. - */ - smp_mb(); - owner = READ_ONCE(lock->owner) << 16; - - asm volatile( -" sevl\n" -"1: wfe\n" -"2: ldaxr %w0, %2\n" - /* Is the lock free? */ -" eor %w1, %w0, %w0, ror #16\n" -" cbz %w1, 3f\n" - /* Lock taken -- has there been a subsequent unlock->lock transition? */ -" eor %w1, %w3, %w0, lsl #16\n" -" cbz %w1, 1b\n" - /* - * The owner has been updated, so there was an unlock->lock - * transition that we missed. That means we can rely on the - * store-release of the unlock operation paired with the - * load-acquire of the lock operation to publish any of our - * previous stores to the new lock owner and therefore don't - * need to bother with the writeback below. - */ -" b 4f\n" -"3:\n" - /* - * Serialise against any concurrent lockers by writing back the - * unlocked lock value - */ - ARM64_LSE_ATOMIC_INSN( - /* LL/SC */ -" stxr %w1, %w0, %2\n" - __nops(2), - /* LSE atomics */ -" mov %w1, %w0\n" -" cas %w0, %w0, %2\n" -" eor %w1, %w1, %w0\n") - /* Somebody else wrote to the lock, GOTO 10 and reload the value */ -" cbnz %w1, 2b\n" -"4:" - : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock) - : "r" (owner) - : "memory"); -} #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) @@ -176,7 +124,11 @@ static inline int arch_spin_value_unlocked(arch_spinlock_t lock) static inline int arch_spin_is_locked(arch_spinlock_t *lock) { - smp_mb(); /* See arch_spin_unlock_wait */ + /* + * Ensure prior spin_lock operations to other locks have completed + * on this CPU before we test whether "lock" is locked. + */ + smp_mb(); /* ^^^ */ return !arch_spin_value_unlocked(READ_ONCE(*lock)); } -- 2.5.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH RFC 12/26] arm64: Remove spin_unlock_wait() arch-specific definitions 2017-06-30 0:01 ` [PATCH RFC 12/26] arm64: " Paul E. McKenney @ 2017-06-30 9:20 ` Will Deacon 2017-06-30 17:29 ` Paul E. McKenney 0 siblings, 1 reply; 4+ messages in thread From: Will Deacon @ 2017-06-30 9:20 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jun 29, 2017 at 05:01:20PM -0700, Paul E. McKenney wrote: > There is no agreed-upon definition of spin_unlock_wait()'s semantics, > and it appears that all callers could do just as well with a lock/unlock > pair. This commit therefore removes the underlying arch-specific > arch_spin_unlock_wait(). > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will.deacon@arm.com> > Cc: <linux-arm-kernel@lists.infradead.org> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Alan Stern <stern@rowland.harvard.edu> > Cc: Andrea Parri <parri.andrea@gmail.com> > Cc: Linus Torvalds <torvalds@linux-foundation.org> > --- > arch/arm64/include/asm/spinlock.h | 58 ++++----------------------------------- > 1 file changed, 5 insertions(+), 53 deletions(-) I'm going to miss this code. Acked-by: Will Deacon <will.deacon@arm.com> Will ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RFC 12/26] arm64: Remove spin_unlock_wait() arch-specific definitions 2017-06-30 9:20 ` Will Deacon @ 2017-06-30 17:29 ` Paul E. McKenney 0 siblings, 0 replies; 4+ messages in thread From: Paul E. McKenney @ 2017-06-30 17:29 UTC (permalink / raw) To: linux-arm-kernel On Fri, Jun 30, 2017 at 10:20:57AM +0100, Will Deacon wrote: > On Thu, Jun 29, 2017 at 05:01:20PM -0700, Paul E. McKenney wrote: > > There is no agreed-upon definition of spin_unlock_wait()'s semantics, > > and it appears that all callers could do just as well with a lock/unlock > > pair. This commit therefore removes the underlying arch-specific > > arch_spin_unlock_wait(). > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > > Cc: Catalin Marinas <catalin.marinas@arm.com> > > Cc: Will Deacon <will.deacon@arm.com> > > Cc: <linux-arm-kernel@lists.infradead.org> > > Cc: Peter Zijlstra <peterz@infradead.org> > > Cc: Alan Stern <stern@rowland.harvard.edu> > > Cc: Andrea Parri <parri.andrea@gmail.com> > > Cc: Linus Torvalds <torvalds@linux-foundation.org> > > --- > > arch/arm64/include/asm/spinlock.h | 58 ++++----------------------------------- > > 1 file changed, 5 insertions(+), 53 deletions(-) > > I'm going to miss this code. ;-) ;-) ;-) > Acked-by: Will Deacon <will.deacon@arm.com> Applied, thank you! Thanx, Paul ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-30 17:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170629235918.GA6445@linux.vnet.ibm.com>
2017-06-30 0:01 ` [PATCH RFC 11/26] arm: Remove spin_unlock_wait() arch-specific definitions Paul E. McKenney
2017-06-30 0:01 ` [PATCH RFC 12/26] arm64: " Paul E. McKenney
2017-06-30 9:20 ` Will Deacon
2017-06-30 17:29 ` Paul E. McKenney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).