Re: [PATCH] USB: disable autosuspend by default for non-hubs

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

> > > This is unreasonably broad. The drivers may dictate that a device cannot
> > > autosuspend by not setting the flag. Why do you want to override their
> > > decision if they do set the flag?
> > 
> > Three reasons:
> > 
> >      1. It takes time to load driver modules, especially during bootup
> > 	when lots of things are happening.  During that time a device
> > 	can be autosuspended by mistake, even though the driver (had
> > 	it been present) would not have allowed it.
> 
> How can that happen? The proposal is to not suspend devices without drivers
> unless told via sysfs and leave the decision for devices with drivers to
> the drivers.

At the moment that's just another proposal (i.e., no code).  I wanted
to get something into 2.6.23 before the final release.

> >      2. Drivers don't know about all possible bad devices.  By erring
> > 	on the side of safety we can prevent (for example) storage 
> > 	devices that work in 2.6.22 from breaking in 2.6.23.
> > 
> >      3. It isn't a complete override of the driver's decision, since
> > 	the user can still enable autosuspend.  In fact there should be
> > 	a user program that checks each USB device, as it is detected,
> > 	against a database to see whether it should be allowed to
> > 	autosuspend and what the idle delay should be.
> 
> But you are forcing them through yet another hoop in user space.

You could call it that.  It doesn't have to be visible to users in the 
normal case where everything works; it could be handled automatically 
behind the scenes by udev or HAL.

And it doesn't really "force" anybody through anything.  If users don't
want to be bothered, they don't have to enable autosuspend.  
Everything will keep on working just as well as it has in the past.

> Drivers can do anything they want with their interfaces. It makes
> no sense to force it through user space for every driver. We must
> trust drivers.

This isn't a question of preventing drivers from doing things.  It's a 
matter of making policy decisions in userspace rather than in the 
kernel.

And it's not a question of trusting drivers.  I do trust the drivers; 
it's the devices which are untrustworthy.  

I suppose we could get a very similar effect by having the hub driver 
always set the autosuspend delay for hubs to 2 seconds and then telling 
users to set usbcore.autosuspend=-1 if they encounter problems.  But 
one way or another, it has to be possible for users to prevent devices 
from being autosuspended without rebuilding the kernel.

Keep in mind also that it's not always easy to tell when autosuspend is 
the culprit.  Look at Bugzilla #8885 for an example.  By not enabling 
it unless the user checks and makes sure it is okay, we can prevent a 
whole class of problems.

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
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.