diff options
Diffstat (limited to 'arch/x86_64/kernel/process.c')
-rw-r--r-- | arch/x86_64/kernel/process.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 0b7b4caa4f74..a418ee4c8c62 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c | |||
@@ -127,6 +127,7 @@ static void default_idle(void) | |||
127 | */ | 127 | */ |
128 | static void poll_idle (void) | 128 | static void poll_idle (void) |
129 | { | 129 | { |
130 | local_irq_enable(); | ||
130 | cpu_relax(); | 131 | cpu_relax(); |
131 | } | 132 | } |
132 | 133 | ||
@@ -208,6 +209,12 @@ void cpu_idle (void) | |||
208 | idle = default_idle; | 209 | idle = default_idle; |
209 | if (cpu_is_offline(smp_processor_id())) | 210 | if (cpu_is_offline(smp_processor_id())) |
210 | play_dead(); | 211 | play_dead(); |
212 | /* | ||
213 | * Idle routines should keep interrupts disabled | ||
214 | * from here on, until they go to idle. | ||
215 | * Otherwise, idle callbacks can misfire. | ||
216 | */ | ||
217 | local_irq_disable(); | ||
211 | enter_idle(); | 218 | enter_idle(); |
212 | idle(); | 219 | idle(); |
213 | /* In many cases the interrupt that ended idle | 220 | /* In many cases the interrupt that ended idle |
@@ -245,8 +252,16 @@ void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) | |||
245 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ | 252 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ |
246 | static void mwait_idle(void) | 253 | static void mwait_idle(void) |
247 | { | 254 | { |
248 | local_irq_enable(); | 255 | if (!need_resched()) { |
249 | mwait_idle_with_hints(0,0); | 256 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
257 | smp_mb(); | ||
258 | if (!need_resched()) | ||
259 | __sti_mwait(0, 0); | ||
260 | else | ||
261 | local_irq_enable(); | ||
262 | } else { | ||
263 | local_irq_enable(); | ||
264 | } | ||
250 | } | 265 | } |
251 | 266 | ||
252 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | 267 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) |