Re: [patch]a lockless method to alter pm count

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Am Dienstag, 24. April 2007 21:47 schrieb Alan Stern:
> On Tue, 24 Apr 2007, Oliver Neukum wrote:
> 
> > Hi,
> > 
> > some drivers'll need a lockless method to alter the pm count in order
> > to take locks by themselves in correct order.
> 
> (Minor comment: Acquiring the lock yourself to alter the pm count isn't
> quite the same as doing it locklessly.)
> 
> Can you give an example where this would be needed?  I can't think of one 
> offhand.

Certainly. I need this to do autosuspend for the storage driver.

usb_suspend()
usb_pm_lock(udev)
usb_suspend_both(udev)
storage:
storage_suspend()
mutex_lock(&us->dev_mutex);

The storage thread:
usb_stor_control_thread()
mutex_lock(&(us->dev_mutex));
usb_autopm_get_interface()

AB <-> BA deadlock

	Regards
		Oliver

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[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.