On Mon, 18 Apr 2005, Oliver Neukum wrote:

> 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.

There is no such guarantee.

>  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?

That would be okay with me, but it's not what the API says.

> A problem is pt_regs. Even if you save them in the URB, you destroy
> the stack they relate to.

Only with interrupts that occur while the tasklet is already running.  To 
what extent does it matter if the stack is destroyed?  As far as I know 
the only USB driver that uses pt_regs is the keyboard handler, for 
Alt-SysRq processing.

> > 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.

Well sure, but that doesn't help.  It's part of the API, it's necessary if
completion routines are called with interrupts disabled and they resubmit,
and it's why the mem_flags argument had to be added to usb_submit_urb.

By the way, I'm a little surprised at all the commotion caused by this
proposal to use a tasklet.  Plenty of other drivers and subsystems use
them.  The network code does almost everything in bottom halves, and it
doesn't suffer from any shortage of latency requirements.  And what about
the block layer?  Why should USB be any different?

Alan Stern



-------------------------------------------------------
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

Reply via email to