From: Oliver Neukum <oliver@neukum.org>
To: Alan Stern <stern@rowland.harvard.edu>, Greg KH <greg@kroah.com>
Cc: bluez-devel@lists.sourceforge.net,
Marcel Holtmann <marcel@holtmann.org>,
USB development list <linux-usb-devel@lists.sourceforge.net>
Subject: Re: [linux-usb-devel] Re: PATCH: (as265) Fix bluetooth driver's wait_for_urb()
Date: Wed, 28 Apr 2004 22:05:45 +0200 [thread overview]
Message-ID: <200404282205.45073.oliver@neukum.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0404281433040.678-100000@ida.rowland.org>
> However... Suppose you want to cancel an outstanding URB and then reuse
> that URB for a new request. Or suppose a driver's disconnect() routine
> has been called and it needs to cancel all outstanding URBs before
> allowing the driver to be unloaded from memory. In both cases it's
> necessary to wait until _after_ the completion handler has finished -- in
> the first case because you don't want to reuse the URB's data fields while
> the completion handler may still be looking at them, in the second case
> because you don't want the completion handler to try to run when its code
> segment has been unloaded.
>
> The second case is no longer an issue, even for the UHCI driver, because
> it now implements the appropriate endpoint_disable method. This will
> prevent the majority of possible problems.
Ceterum censeo: Until you've solved all problems, the issue still exists.
> But the first case still applies. (As does the case of maverick drivers
> like Bluetooth that don't use usb_free_urb().) So there has to be a way
> for a driver to wait until an URB's completion handler has finished.
> That's the need addressed by usb_wait_for_urb().
Is there anybody using a synchronous unlink who doesn't want that?
> > > At some future time we could consider replacing
> > > synchronous unlink_urb with asynchronous unlink plus wait_for_urb.
> >
> > Why? Does it cause undue hardship in the host controllers to have a
> > synchronous unlink_urb?
>
> There's two points of confusion here. First, the host controller drivers
> don't implement synchronous unlinking -- it's all handled higher up in
> core/hcd.c. As far as the HCDs are concerned everything is asynchronous.
As it should be.
> Second, synchronous unlink_urb doesn't do what is needed because it
> doesn't guarantee that the completion handler will have finished when it
> returns. It only guarantees that the completion handler will have
> finished if it returns _with no error_. A race can cause such an error,
> but the driver will still have to wait until the completion handler has
> finished. That's why usb_wait_for_urb() is needed.
But is very poorly implemented.
Regards
Oliver
prev parent reply other threads:[~2004-04-28 20:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44L0.0404281321520.1238-100000@ida.rowland.org>
2004-04-28 17:43 ` PATCH: (as265) Fix bluetooth driver's wait_for_urb() Greg KH
2004-04-28 18:08 ` [Bluez-devel] " Marcel Holtmann
2004-04-28 18:18 ` Greg KH
2004-04-28 22:05 ` [Bluez-devel] " Marcel Holtmann
2004-04-28 19:13 ` Alan Stern
2004-04-28 20:05 ` Oliver Neukum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200404282205.45073.oliver@neukum.org \
--to=oliver@neukum.org \
--cc=bluez-devel@lists.sourceforge.net \
--cc=greg@kroah.com \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=marcel@holtmann.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox