On Wed, 29 Mar 2006, Pete Zaitcev wrote:

> Alan,
> 
> I looked at uhci_scan_schedule today, and it seems to me that the code
> which prevents re-entry is completely superfluous. I do not see a code
> path which would loop back through usb_giveback_urb and end in
> uhci_scan_schedule again. It is only called from ->stop, suspend,
> and an interrupt. The access from other CPU is bracketed with uhci->lock.

It's also called from uhci_hub_status_data.  But the entry points you
listed are already bad enough.  uhci->lock is dropped during
usb_giveback_urb, so access is not protected during a giveback.  Hence
either a stop or a suspend (not to mention hub_status_data) on another CPU
could re-enter uhci_scan_schedule.

> What do you think about dropping this code?

Not a good idea.  Don't forget that the interaction works the other way 
also.  If uhci_scan_schedule is running because it was called from stop, 
suspend, or hub_status_data, then it could be re-entered on another CPU 
because of an interrupt.

> I only noticed because Fujitsu submitted a patch for RHEL which backports
> this stuff, and they fumbled with spinlocks. But on their platform it's
> an instant death. Apparently, this mechanism is never excercised.
> It must be a carryover from some old implementation.

No, this is stuff I added relatively recently (i.e., within the last
couple of years) as part of my reorganization of the driver.  Those
re-entry paths are unlikely, admittedly, but since they exist the code is
needed.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to