We must be talking at cross purposes. Are classes and subclasses all
that lockdep looks at?
Let's take a simpler example. Suppose driver D's probe routine
registers a child device. Then we have:
Subsystem: Register device A with driver core
Driver core: Lock device A with NESTING_PARENT
Call D:probe()
D:probe(): Register device B with driver core
as a child of A
Driver core: Lock device B with NESTING_PARENT
Call E:probe()
(where E is the appropriate driver for B). Is this a lockdep
violation? Both A and B are locked with the same nesting level,
because they are locked by the same code in the driver core, but
one is the parent of the other in the device tree.
Or maybe I misunderstood, and you're proposing to use a node's level in
the tree as its lockdep nesting level. In that case, consider this
example. Suppose driver D associates a private mutex M with each of
its devices. Suppose D is managing device A at level 4 and device B at
level 5. Then we might have:
D: Lock device B at level 5
D: Lock B's associated M
(which tells lockdep that M comes after level 5), together with
D: Lock device A at level 4
D: Lock A's associated M
D: Lock A's child at level 5
Won't this then be a lockdep violation (since M is now locked before a
device at level 5)?
Alan Stern
--