On Fri, 4 May 2007, Oliver Neukum wrote:

> Am Freitag, 4. Mai 2007 21:46 schrieb Alan Stern:
> > On Fri, 4 May 2007, Oliver Neukum wrote:
> > 
> > > > A better approach would be to have a routine which would block until 
> > > > all 
> > > > URBs on an anchor have completed.  With a timeout, so that they can be 
> > > > killed if they take too long.
> > > 
> > > I can't follow your logic here. The partial completion case has to be
> > > handled anyway, so what is gained waiting?
> > 
> > The URB's completion handler will see the unlink and treat it as a normal
> > I/O error (maybe even realize that the URB timed out).  The user's I/O
> > will fail just as it would in case of a normal timeout.  Remember, this is 
> > abnormal activity -- in the common case we expect there will be no timeout 
> > and no errors.
> 
> What makes you sure it is abnormal? What would impose an upper bound
> on the time a device may have data?

The bound isn't on the time a device may have data -- it's on the time 
allowed for a transfer to complete.  And the upper bound would be imposed 
by the driver.  How long is it willing to hold up suspend processing 
because of ongoing I/O?  The driver must decide one way or another.

(There's always an alternative; the driver could abort the suspend if I/O
is pending.  But that's the only choice: Either the suspend carries on and
the I/O fails, or the I/O succeeds and the suspend fails.)

The case you have in mind is usb-skeleton, where write requests are 
submitted and then forgotten.  I think it makes perfect sense to put an 
upper limit on the how much time the device has to accept the data.  
Especially since both the data and the suspend request come originally 
from userspace.

If one user causes problems for another by suspending the computer while 
the second user is trying to get some work done, there's not much the 
kernel can do to prevent it.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to