Re: [PATCH 1/8] lockdep: fix recursive read lock validation

Peter Zijlstra
2008-04-29T17:59:37Z

On Tue, 2008-04-29 at 19:45 +0200, Bart Van Assche wrote:

> Let's return to the starting point of this discussion. The patch at
> the start of this thread forbids to invert the lock order of reader
> locks. Why to forbid this if it can't trigger a deadlock ? At least in
> user space code, it's quite easy to trigger such inversion. In
> sufficiently complex code where functions call other functions while
> holding a reader lock, reader lock inversion can be hard to avoid.

Sure, but the whole point is: lockdep cannot track those rules. _that_
is why I'm choosing to forbid them.

Also, on Linux only rwlock_t allows reader recursion, and that lock type
really ought to die, all users should convert to RCU (if possible).

So I'm not thinking placing this restriction on kernel code is going to
be painful.