CPUidle: always return with interrupts enabled
Subsystems (2)
PATCH 1/1 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.
This patch ensures IRQs are (re)enabled before returning.
--- drivers/cpuidle/cpuidle.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/cpuidle/cpuidle.c +4 -1
@@ -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 */
Signature · 1 line
1.6.4.3
Quoted 4 lines · Kevin Hilman
In the case where
cpuidle_idle_call()returns before changing state due to aneed_resched(), it was returning with IRQs disabled.This patch ensures IRQs are (re)enabled before returning.
Venki, any comments on this?
Quoted 13 lines
Reported-by Hemanth V <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- drivers/cpuidle/cpuidle.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/cpuidle/cpuidle.c +0
-0@@ -76,8 +76,11 @@ static void cpuidle_idle_call(void)#endif /* ask the governor for the next state */
drivers/cpuidle/cpuidle.c static void cpuidle_idle_call(void) · line 86
Quoted 10 lines
drivers/cpuidle/cpuidle.c +4
-1next_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 */
Best,
Rafael
Quoted 7 lines · On Wed, 30 Sep 2009 23:21:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 4 lines · Kevin Hilman
In the case where
cpuidle_idle_call()returns before changing state due to aneed_resched(), it was returning with IRQs disabled.This patch ensures IRQs are (re)enabled before returning.
Venki, any comments on this?
Rigor mortis is setting in on this one.
Venki's most recent linux-acpi email was on July 31.
Quoted 22 lines
Quoted 22 lines
Reported-by Hemanth V <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- drivers/cpuidle/cpuidle.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/cpuidle/cpuidle.c +4
-1@@ -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];
Quoted 1 line
drivers/cpuidle/cpuidle.c static void cpuidle_idle_call(void) · line 86
Quoted 1 line
drivers/cpuidle/cpuidle.c +0
-0/* enter the state and update stats */
The patch seems correct to me. The code is hopelessly poorly documented as per usual, but other paths in that function, including the call to target_state->enter() (which devolves to default_idle) also enable interrupts.
Kevin, the changelog is not good. It tells us what was wrong with the code but does not describe the user-visible effects of the bug.
I'm unable to find any bug report from Hemanth so I'm all in the dark.
Your cc to linux-omap makes me suspect that <whatever the problem was> was exhibited on a non-x86 platform, under some circumstances. Perhaps that explains (for unknown reasons) why <whatever the problem was> was not observed on x86. But I'm totally in the dark and grasping for clues and have no way of determining (for example) whether we should backport the fix to earlier kernels.
Please send along the additional information?
Quoted 44 lines · Andrew Morton
Quoted 7 lines · On Wed, 30 Sep 2009 23:21:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 4 lines · Kevin Hilman
In the case where
cpuidle_idle_call()returns before changing state due to aneed_resched(), it was returning with IRQs disabled.This patch ensures IRQs are (re)enabled before returning.
Venki, any comments on this?
Rigor mortis is setting in on this one.
Venki's most recent linux-acpi email was on July 31.
Quoted 22 lines
Quoted 22 lines
Reported-by Hemanth V <[email protected]>Signed-off-by Kevin Hilman <[email protected]>---
drivers/cpuidle/cpuidle.c | 5 ++++-1 files changed, 4 insertions(+), 1 deletions(-)drivers/cpuidle/cpuidle.c +4
-1@@ -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];Quoted 1 line
drivers/cpuidle/cpuidle.c static void cpuidle_idle_call(void) · line 86
Quoted 1 line
drivers/cpuidle/cpuidle.c +0
-0/* enter the state and update stats */The patch seems correct to me. The code is hopelessly poorly documented as per usual, but other paths in that function, including the call to
target_state->enter()(which devolves todefault_idle) also enable interrupts.
Quoted 2 lines
Kevin, the changelog is not good. It tells us what was wrong with the code but does not describe the user-visible effects of the bug.
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.
Quoted 11 lines
I'm unable to find any bug report from Hemanth so I'm all in the dark.
Your cc to linux-omap makes me suspect that <whatever the problem was> was exhibited on a non-x86 platform, under some circumstances. Perhaps that explains (for unknown reasons) why <whatever the problem was> was not observed on x86. But I'm totally in the dark and grasping for clues and have no way of determining (for example) whether we should backport the fix to earlier kernels.
Please send along the additional information?
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.
Thanks,
Kevin
Martin Michlmayr
Tested-byQuoted 3 lines · Andrew Morton
Rigor mortis is setting in on this one.
The patch seems correct to me.
Can someone put this patch in now? The problem has also been reported on Marvell's Kirkwood platform (ARM) by a number of users and the patch fixes it.
Please CC stable when you commit the patch since it also needs to go in for 2.6.31.
Reference with the patch: http://patchwork.kernel.org/patch/50728/
Signature · 2 lines
Martin Michlmayr http://www.cyrius.com/
Quoted 10 lines · On Fri, 16 Oct 2009 17:25:04 +0100 Martin Michlmayr <[email protected]> wrote:
Quoted 3 lines · Andrew Morton
Rigor mortis is setting in on this one.
The patch seems correct to me.
Can someone put this patch in now? The problem has also been reported on Marvell's Kirkwood platform (ARM) by a number of users and the patch fixes it.
Tested-by Martin Michlmayr <[email protected]>
I have it in my for-2.6.32 queue.
Quoted 2 lines
Please CC stable when you commit the patch since it also needs to go in for 2.6.31.
hm, I didn't know that. So noted, thanks.
Martin Michlmayr
Tested-byQuoted 3 lines · Andrew Morton
Rigor mortis is setting in on this one.
The patch seems correct to me.
Can someone put this patch in now? The problem has also been reported on Marvell's Kirkwood platform (ARM) by a number of users and the patch fixes it.
Please CC stable when you commit the patch since it also needs to go in for 2.6.31.
Reference with the patch: http://patchwork.kernel.org/patch/50728/
Signature · 2 lines
Martin Michlmayr http://www.cyrius.com/
Quoted 4 lines · Kevin Hilman
In the case where
cpuidle_idle_call()returns before changing state due to aneed_resched(), it was returning with IRQs disabled.This patch ensures IRQs are (re)enabled before returning.
Venki, any comments on this?
Quoted 13 lines
Reported-by Hemanth V <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- drivers/cpuidle/cpuidle.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/cpuidle/cpuidle.c +0
-0@@ -76,8 +76,11 @@ static void cpuidle_idle_call(void)#endif /* ask the governor for the next state */
drivers/cpuidle/cpuidle.c static void cpuidle_idle_call(void) · line 86
Quoted 10 lines
drivers/cpuidle/cpuidle.c +4
-1next_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 */
Best,
Rafael