Re: [PATCH] lockdep: lock_set_subclass - reset a held lock'ssubclass

From: Peter Zijlstra
Date: Fri Aug 01 2008 - 16:50:20 EST


On Fri, 2008-08-01 at 11:06 -0700, Jeremy Fitzhardinge wrote:
> Peter Zijlstra wrote:
> > From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> > Subject: lockdep: lock_set_subclass - reset a held lock's subclass
> >
> > this can be used to reset a held lock's subclass, for arbitrary-depth
> > iterated data structures such as trees or lists which have per-node
> > locks.
> >
>
> Hey, can I use this to suppress the spurious lockdep warnings I get when
> I try to hold more than one pte lock at once?

No, you still cannot hold more than 48 locks at any one time, and this
somewhat horrible annotation only works if you don't generate double
classes in the same chain.

What it can do is:

L1
L2
U1
L3
U2
etc..

What you do is:

spin_lock(L1)
spin_lock_nested(L2, 1)
spin_unlock(L1);
lockdep_set_subclass(L2, 0); // because L1, who was 0 isn't there anymore
spin_lock_nested(L3, 1);
spin_unlock(L2);
lockdep_set_subclass(L2, 0); // blah blah..
etc...



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/