ARM: smp: fix clipping of number of CPUs
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 20 Oct 2011 21:04:18 +0000 (22:04 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 20 Oct 2011 21:06:57 +0000 (22:06 +0100)
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>
arch/arm/mach-exynos4/platsmp.c
arch/arm/mach-msm/platsmp.c
arch/arm/mach-omap2/omap-smp.c
arch/arm/mach-realview/platsmp.c
arch/arm/mach-shmobile/platsmp.c
arch/arm/mach-tegra/platsmp.c
arch/arm/mach-ux500/platsmp.c
arch/arm/mach-vexpress/ct-ca9x4.c

index 7c2282c..a08c536 100644 (file)
@@ -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++)
index 1a1af9e..7276595 100644 (file)
@@ -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);
 
index ce65e93..889464d 100644 (file)
@@ -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++)
index 4ae943b..e83c654 100644 (file)
@@ -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++)
index 66f9806..e4e485f 100644 (file)
@@ -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);
 
index 0886cbc..7d2b5d0 100644 (file)
@@ -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++)
index a33df5f..eb51991 100644 (file)
@@ -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++)
index bfd32f5..2b1e836 100644 (file)
@@ -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);