lkml.org 
[lkml]   [2011]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Lockdep and rw_semaphores
On Tue, Sep 13, 2011 at 09:55:25PM -0400, Vladislav Bolkhovitin wrote:

> > thread 1:
> > down_read(&A); /* got it */
> > thread 2:
> > down_read(&B); /* got it */
> > thread 3:
> > down_write(&A); /* blocked until thread 1 releases A */

That's the only thread here doing down_write() on A

> > thread 4:
> > down_write(&B); /* blocked until thread 2 releases B */

... and that's the only thread here doing down_write() on B. And neither
of those is holding any other locks. No nesting.

> 1. Reverse read locking isn't always a deadlock. For instance, if only 1 write
> thread participating and doesn't do nested write locking, which is a quite valid
> scenario, because by design of rw locks they are used with many readers and
> limited amount of rare writers.

Um? If you mean that here we have two threads doing down_write(), remember
that you've got two locks.

> So, it should be better if this warning is issued, if there is >1 thread write
> locking detected on any participated rw lock, and illustrated with a correct
> explanation.

Which would be which threads, in the situation described above? Again,
we have no nesting for writes and we have one thread attempting down_write()
for any given lock. Two locks, two writers in total...


\
 
 \ /
  Last update: 2011-09-14 06:43    [W:0.039 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site