]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.1.1/arm-smp-fix-clipping-of-number-of-cpus.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.1.1 / arm-smp-fix-clipping-of-number-of-cpus.patch
1 From a06f916b7a9b57447ceb875eb0a89f1a66b31bca Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@arm.linux.org.uk>
3 Date: Thu, 20 Oct 2011 22:04:18 +0100
4 Subject: ARM: smp: fix clipping of number of CPUs
5
6 From: Russell King <rmk+kernel@arm.linux.org.uk>
7
8 commit a06f916b7a9b57447ceb875eb0a89f1a66b31bca upstream.
9
10 Rather than clipping the number of CPUs using the compile-time NR_CPUS
11 constant, use the runtime nr_cpu_ids value instead. This allows the
12 nr_cpus command line option to work as expected.
13
14 Reported-by: Mark Salter <msalter@redhat.com>
15 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17
18 ---
19 arch/arm/mach-exynos4/platsmp.c | 10 ++++------
20 arch/arm/mach-msm/platsmp.c | 6 ++++++
21 arch/arm/mach-omap2/omap-smp.c | 10 ++++------
22 arch/arm/mach-realview/platsmp.c | 10 ++++------
23 arch/arm/mach-shmobile/platsmp.c | 6 ++++++
24 arch/arm/mach-tegra/platsmp.c | 8 ++++----
25 arch/arm/mach-ux500/platsmp.c | 10 ++++------
26 arch/arm/mach-vexpress/ct-ca9x4.c | 6 ++++++
27 8 files changed, 38 insertions(+), 28 deletions(-)
28
29 --- a/arch/arm/mach-exynos4/platsmp.c
30 +++ b/arch/arm/mach-exynos4/platsmp.c
31 @@ -193,12 +193,10 @@ void __init smp_init_cpus(void)
32 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
33
34 /* sanity check */
35 - if (ncores > NR_CPUS) {
36 - printk(KERN_WARNING
37 - "EXYNOS4: no. of cores (%d) greater than configured "
38 - "maximum of %d - clipping\n",
39 - ncores, NR_CPUS);
40 - ncores = NR_CPUS;
41 + if (ncores > nr_cpu_ids) {
42 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
43 + ncores, nr_cpu_ids);
44 + ncores = nr_cpu_ids;
45 }
46
47 for (i = 0; i < ncores; i++)
48 --- a/arch/arm/mach-msm/platsmp.c
49 +++ b/arch/arm/mach-msm/platsmp.c
50 @@ -156,6 +156,12 @@ void __init smp_init_cpus(void)
51 {
52 unsigned int i, ncores = get_core_count();
53
54 + if (ncores > nr_cpu_ids) {
55 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
56 + ncores, nr_cpu_ids);
57 + ncores = nr_cpu_ids;
58 + }
59 +
60 for (i = 0; i < ncores; i++)
61 set_cpu_possible(i, true);
62
63 --- a/arch/arm/mach-omap2/omap-smp.c
64 +++ b/arch/arm/mach-omap2/omap-smp.c
65 @@ -109,12 +109,10 @@ void __init smp_init_cpus(void)
66 ncores = scu_get_core_count(scu_base);
67
68 /* sanity check */
69 - if (ncores > NR_CPUS) {
70 - printk(KERN_WARNING
71 - "OMAP4: no. of cores (%d) greater than configured "
72 - "maximum of %d - clipping\n",
73 - ncores, NR_CPUS);
74 - ncores = NR_CPUS;
75 + if (ncores > nr_cpu_ids) {
76 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
77 + ncores, nr_cpu_ids);
78 + ncores = nr_cpu_ids;
79 }
80
81 for (i = 0; i < ncores; i++)
82 --- a/arch/arm/mach-realview/platsmp.c
83 +++ b/arch/arm/mach-realview/platsmp.c
84 @@ -52,12 +52,10 @@ void __init smp_init_cpus(void)
85 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
86
87 /* sanity check */
88 - if (ncores > NR_CPUS) {
89 - printk(KERN_WARNING
90 - "Realview: no. of cores (%d) greater than configured "
91 - "maximum of %d - clipping\n",
92 - ncores, NR_CPUS);
93 - ncores = NR_CPUS;
94 + if (ncores > nr_cpu_ids) {
95 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
96 + ncores, nr_cpu_ids);
97 + ncores = nr_cpu_ids;
98 }
99
100 for (i = 0; i < ncores; i++)
101 --- a/arch/arm/mach-shmobile/platsmp.c
102 +++ b/arch/arm/mach-shmobile/platsmp.c
103 @@ -56,6 +56,12 @@ void __init smp_init_cpus(void)
104 unsigned int ncores = shmobile_smp_get_core_count();
105 unsigned int i;
106
107 + if (ncores > nr_cpu_ids) {
108 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
109 + ncores, nr_cpu_ids);
110 + ncores = nr_cpu_ids;
111 + }
112 +
113 for (i = 0; i < ncores; i++)
114 set_cpu_possible(i, true);
115
116 --- a/arch/arm/mach-tegra/platsmp.c
117 +++ b/arch/arm/mach-tegra/platsmp.c
118 @@ -114,10 +114,10 @@ void __init smp_init_cpus(void)
119 {
120 unsigned int i, ncores = scu_get_core_count(scu_base);
121
122 - if (ncores > NR_CPUS) {
123 - printk(KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n",
124 - ncores, NR_CPUS);
125 - ncores = NR_CPUS;
126 + if (ncores > nr_cpu_ids) {
127 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
128 + ncores, nr_cpu_ids);
129 + ncores = nr_cpu_ids;
130 }
131
132 for (i = 0; i < ncores; i++)
133 --- a/arch/arm/mach-ux500/platsmp.c
134 +++ b/arch/arm/mach-ux500/platsmp.c
135 @@ -156,12 +156,10 @@ void __init smp_init_cpus(void)
136 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
137
138 /* sanity check */
139 - if (ncores > NR_CPUS) {
140 - printk(KERN_WARNING
141 - "U8500: no. of cores (%d) greater than configured "
142 - "maximum of %d - clipping\n",
143 - ncores, NR_CPUS);
144 - ncores = NR_CPUS;
145 + if (ncores > nr_cpu_ids) {
146 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
147 + ncores, nr_cpu_ids);
148 + ncores = nr_cpu_ids;
149 }
150
151 for (i = 0; i < ncores; i++)
152 --- a/arch/arm/mach-vexpress/ct-ca9x4.c
153 +++ b/arch/arm/mach-vexpress/ct-ca9x4.c
154 @@ -221,6 +221,12 @@ static void ct_ca9x4_init_cpu_map(void)
155 {
156 int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU));
157
158 + if (ncores > nr_cpu_ids) {
159 + pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
160 + ncores, nr_cpu_ids);
161 + ncores = nr_cpu_ids;
162 + }
163 +
164 for (i = 0; i < ncores; ++i)
165 set_cpu_possible(i, true);
166