On Thu, 30 Jun 2016, Manfred Spraul wrote:
On 06/28/2016 07:27 AM, Davidlohr Bueso wrote:
If I understand it right, it means that spin_lock() is both an acquire
and a release - for qspinlocks.
I wouldn't say that: the _Q_LOCKED_VAL stores are still unordered inside
the acquire region but no further than the the unlock store-release; which
is fine for regular mutual exclusion.
It this valid for all spinlock implementations, for all architectures?
Otherwise: How can I detect in generic code if I can rely on a release
inside spin_lock()?
With ticket locks this was never an issue as special lock readers
(spin_unlock_wait(), spin_is_locked()) will always see the lock taken as
they observe waiters by adding itself to the tail -- something the above
commit mimics and piggy backs on to save expensive smp_rmb().
In addition, see 726328d92a4 (locking/spinlock, arch: Update and fix
spin_unlock_wait() implementations).
Thanks,
Davidlohr
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html