diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-11-17 08:26:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-11-17 11:20:09 -0500 |
commit | dc1829a4c378d793fb3b95d56135d89a0d7ff72a (patch) | |
tree | 16f33c80d3f337e6eb330680342ebfceecc03b2e /arch | |
parent | 0796bdb7e9e4a48b401f4fba1ee5dc79a45528ef (diff) |
[PATCH] i386/x86_64: ACPI cpu_idle_wait() fix
The scheduler on Andreas Friedrich's hyperthreading system stopped
working properly: the scheduler would never move tasks to another CPU!
The lask known working kernel was 2.6.8.
After a couple of attempts to corner the bug, the following smoking gun
was found:
BIOS reported wrong ACPI idfor the processor
CPU#1: set_cpus_allowed(), swapper:1, 3 -> 2
[<c0103bbe>] show_trace_log_lvl+0x34/0x4a
[<c0103ceb>] show_trace+0x2c/0x2e
[<c01045f8>] dump_stack+0x2b/0x2d
[<c0116a77>] set_cpus_allowed+0x52/0xec
[<c0101d86>] cpu_idle_wait+0x2e/0x100
[<c0259c57>] acpi_processor_power_exit+0x45/0x58
[<c0259752>] acpi_processor_remove+0x46/0xea
[<c025c6fb>] acpi_start_single_object+0x47/0x54
[<c025cee5>] acpi_bus_register_driver+0xa4/0xd3
[<c04ab2d7>] acpi_processor_init+0x57/0x77
[<c01004d7>] init+0x146/0x2fd
[<c0103a87>] kernel_thread_helper+0x7/0x10
a quick look at cpu_idle_wait() shows how broken that code is
on i386: it changes the init task's affinity map but never
restores it ...
and because all userspace tasks get forked by init, they all
inherited that single-CPU affinity mask. x86_64 cloned this
bug too.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Andreas Friedrich <andreas.friedrich@fujitsu-siemens.com>
Cc: Wolfgang Erig <Wolfgang.Erig@fujitsu-siemens.com>
Cc: Andrew Morton <akpm@osdl.org>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/process.c | 4 | ||||
-rw-r--r-- | arch/x86_64/kernel/process.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 1e1fa3e391a3..dd53c58f64f1 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c | |||
@@ -205,7 +205,7 @@ void cpu_idle(void) | |||
205 | void cpu_idle_wait(void) | 205 | void cpu_idle_wait(void) |
206 | { | 206 | { |
207 | unsigned int cpu, this_cpu = get_cpu(); | 207 | unsigned int cpu, this_cpu = get_cpu(); |
208 | cpumask_t map; | 208 | cpumask_t map, tmp = current->cpus_allowed; |
209 | 209 | ||
210 | set_cpus_allowed(current, cpumask_of_cpu(this_cpu)); | 210 | set_cpus_allowed(current, cpumask_of_cpu(this_cpu)); |
211 | put_cpu(); | 211 | put_cpu(); |
@@ -227,6 +227,8 @@ void cpu_idle_wait(void) | |||
227 | } | 227 | } |
228 | cpus_and(map, map, cpu_online_map); | 228 | cpus_and(map, map, cpu_online_map); |
229 | } while (!cpus_empty(map)); | 229 | } while (!cpus_empty(map)); |
230 | |||
231 | set_cpus_allowed(current, tmp); | ||
230 | } | 232 | } |
231 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | 233 | EXPORT_SYMBOL_GPL(cpu_idle_wait); |
232 | 234 | ||
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index f6226055d53d..7451a4c43c16 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c | |||
@@ -144,7 +144,7 @@ static void poll_idle (void) | |||
144 | void cpu_idle_wait(void) | 144 | void cpu_idle_wait(void) |
145 | { | 145 | { |
146 | unsigned int cpu, this_cpu = get_cpu(); | 146 | unsigned int cpu, this_cpu = get_cpu(); |
147 | cpumask_t map; | 147 | cpumask_t map, tmp = current->cpus_allowed; |
148 | 148 | ||
149 | set_cpus_allowed(current, cpumask_of_cpu(this_cpu)); | 149 | set_cpus_allowed(current, cpumask_of_cpu(this_cpu)); |
150 | put_cpu(); | 150 | put_cpu(); |
@@ -167,6 +167,8 @@ void cpu_idle_wait(void) | |||
167 | } | 167 | } |
168 | cpus_and(map, map, cpu_online_map); | 168 | cpus_and(map, map, cpu_online_map); |
169 | } while (!cpus_empty(map)); | 169 | } while (!cpus_empty(map)); |
170 | |||
171 | set_cpus_allowed(current, tmp); | ||
170 | } | 172 | } |
171 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | 173 | EXPORT_SYMBOL_GPL(cpu_idle_wait); |
172 | 174 | ||