[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHttsrZ962Gw_6OA6J6GEhAx06yV70B5PEzqGEaYGDNSy57-3A@mail.gmail.com>
Date: Thu, 30 May 2019 15:37:50 +0800
From: Yuyang Du <duyuyang@...il.com>
To: Boqun Feng <boqun.feng@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>, will.deacon@....com,
Ingo Molnar <mingo@...nel.org>,
Bart Van Assche <bvanassche@....org>, ming.lei@...hat.com,
Frederic Weisbecker <frederic@...nel.org>, tglx@...utronix.de,
paulmck@...ux.ibm.com, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 11/17] locking/lockdep: Adjust lockdep selftest cases
Thanks for review.
On Wed, 29 May 2019 at 19:44, Boqun Feng <boqun.feng@...il.com> wrote:
>
> > @@ -424,7 +424,7 @@ static void rwsem_ABBA2(void)
> > ML(Y1);
> > RSL(X1);
> > RSU(X1);
> > - MU(Y1); // should fail
> > + MU(Y1); // should NOT fail
>
> I'm afraid you get this wrong ;-) reader of rwsem is non-recursive if I
> understand correctly, so case like:
>
> Task 0 Task 1
>
> down_read(A);
> mutex_lock(B);
>
> down_read(A);
> mutex_lock(B);
>
> can be a deadlock, if we consider a third independent task:
>
> Task 0 Task 1 Task 2
>
> down_read(A);
> mutex_lock(B);
> down_write(A);
> down_read(A);
> mutex_lock(B);
>
> in this case, Task 1 can not get it's lock for A, therefore, deadlock.
Well, yes. This situation is damn counterintuitive and looks
suboptimal, but I guess I can understand why this is done so. It is a
shame read locks are not 100% concurrent. I wish I were bright enough
to have figured this out on my own.
Ok, now this perhaps can be easily remedied. it is merely a matter
that finally I can set straight the lock exclusiveness table, and then
from there the only change seems to be now only recursive-read locks
are no deadlock.
Thanks,
Yuyang
Powered by blists - more mailing lists