From: Kevin Hilman Date: Mon, 26 Oct 2009 23:50:18 +0000 (-0700) Subject: cpuidle: always return with interrupts enabled X-Git-Tag: v2.6.32-rc6~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=246eb7f0ed1a8aeddec5313137767658f378949b;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Signed-off-by: Kevin Hilman Cc: Arjan van de Ven Cc: Len Brown Cc: Venkatesh Pallipadi Cc: Ingo Molnar Cc: "Rafael J. Wysocki" Tested-by: Martin Michlmayr Cc: [2.6.31.x] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index ad41f19..12fdd39 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -76,8 +76,11 @@ static void cpuidle_idle_call(void) #endif /* ask the governor for the next state */ next_state = cpuidle_curr_governor->select(dev); - if (need_resched()) + if (need_resched()) { + local_irq_enable(); return; + } + target_state = &dev->states[next_state]; /* enter the state and update stats */