Skip to content

Commit

Permalink
ARM: smp: fix clipping of number of CPUs
Browse files Browse the repository at this point in the history
Rather than clipping the number of CPUs using the compile-time NR_CPUS
constant, use the runtime nr_cpu_ids value instead.  This allows the
nr_cpus command line option to work as expected.

Cc: <stable@kernel.org>
Reported-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King committed Oct 20, 2011
1 parent 5a567d7 commit a06f916
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 28 deletions.
10 changes: 4 additions & 6 deletions arch/arm/mach-exynos4/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,10 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1;

/* sanity check */
if (ncores > NR_CPUS) {
printk(KERN_WARNING
"EXYNOS4: no. of cores (%d) greater than configured "
"maximum of %d - clipping\n",
ncores, NR_CPUS);
ncores = NR_CPUS;
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; i++)
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/mach-msm/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ void __init smp_init_cpus(void)
{
unsigned int i, ncores = get_core_count();

if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; i++)
set_cpu_possible(i, true);

Expand Down
10 changes: 4 additions & 6 deletions arch/arm/mach-omap2/omap-smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,10 @@ void __init smp_init_cpus(void)
ncores = scu_get_core_count(scu_base);

/* sanity check */
if (ncores > NR_CPUS) {
printk(KERN_WARNING
"OMAP4: no. of cores (%d) greater than configured "
"maximum of %d - clipping\n",
ncores, NR_CPUS);
ncores = NR_CPUS;
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; i++)
Expand Down
10 changes: 4 additions & 6 deletions arch/arm/mach-realview/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1;

/* sanity check */
if (ncores > NR_CPUS) {
printk(KERN_WARNING
"Realview: no. of cores (%d) greater than configured "
"maximum of %d - clipping\n",
ncores, NR_CPUS);
ncores = NR_CPUS;
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; i++)
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/mach-shmobile/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ void __init smp_init_cpus(void)
unsigned int ncores = shmobile_smp_get_core_count();
unsigned int i;

if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; i++)
set_cpu_possible(i, true);

Expand Down
8 changes: 4 additions & 4 deletions arch/arm/mach-tegra/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ void __init smp_init_cpus(void)
{
unsigned int i, ncores = scu_get_core_count(scu_base);

if (ncores > NR_CPUS) {
printk(KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n",
ncores, NR_CPUS);
ncores = NR_CPUS;
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; i++)
Expand Down
10 changes: 4 additions & 6 deletions arch/arm/mach-ux500/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,10 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1;

/* sanity check */
if (ncores > NR_CPUS) {
printk(KERN_WARNING
"U8500: no. of cores (%d) greater than configured "
"maximum of %d - clipping\n",
ncores, NR_CPUS);
ncores = NR_CPUS;
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; i++)
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/mach-vexpress/ct-ca9x4.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ static void ct_ca9x4_init_cpu_map(void)
{
int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU));

if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}

for (i = 0; i < ncores; ++i)
set_cpu_possible(i, true);

Expand Down

0 comments on commit a06f916

Please sign in to comment.