On Fri, 8 Aug 2003, David Brownell wrote:

> Alan Stern wrote:
> > If hcd_endpoint_disable() is called at the same time that an URB is
> > submitted for that endpoint, there is a nasty race.  
> 
> This may be just for UHCI.

I'm not familiar enough with the other drivers to know how they would be 
affected.

> > hcd_endpoint_disable() sets the endpoint maxpacket size to 0, in order to
> > prevent further submissions.  But meanwhile, the HC driver is trying to
> > packetize the original request into maxpacket-sized packets.  If maxpacket
> > is 0, the driver will hang.
> 
> Only UHCI does packetization in software.  (Except maybe for ISO.)
> 
> The other HCs do this all in hardware, it's part of the QH or ED;
> though they do use the maxpacket value on submit paths.  They use
> it when the QH/ED is initialized (which is at best rare in this path);
> and for some "short packet" case detection when setting up TDs
> (which won't matter here).
> 
> Doesn't look like hangs could happen for them, and the QH/ED will
> get disabled immediatly in any case.

Okay, so maybe only UHCI needs to be fixed.

> > This patch fixes the problem for UHCI.  Something equivalent is needed for 
> > the other HC drivers.
> 
> Ugh.  The problem is that endpoint state is scattered all over
> the place, instead of localized in one easy-to-lock spot.
> 
> Do you have a way to reproduce this scenario, so we can verify
> that the other HCDs don't hang?  If only UHCI needs this extra
> check (it's already done earlier on the submit path) I'd rather
> not change them.

I haven't tried.  But I suppose the effect could be simulated by inserting 
something like

        dev->epmaxpacketout[usb_pipeendpoint(pipe)] = 0;
        dev->epmaxpacketin[usb_pipeendpoint(pipe)] = 0;

at an appropriate spot in usb_submit_urb() (i.e., after the check is 
made).

Alan Stern



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to