diff options
author | Hugh Dickins <hugh@veritas.com> | 2007-08-30 23:26:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-31 00:54:31 -0400 |
commit | 62e6f1e8bb7c48c02b8bdb3085c5f6365682149b (patch) | |
tree | 975277fdd906c173bf48bfbe0226b80bb0e14529 /init | |
parent | a1c582d0720f2eff61043e90711767decf37b917 (diff) |
fix maxcpus=1 oops in show_stat()
Alexey Dobriyan reports that maxcpus=1 is still broken in 2.6.23-rc4:
if CONFIG_HOTPLUG_CPU is not set, x86_64 bootup oopses in show_stat() -
for_each_possible_cpu accesses a per-cpu area which was never set up.
Alexey identified commit 61ec7567db103d537329b0db9a887db570431ff4
(ACPI: boot correctly with "nosmp" or "maxcpus=0") as the origin;
but it's not really to blame, just exposes a bug in 2.6.23-rc1's commit
8b3b295502444340dd0701855ac422fbf32e161d (Especially when !CONFIG_HOTPLUG_CPU,
avoid needlessy allocating resources for CPUs that can never become available).
rc1's test for max_cpus < 2 in start_kernel() wasn't working because
max_cpus was still NR_CPUS at that point: until rc4 moved the maxcpus
parsing earlier. Now it sets cpu_possible_map to 1 before allocating
all possible per-cpu areas; then smp_init() expands cpu_possible_map
to cpu_present_map (0xf in my case) later on.
rc1's commit has good intentions, but expects cpu_present_map to be
limited by maxcpus, which is only the case on i386. cpus_and(possible,
possible,present) might be good, but needs an audit of cpu_present_map
uses - there may well be assumptions that any cpu present is possible.
So stay safe for now and just revert those #ifndef CONFIG_HOTPLUG_CPU
optimizations in rc1's commit.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: Alexey Dobriyan <adobriyan@sw.ru>
Cc: Len Brown <lenb@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/init/main.c b/init/main.c index 450e6ee52ab6..9def935ab13a 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -397,10 +397,6 @@ static void __init smp_init(void) | |||
397 | { | 397 | { |
398 | unsigned int cpu; | 398 | unsigned int cpu; |
399 | 399 | ||
400 | #ifndef CONFIG_HOTPLUG_CPU | ||
401 | cpu_possible_map = cpu_present_map; | ||
402 | #endif | ||
403 | |||
404 | /* FIXME: This should be done in userspace --RR */ | 400 | /* FIXME: This should be done in userspace --RR */ |
405 | for_each_present_cpu(cpu) { | 401 | for_each_present_cpu(cpu) { |
406 | if (num_online_cpus() >= max_cpus) | 402 | if (num_online_cpus() >= max_cpus) |
@@ -545,10 +541,6 @@ asmlinkage void __init start_kernel(void) | |||
545 | setup_arch(&command_line); | 541 | setup_arch(&command_line); |
546 | setup_command_line(command_line); | 542 | setup_command_line(command_line); |
547 | unwind_setup(); | 543 | unwind_setup(); |
548 | #ifndef CONFIG_HOTPLUG_CPU | ||
549 | if (max_cpus < 2) | ||
550 | cpu_possible_map = cpu_online_map; | ||
551 | #endif | ||
552 | setup_per_cpu_areas(); | 544 | setup_per_cpu_areas(); |
553 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ | 545 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ |
554 | 546 | ||