Am Montag, 18. April 2005 04:24 schrieb Alan Stern: > On Sun, 17 Apr 2005, Oliver Neukum wrote: > > > > Using spin_lock_bh() in enqueue or dequeue isn't a solution because > > > existing code already calls these routines with interrupts disabled. > > > > How so? If you convert the irq code to a tasklet, it'll run in a tasklet. > > Yes it will. But it will still disable interrupts before calling > completion handlers. It has to; that's a guarantee of the API. So if a > completion handler resubmits its URB, that submission will have to be > handled with interrupts disabled.
As calling the completion handler is the latest major operation in handling an interrupt, it seems to me that you've already broken the guarantee that there will be no intervening interrupts, if you have used any tasklet in between. I don't see any way you could call the completion handler earlier. So if a driver really needs interrupts off in the completion handler why not let it switch them off itself? A problem is pt_regs. Even if you save them in the URB, you destroy the stack they relate to. > Furthermore, there's nothing to prevent USB device drivers from calling > usb_submit_urb() or usb_unlink_urb() while they have disabled interrupts > for their own reasons. That's a perfectly legal thing to do, but again it > means that enqueue and dequeue can be called with interrupts disabled. Their own fault. Drivers can do any number of stupid things with interrupts disabled. Regards Oliver ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel