diff options
author | Milton Miller <miltonm@bga.com> | 2011-05-10 15:28:48 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-05-19 00:30:44 -0400 |
commit | 8657ae28ddd34db0f52b0730a6a25992c0173264 (patch) | |
tree | e0baad3eca513815d97127843471228efab99b00 /arch/powerpc/kernel/setup-common.c | |
parent | 7c82733744a74f45e86125f369e876b896765038 (diff) |
powerpc: Respect nr_cpu_ids when calling set_cpu_possible and set_cpu_present
We should not set cpus above nr_cpu_ids to possible. While we
will trigger a warning with CONFIG_CPUMASK_DEBUG, even then the mask
initializers will set the bits beyond what the iterators check and cause
nr_cpu_ids to increase.
Respecting nr_cpu_ids during setup will allow us to use it in our initial
paca allocation. It can be reduced from NR_CPUS by the existing early param
nr_cpus=, which was added in 2b633e3fac5efada088b57d31e65401f22bcc18f (smp:
Use nr_cpus= to set nr_cpu_ids early). We already call parse_early_parms
between finding the command line and allocating the pacas.
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/setup-common.c')
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 1475df6e403f..fce759ba31f3 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -404,7 +404,7 @@ static void __init cpu_init_thread_core_maps(int tpc) | |||
404 | * cpu_present_mask | 404 | * cpu_present_mask |
405 | * | 405 | * |
406 | * Having the possible map set up early allows us to restrict allocations | 406 | * Having the possible map set up early allows us to restrict allocations |
407 | * of things like irqstacks to num_possible_cpus() rather than NR_CPUS. | 407 | * of things like irqstacks to nr_cpu_ids rather than NR_CPUS. |
408 | * | 408 | * |
409 | * We do not initialize the online map here; cpus set their own bits in | 409 | * We do not initialize the online map here; cpus set their own bits in |
410 | * cpu_online_mask as they come up. | 410 | * cpu_online_mask as they come up. |
@@ -424,7 +424,7 @@ void __init smp_setup_cpu_maps(void) | |||
424 | 424 | ||
425 | DBG("smp_setup_cpu_maps()\n"); | 425 | DBG("smp_setup_cpu_maps()\n"); |
426 | 426 | ||
427 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { | 427 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < nr_cpu_ids) { |
428 | const int *intserv; | 428 | const int *intserv; |
429 | int j, len; | 429 | int j, len; |
430 | 430 | ||
@@ -443,7 +443,7 @@ void __init smp_setup_cpu_maps(void) | |||
443 | intserv = &cpu; /* assume logical == phys */ | 443 | intserv = &cpu; /* assume logical == phys */ |
444 | } | 444 | } |
445 | 445 | ||
446 | for (j = 0; j < nthreads && cpu < NR_CPUS; j++) { | 446 | for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { |
447 | DBG(" thread %d -> cpu %d (hard id %d)\n", | 447 | DBG(" thread %d -> cpu %d (hard id %d)\n", |
448 | j, cpu, intserv[j]); | 448 | j, cpu, intserv[j]); |
449 | set_cpu_present(cpu, true); | 449 | set_cpu_present(cpu, true); |
@@ -483,12 +483,12 @@ void __init smp_setup_cpu_maps(void) | |||
483 | if (cpu_has_feature(CPU_FTR_SMT)) | 483 | if (cpu_has_feature(CPU_FTR_SMT)) |
484 | maxcpus *= nthreads; | 484 | maxcpus *= nthreads; |
485 | 485 | ||
486 | if (maxcpus > NR_CPUS) { | 486 | if (maxcpus > nr_cpu_ids) { |
487 | printk(KERN_WARNING | 487 | printk(KERN_WARNING |
488 | "Partition configured for %d cpus, " | 488 | "Partition configured for %d cpus, " |
489 | "operating system maximum is %d.\n", | 489 | "operating system maximum is %d.\n", |
490 | maxcpus, NR_CPUS); | 490 | maxcpus, nr_cpu_ids); |
491 | maxcpus = NR_CPUS; | 491 | maxcpus = nr_cpu_ids; |
492 | } else | 492 | } else |
493 | printk(KERN_INFO "Partition configured for %d cpus.\n", | 493 | printk(KERN_INFO "Partition configured for %d cpus.\n", |
494 | maxcpus); | 494 | maxcpus); |