Re: requirements for suspend()

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Tue, 8 May 2007, Oliver Neukum wrote:

> Am Dienstag, 8. Mai 2007 20:33 schrieb Alan Stern:
> > > > > +int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, int timeout)
> > > > > +{
> > > > > + int res;
> > > > > +
> > > > > + res = wait_event_timeout(anchor->wait, list_empty(&anchor->urb_list), timeout);
> > > > 
> > > > Maybe make this an interruptible wait?
> > > 
> > > For use in disconnect(), suspend() and pre_reset()? Theses can't handle
> > > signals.
> > 
> > What do you mean?  They don't have to handle signals.  They just have to
> > cut the timeout short when a signal arrives and then kill the outstanding
> > URBs.
> 
> Who would send a signal? If this is called with pending URBs, aren't
> tasks frozen?

disconnect() can be called as a result of a user doing:

	echo -n $device_name >/sys/bus/usb/drivers/$driver_name/unbind

and a signal could occur if the user presses ^C.  suspend() can also be 
called as a result of writing to sysfs.  pre_reset() can be called as 
part of a reset initiated through usbfs.  None of these things require 
tasks to be frozen.

> > Also, you don't want to contribute to the load average while you're 
> > waiting.
> 
> Why? This is a system function.

To tell the truth, I never understand the reason why interruptible waits
don't add to the load average and uninterruptible waits do.  As far as I
can see, a wait should never count as load since the process isn't doing
anything or using CPU time.


> > Is this really correct?  You might end up reporting one user's errors
> > to a different user.  But maybe that's the standard approach; I don't 
> > know...
> 
> We are mixing writes anyway.

Yeah.  Oh well.

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/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.