Skip to content

Commit a06f916

Browse files
author
Russell King
committed
ARM: smp: fix clipping of number of CPUs
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: <[email protected]> Reported-by: Mark Salter <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 5a567d7 commit a06f916

File tree

8 files changed

+38
-28
lines changed

8 files changed

+38
-28
lines changed

arch/arm/mach-exynos4/platsmp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,10 @@ void __init smp_init_cpus(void)
191191
ncores = scu_base ? scu_get_core_count(scu_base) : 1;
192192

193193
/* sanity check */
194-
if (ncores > NR_CPUS) {
195-
printk(KERN_WARNING
196-
"EXYNOS4: no. of cores (%d) greater than configured "
197-
"maximum of %d - clipping\n",
198-
ncores, NR_CPUS);
199-
ncores = NR_CPUS;
194+
if (ncores > nr_cpu_ids) {
195+
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
196+
ncores, nr_cpu_ids);
197+
ncores = nr_cpu_ids;
200198
}
201199

202200
for (i = 0; i < ncores; i++)

arch/arm/mach-msm/platsmp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ void __init smp_init_cpus(void)
156156
{
157157
unsigned int i, ncores = get_core_count();
158158

159+
if (ncores > nr_cpu_ids) {
160+
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
161+
ncores, nr_cpu_ids);
162+
ncores = nr_cpu_ids;
163+
}
164+
159165
for (i = 0; i < ncores; i++)
160166
set_cpu_possible(i, true);
161167

arch/arm/mach-omap2/omap-smp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,10 @@ void __init smp_init_cpus(void)
109109
ncores = scu_get_core_count(scu_base);
110110

111111
/* sanity check */
112-
if (ncores > NR_CPUS) {
113-
printk(KERN_WARNING
114-
"OMAP4: no. of cores (%d) greater than configured "
115-
"maximum of %d - clipping\n",
116-
ncores, NR_CPUS);
117-
ncores = NR_CPUS;
112+
if (ncores > nr_cpu_ids) {
113+
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
114+
ncores, nr_cpu_ids);
115+
ncores = nr_cpu_ids;
118116
}
119117

120118
for (i = 0; i < ncores; i++)

arch/arm/mach-realview/platsmp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ void __init smp_init_cpus(void)
5252
ncores = scu_base ? scu_get_core_count(scu_base) : 1;
5353

5454
/* sanity check */
55-
if (ncores > NR_CPUS) {
56-
printk(KERN_WARNING
57-
"Realview: no. of cores (%d) greater than configured "
58-
"maximum of %d - clipping\n",
59-
ncores, NR_CPUS);
60-
ncores = NR_CPUS;
55+
if (ncores > nr_cpu_ids) {
56+
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
57+
ncores, nr_cpu_ids);
58+
ncores = nr_cpu_ids;
6159
}
6260

6361
for (i = 0; i < ncores; i++)

arch/arm/mach-shmobile/platsmp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ void __init smp_init_cpus(void)
5656
unsigned int ncores = shmobile_smp_get_core_count();
5757
unsigned int i;
5858

59+
if (ncores > nr_cpu_ids) {
60+
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
61+
ncores, nr_cpu_ids);
62+
ncores = nr_cpu_ids;
63+
}
64+
5965
for (i = 0; i < ncores; i++)
6066
set_cpu_possible(i, true);
6167

arch/arm/mach-tegra/platsmp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ void __init smp_init_cpus(void)
114114
{
115115
unsigned int i, ncores = scu_get_core_count(scu_base);
116116

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

123123
for (i = 0; i < ncores; i++)

arch/arm/mach-ux500/platsmp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,10 @@ void __init smp_init_cpus(void)
156156
ncores = scu_base ? scu_get_core_count(scu_base) : 1;
157157

158158
/* sanity check */
159-
if (ncores > NR_CPUS) {
160-
printk(KERN_WARNING
161-
"U8500: no. of cores (%d) greater than configured "
162-
"maximum of %d - clipping\n",
163-
ncores, NR_CPUS);
164-
ncores = NR_CPUS;
159+
if (ncores > nr_cpu_ids) {
160+
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
161+
ncores, nr_cpu_ids);
162+
ncores = nr_cpu_ids;
165163
}
166164

167165
for (i = 0; i < ncores; i++)

arch/arm/mach-vexpress/ct-ca9x4.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ static void ct_ca9x4_init_cpu_map(void)
221221
{
222222
int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU));
223223

224+
if (ncores > nr_cpu_ids) {
225+
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
226+
ncores, nr_cpu_ids);
227+
ncores = nr_cpu_ids;
228+
}
229+
224230
for (i = 0; i < ncores; ++i)
225231
set_cpu_possible(i, true);
226232

0 commit comments

Comments
 (0)