Re: Question about change to ehci-hcd
Alan Stern <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 15 Aug 2007, David Brownell wrote: > On Wednesday 15 August 2007, Alan Stern wrote: > > It looks like the original code has a mistaken optimization there. If > > during a callback some driver submitted an URB and then unlinked it, > > the unlink would effectively get lost. > > Don't think so. As the comment says, the intent is to ensure that > there's a clear sync point: URBs submitted after that IRQ triggers > will not be processed by that IRQ. (Modulo delays actually getting > to that QH.) And since that's the only path through which unlinks > can ever be processed ... your scenario can't happen. Sorry, I don't understand how the driver works in enough detail. Maybe you can explain what I'm missing. Consider this scenario: Async URB A completes with an error, so the queue is stopped and A is given back. The completion handler submits URB B. Then either the handler unlinks B or else another CPU does so before the handler returns. qh_completions() stops scanning when it reaches the original dummy position, so it never sees B. When qh_completions() returns, does the queue get restarted? If B hadn't been unlinked then it certainly would (although I don't see where the code does so). Does the fact that B has been unlinked prevent the queue from getting restarted? As for the "resubmit forever" problem, it may be unavoidable. Once a queue is stopped, it must not be restarted until all of its unlinked URBs have been given back. If the completion handler submits and unlinks a new URB each time, the driver will either overflow its stack or loop forever. Alan Stern ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel