Re: [PATCH 01/12] Use mutex instead of semaphore in driver core

Peter Zijlstra
2007-12-30T12:14:11Z

On Sat, 2007-12-29 at 22:42 -0800, David Brownell wrote:
> On Saturday 29 December 2007, Alan Stern wrote:

> > There's no way to remove these, which means there's
> > no way to prevent lockdep from issuing a warning.
>
> There may be no *efficient* way to do that. If it tracked
> every lock individually these false alarms could go away;
> but that would increase the overhead to create and destroy
> such locks too.

No, tracking locks individually defeats the power of lockdep, that is
warning of lock inversion before it actually happens. That really
requires classes.

Annotating a tree requires grouping per level, and that isn't
particularly hard (although I haven't yet tried it for the device tree -
doing this conversion is still on my todo list). The hardest part of the
device->sem conversion is the suspend/resume part, where it locks the
whole tree and lockdep is limited in tracking held locks.