lkml.org 
[lkml]   [2019]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@gmail.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

\
 
 \ /
  Last update: 2019-05-30 09:38    [W:0.041 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site