diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:59:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:59:11 -0500 |
commit | 4522d58275f124105819723e24e912c8e5bf3cdd (patch) | |
tree | b92c29014fadffe049c1925676037f0092b8d112 /arch/x86_64/kernel/process.c | |
parent | 6cf24f031bc97cb5a7c9df3b6e73c45b628b2b28 (diff) | |
parent | 64a26a731235b59c9d73bbe82c1f896d57400d37 (diff) |
Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
* 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (156 commits)
[PATCH] x86-64: Export smp_call_function_single
[PATCH] i386: Clean up smp_tune_scheduling()
[PATCH] unwinder: move .eh_frame to RODATA
[PATCH] unwinder: fully support linker generated .eh_frame_hdr section
[PATCH] x86-64: don't use set_irq_regs()
[PATCH] x86-64: check vector in setup_ioapic_dest to verify if need setup_IO_APIC_irq
[PATCH] x86-64: Make ix86 default to HIGHMEM4G instead of NOHIGHMEM
[PATCH] i386: replace kmalloc+memset with kzalloc
[PATCH] x86-64: remove remaining pc98 code
[PATCH] x86-64: remove unused variable
[PATCH] x86-64: Fix constraints in atomic_add_return()
[PATCH] x86-64: fix asm constraints in i386 atomic_add_return
[PATCH] x86-64: Correct documentation for bzImage protocol v2.05
[PATCH] x86-64: replace kmalloc+memset with kzalloc in MTRR code
[PATCH] x86-64: Fix numaq build error
[PATCH] x86-64: include/asm-x86_64/cpufeature.h isn't a userspace header
[PATCH] unwinder: Add debugging output to the Dwarf2 unwinder
[PATCH] x86-64: Clarify error message in GART code
[PATCH] x86-64: Fix interrupt race in idle callback (3rd try)
[PATCH] x86-64: Remove unwind stack pointer alignment forcing again
...
Fixed conflict in include/linux/uaccess.h manually
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/process.c')
-rw-r--r-- | arch/x86_64/kernel/process.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 7451a4c43c16..a418ee4c8c62 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c | |||
@@ -108,17 +108,15 @@ void exit_idle(void) | |||
108 | */ | 108 | */ |
109 | static void default_idle(void) | 109 | static void default_idle(void) |
110 | { | 110 | { |
111 | local_irq_enable(); | ||
112 | |||
113 | current_thread_info()->status &= ~TS_POLLING; | 111 | current_thread_info()->status &= ~TS_POLLING; |
114 | smp_mb__after_clear_bit(); | 112 | smp_mb__after_clear_bit(); |
115 | while (!need_resched()) { | 113 | local_irq_disable(); |
116 | local_irq_disable(); | 114 | if (!need_resched()) { |
117 | if (!need_resched()) | 115 | /* Enables interrupts one instruction before HLT. |
118 | safe_halt(); | 116 | x86 special cases this so there is no race. */ |
119 | else | 117 | safe_halt(); |
120 | local_irq_enable(); | 118 | } else |
121 | } | 119 | local_irq_enable(); |
122 | current_thread_info()->status |= TS_POLLING; | 120 | current_thread_info()->status |= TS_POLLING; |
123 | } | 121 | } |
124 | 122 | ||
@@ -130,15 +128,7 @@ static void default_idle(void) | |||
130 | static void poll_idle (void) | 128 | static void poll_idle (void) |
131 | { | 129 | { |
132 | local_irq_enable(); | 130 | local_irq_enable(); |
133 | 131 | cpu_relax(); | |
134 | asm volatile( | ||
135 | "2:" | ||
136 | "testl %0,%1;" | ||
137 | "rep; nop;" | ||
138 | "je 2b;" | ||
139 | : : | ||
140 | "i" (_TIF_NEED_RESCHED), | ||
141 | "m" (current_thread_info()->flags)); | ||
142 | } | 132 | } |
143 | 133 | ||
144 | void cpu_idle_wait(void) | 134 | void cpu_idle_wait(void) |
@@ -219,6 +209,12 @@ void cpu_idle (void) | |||
219 | idle = default_idle; | 209 | idle = default_idle; |
220 | if (cpu_is_offline(smp_processor_id())) | 210 | if (cpu_is_offline(smp_processor_id())) |
221 | 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(); | ||
222 | enter_idle(); | 218 | enter_idle(); |
223 | idle(); | 219 | idle(); |
224 | /* In many cases the interrupt that ended idle | 220 | /* In many cases the interrupt that ended idle |
@@ -256,9 +252,16 @@ void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) | |||
256 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ | 252 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ |
257 | static void mwait_idle(void) | 253 | static void mwait_idle(void) |
258 | { | 254 | { |
259 | local_irq_enable(); | 255 | if (!need_resched()) { |
260 | while (!need_resched()) | 256 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
261 | mwait_idle_with_hints(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 | } | ||
262 | } | 265 | } |
263 | 266 | ||
264 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | 267 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) |