On Tue, 2 Mar 2004, David Brownell wrote:

> p.s. Alan, notice how the "unlink during submit" case works.
>        It's got to giveback(), as promised by the unlink logic.

I'm not familiar enough with the OHCI driver to say much about it (see
below), but I think the current code in UHCI does the Right Thing.

"Unlink during submit" means that during the brief interval after
hcd_submit_urb() has released the hcd_data_lock and before the HCD's
enqueue() method has committed to accepting the URB, hcd_unlink_urb() 
manages to run.  There's a race between the HCD enqueue() and dequeue() 
methods, and with "unlink during submit" dequeue() wins.

The dequeue() method doesn't have to queue the URB for giveback because
the enqueue is about to fail.  (Making that failure happen is important,
though!)  All the enqueue() method has to do is return an error code.

In fact, I don't see why your patch needed to acquire urb->lock.  As in 
the UHCI driver, the enqueue() and dequeue() methods guarantee mutual 
exclusion through the use of ohci->lock.  Once enqueue() owns that lock it 
doesn't matter if someone attempts an unlink-during-submit; it can't 
happen because dequeue() is blocked.  It would suffice to test urb->status 
without worrying about urb->lock.

Alan Stern



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to