Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1680576
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions |
| Date | 2017-07-03 23:20 +0200 |
| Message-ID | <tZgVb-7a5-5@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <tY402-5YH-21@gated-at.bofh.it> <tYcqB-2Lm-5@gated-at.bofh.it> <tZ9qF-1XI-9@gated-at.bofh.it> <tZceT-3TE-43@gated-at.bofh.it> <tZcHT-43W-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jul 03, 2017 at 09:40:22AM -0700, Linus Torvalds wrote:
> On Mon, Jul 3, 2017 at 9:18 AM, Paul E. McKenney
> <paulmck@linux.vnet.ibm.com> wrote:
> >
> > Agreed, and my next step is to look at spin_lock() followed by
> > spin_is_locked(), not necessarily the same lock.
>
> Hmm. Most (all?) "spin_is_locked()" really should be about the same
> thread that took the lock (ie it's about asserts and lock debugging).
Good to know, that does make things easier. ;-)
I am not certain that it is feasible to automatically recognize
non-assert/non-debugging use cases of spin_is_locked(), but there is
aways manual inspection.
> The optimistic ABBA avoidance pattern for spinlocks *should* be
>
> spin_lock(inner)
> ...
> if (!try_lock(outer)) {
> spin_unlock(inner);
> .. do them in the right order ..
>
> so I don't think spin_is_locked() should have any memory barriers.
>
> In fact, the core function for spin_is_locked() is arguably
> arch_spin_value_unlocked() which doesn't even do the access itself.
OK, so we should rework any cases where people are relying on acquisition
of one spin_lock() being ordered with a later spin_is_locked() on some
other lock by that same thread.
Thanx, Paul
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-03 18:20 +0200
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-03 18:50 +0200
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions Will Deacon <will.deacon@arm.com> - 2017-07-03 19:20 +0200
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-04 00:40 +0200
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-04 01:00 +0200
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-04 02:50 +0200
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-04 03:00 +0200
Re: [PATCH RFC 08/26] locking: Remove spin_unlock_wait() generic definitions "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-03 23:20 +0200
csiph-web