diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2009-10-26 19:50:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-29 10:39:31 -0400 |
commit | 246eb7f0ed1a8aeddec5313137767658f378949b (patch) | |
tree | 25cfbdab4d133ebb1539b3c8b4e302f1ca7866b3 /drivers/cpuidle/cpuidle.c | |
parent | 5e8d8f6f2844d4a663415c660ab5cc92e2e2477d (diff) |
cpuidle: always return with interrupts enabled
In the case where cpuidle_idle_call() returns before changing state due to
a need_resched(), it was returning with IRQs disabled.
The idle path assumes that the platform specific idle code returns with
interrupts enabled (although this too is undocumented AFAICT) and on ARM
we have a WARN_ON(!(irqs_disabled()) when returning from the idle loop, so
the user-visible effects were only a warning since interrupts were
eventually re-enabled later.
On x86, this same problem exists, but there is no WARN_ON() to detect it.
As on ARM, the interrupts are eventually re-enabled, so I'm not sure of
any actual bugs triggered by this. It's primarily a
correctness/consistency fix.
This patch ensures IRQs are (re)enabled before returning.
Reported-by: Hemanth V <hemanthv@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Tested-by: Martin Michlmayr <tbm@cyrius.com>
Cc: <stable@kernel.org> [2.6.31.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/cpuidle/cpuidle.c')
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index ad41f19b8e3f..12fdd3987a36 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -76,8 +76,11 @@ static void cpuidle_idle_call(void) | |||
76 | #endif | 76 | #endif |
77 | /* ask the governor for the next state */ | 77 | /* ask the governor for the next state */ |
78 | next_state = cpuidle_curr_governor->select(dev); | 78 | next_state = cpuidle_curr_governor->select(dev); |
79 | if (need_resched()) | 79 | if (need_resched()) { |
80 | local_irq_enable(); | ||
80 | return; | 81 | return; |
82 | } | ||
83 | |||
81 | target_state = &dev->states[next_state]; | 84 | target_state = &dev->states[next_state]; |
82 | 85 | ||
83 | /* enter the state and update stats */ | 86 | /* enter the state and update stats */ |