Re: deadlocks in using autopm interfaces

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Mon, 12 Feb 2007, Oliver Neukum wrote:

> Hi Alan, list,
> 
> I am having trouble using the usb_autopm_get/put_interface.
> To wake a device on demand I need to use usb_autopm_get_interface().
> However the driver needs to hold a lock while calling
> usb_autopm_put_interface(). The driver's suspend method in turn
> needs to take a lock to wait for ongoing IO. As the actual autosuspend
> takes places in a workqueue, there's a classic AB-BA deadlock involving
> the driver's lock and pm_mutex.

Are you talking about the proposed usb-storage autosuspend changes?

Where and why does the driver need to hold a lock while calling 
usb_autopm_put_interface()?

> I think the cleanest solution is to provide lockless versions and let
> the caller take pm_mutex.

That doesn't feel right...

Incidentally, you might consider the problems involved in adding 
autosuspend support to usb-skeleton.  Nothing special is needed, but 
getting the locking just right requires a good deal of care; you have to 
worry about the BKL in addition to the driver's own io_mutex.

Alan Stern


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.