Commit f0d781d5 authored by Yi Yang's avatar Yi Yang Committed by Greg Kroah-Hartman

USB: improve ehci_watchdog's side effect in CPU power management

ehci_watchdog will wake up CPU very frequently so that CPU
stays at C3 very short, average residence time is about 50
ms on Aspire One, but we expect it should be about 1 second
or more, so this kind of periodic timer is very bad for power
saving.

We can't remove this timer because of some bad USB controller
chipset, but at least we should reduce its side effect to as
possible as low.

This patch can make CPU stay at C3 longer, average residence time
is about twice as long as original. 

Please consider to apply it, thanks
Signed-off-by: default avatarYi Yang <yi.y.yang@intel.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e58dcebc
...@@ -181,14 +181,16 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action) ...@@ -181,14 +181,16 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
* the async ring; just the I/O watchdog. Note that if a * the async ring; just the I/O watchdog. Note that if a
* SHRINK were pending, OFF would never be requested. * SHRINK were pending, OFF would never be requested.
*/ */
if (timer_pending(&ehci->watchdog) enum ehci_timer_action oldactions = ehci->actions;
&& ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF))
& ehci->actions))
return;
if (!test_and_set_bit (action, &ehci->actions)) { if (!test_and_set_bit (action, &ehci->actions)) {
unsigned long t; unsigned long t;
if (timer_pending(&ehci->watchdog)
&& ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF))
& oldactions))
return;
switch (action) { switch (action) {
case TIMER_IO_WATCHDOG: case TIMER_IO_WATCHDOG:
t = EHCI_IO_JIFFIES; t = EHCI_IO_JIFFIES;
...@@ -204,7 +206,7 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action) ...@@ -204,7 +206,7 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1; t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1;
break; break;
} }
mod_timer(&ehci->watchdog, t + jiffies); mod_timer(&ehci->watchdog, round_jiffies(t + jiffies));
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment