Re: Semphore -> mutex in the device tree

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Stern
Date: Friday, April 18, 2008 - 7:27 am

On Fri, 18 Apr 2008, Peter Zijlstra wrote:


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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Semphore -> mutex in the device tree, Alan Stern, (Thu Apr 17, 8:22 am)
Re: Semphore -> mutex in the device tree, Peter Zijlstra, (Thu Apr 17, 8:45 am)
Re: Semphore -> mutex in the device tree, Alan Stern, (Thu Apr 17, 9:11 am)
Re: Semphore -> mutex in the device tree, Peter Zijlstra, (Thu Apr 17, 9:17 am)
Re: Semphore -> mutex in the device tree, Alan Stern, (Thu Apr 17, 11:43 am)
Re: Semphore -> mutex in the device tree, Peter Zijlstra, (Thu Apr 17, 11:32 pm)
Re: Semphore -> mutex in the device tree, Alan Stern, (Fri Apr 18, 7:27 am)
Re: Semphore -> mutex in the device tree, Peter Zijlstra, (Fri Apr 18, 8:32 am)
Re: Semphore -> mutex in the device tree, Alan Stern, (Fri Apr 18, 2:45 pm)