Re: timers and busy detection

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

> Hi,
> 
> I'd like to make the following change to autosuspend:
> 
> --- linux-2.6.21-rc4-git6/include/linux/usb.h.alt	2007-03-22 14:26:26.000000000 +0100
> +++ linux-2.6.21-rc4-git6/include/linux/usb.h	2007-03-22 14:28:18.000000000 +0100
> @@ -155,6 +155,9 @@
>  	struct device dev;		/* interface specific device info */
>  	struct device *usb_dev;		/* pointer to the usb class's device, if any */
>  	int pm_usage_cnt;		/* usage counter for autosuspend */
> +	spinlock_t			suspend_time_lock;
> +	unsigned long			last_busy;
> +	unsigned long			last_elevated;
>  };
>  #define	to_usb_interface(d) container_of(d, struct usb_interface, dev)
>  #define	interface_to_usbdev(intf) \

I'm fine with adding last_busy; in fact I'm planning on it.  (But perhaps
it will be named "last_used".)

I'm not so sure about suspend_time_lock -- only a few devices will need it
and it could just as easily go into the driver's private data structure.  
Maybe a lot of drivers will end up needing it and it should go into the
core, but that seems unlikely.

I don't understand last_elevated at all.  If the device's usage count is 
currently above 0, wouldn't last_elevated be equal to last_busy?  Is it 
just meant for keeping track of how long the device was in use?

> To avoid manipulating timers in autosuspend for usb storage, I propose
> that the timer is killed only if autosuspend_delay > jiffies - last_elevated.
> Otherwise it is kept running and last_busy can be used to calculate whether
> enough time has elapsed.
> 
> Might it be sensible to fire up a timer for longer than autosuspend_delay if
> the check fails often?

Can you explain in more detail what you want to accomplish here?  I'm
still puzzled.  Are you trying to avoid letting the timer expire
repeatedly while the device is in use for a prolonged time?

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[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.