[+Boqun]

On Wed, May 23, 2018 at 08:25:06AM -0700, Linus Torvalds wrote:
> On Wed, May 23, 2018 at 6:05 AM Will Deacon <will.dea...@arm.com> wrote:
> 
> > Please use a newer kernel. We've addressed this in mainline by moving
> > arm64 over to the qrwlock implementation which (after some other changes)
> > guarantees forward progress for well-behaved readers and writers.
> 
> Oh, I didn't even realize that this wasn't x86, and that there was still
> the very unfair rwlock issue on 4.14 on arm.
> 
> Yeah, the queuing rwlocks shouldn't show the really pathological problems
> we used to have long ago.

Yup, although they do reveal new issues that Boqun has been running into
recently with his lockdep improvements. The general pattern is if you
have:

P0:                     P1:                     P2:

spin_lock(&slock)       read_lock(&rwlock)      write_lock(&rwlock)
read_lock(&rwlock)      spin_lock(&slock)

then the CPUs can be queued on the rwlock such that P1 has the lock, then
P2 is queued and then P0. If P0 has taken the spinlock, we have a deadlock
which wouldn't arise with the non-queued version.

In other words, qrwlock requires consistent locking order wrt spinlocks.

Will

Reply via email to