On Wed, 10 Dec 2003, David Brownell wrote: > Alan Stern wrote: > > > > Oliver has now convinced me of that. But the reasons are fairly subtle! > > Consider dummy_hcd for example. There's no obvious reason preventing it > > from calling giveback_urb directly from within the urb_dequeue routine. > > I see what you mean, but it's not quite what I meant; > we were probably talking past each other. Of course > that routine can be "reentrant" in the classic sense, > there's nothing preventing two HCDs from calling it > at the same time from separate CPUs, for example. > > What I meant was simpler: once _a given urb_ is given > back to the driver, then it doesn't matter any more to > usbcore. (Or at least to the HCDs...) > > That routine only matters to HCDs, and the only history > HCDs (should ever) need to care about is that related to > current invocations ... reentrancy isn't much of an issue, > except the potential lack of it.
Is it worth pursuing this topic? You are correct that once an URB is given back then it doesn't matter any more to the core. But reentrancy (for the _same_ URB) does matter to drivers, for the following obscure reason. Suppose a driver is waiting for an URB to become idle so it can be reused. Suppose it detects this by noticing when when the completion handler returns without having resubmitted the URB. Then we have this possible error situation: URB submitted URB completes -> call completion handler handler resubmits another CPU unlinks the URB -> reentrant call to the completion handler handler does not resubmit when the handler exits, the driver notices and believes the URB is now idle and available for reuse but the original handler is still running, so the URB really isn't idle If giveback_urb is never called reentrantly for the same URB, this can't happen. My new proposal from last night relies on that fact. Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel