Commit 7c1c4e541888947947bc46a18a9a5543a259ed62

Authored by Hirokazu Takata
Committed by Linus Torvalds
1 parent 917b1f78a9

[PATCH] m32r: Fix cpu_possible_map and cpu_present_map initialization for SMP kernel

This patch fixes a boot problem of the m32r SMP kernel 2.6.16-rc1-mm3 or
later.

In this patch, cpu_possible_map is statically initialized, and cpu_present_map
is also copied from cpu_possible_map in smp_prepare_cpus(), because the m32r
architecture has not supported CPU hotplug yet.

Signed-off-by: Hayato Fujiwara <fujiwara.hayato@renesas.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 3 changed files with 17 additions and 17 deletions Side-by-side Diff

arch/m32r/kernel/setup.c
... ... @@ -9,6 +9,7 @@
9 9  
10 10 #include <linux/config.h>
11 11 #include <linux/init.h>
  12 +#include <linux/kernel.h>
12 13 #include <linux/stddef.h>
13 14 #include <linux/fs.h>
14 15 #include <linux/sched.h>
... ... @@ -219,8 +220,6 @@
219 220 extern unsigned long setup_memory(void);
220 221 #endif /* CONFIG_DISCONTIGMEM */
221 222  
222   -#define M32R_PCC_PCATCR 0x00ef7014 /* will move to m32r.h */
223   -
224 223 void __init setup_arch(char **cmdline_p)
225 224 {
226 225 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
227 226  
228 227  
... ... @@ -269,15 +268,14 @@
269 268 paging_init();
270 269 }
271 270  
272   -static struct cpu cpu[NR_CPUS];
  271 +static struct cpu cpu_devices[NR_CPUS];
273 272  
274 273 static int __init topology_init(void)
275 274 {
276   - int cpu_id;
  275 + int i;
277 276  
278   - for (cpu_id = 0; cpu_id < NR_CPUS; cpu_id++)
279   - if (cpu_possible(cpu_id))
280   - register_cpu(&cpu[cpu_id], cpu_id, NULL);
  277 + for_each_present_cpu(i)
  278 + register_cpu(&cpu_devices[i], i, NULL);
281 279  
282 280 return 0;
283 281 }
arch/m32r/kernel/smpboot.c
... ... @@ -39,8 +39,10 @@
39 39 * Martin J. Bligh : Added support for multi-quad systems
40 40 */
41 41  
  42 +#include <linux/module.h>
42 43 #include <linux/config.h>
43 44 #include <linux/init.h>
  45 +#include <linux/kernel.h>
44 46 #include <linux/mm.h>
45 47 #include <linux/smp_lock.h>
46 48 #include <linux/irq.h>
47 49  
48 50  
... ... @@ -72,11 +74,15 @@
72 74  
73 75 /* Bitmask of currently online CPUs */
74 76 cpumask_t cpu_online_map;
  77 +EXPORT_SYMBOL(cpu_online_map);
75 78  
76 79 cpumask_t cpu_bootout_map;
77 80 cpumask_t cpu_bootin_map;
78   -cpumask_t cpu_callout_map;
79 81 static cpumask_t cpu_callin_map;
  82 +cpumask_t cpu_callout_map;
  83 +EXPORT_SYMBOL(cpu_callout_map);
  84 +cpumask_t cpu_possible_map = CPU_MASK_ALL;
  85 +EXPORT_SYMBOL(cpu_possible_map);
80 86  
81 87 /* Per CPU bogomips and other parameters */
82 88 struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned;
... ... @@ -110,7 +116,6 @@
110 116  
111 117 void smp_prepare_boot_cpu(void);
112 118 void smp_prepare_cpus(unsigned int);
113   -static void smp_tune_scheduling(void);
114 119 static void init_ipi_lock(void);
115 120 static void do_boot_cpu(int);
116 121 int __cpu_up(unsigned int);
... ... @@ -177,6 +182,9 @@
177 182 }
178 183 for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++)
179 184 physid_set(phys_id, phys_cpu_present_map);
  185 +#ifndef CONFIG_HOTPLUG_CPU
  186 + cpu_present_map = cpu_possible_map;
  187 +#endif
180 188  
181 189 show_mp_info(nr_cpu);
182 190  
... ... @@ -186,7 +194,6 @@
186 194 * Setup boot CPU information
187 195 */
188 196 smp_store_cpu_info(0); /* Final full version of the data */
189   - smp_tune_scheduling();
190 197  
191 198 /*
192 199 * If SMP should be disabled, then really disable it!
... ... @@ -228,11 +235,6 @@
228 235  
229 236 smp_done:
230 237 Dprintk("Boot done.\n");
231   -}
232   -
233   -static void __init smp_tune_scheduling(void)
234   -{
235   - /* Nothing to do. */
236 238 }
237 239  
238 240 /*
include/asm-m32r/smp.h
... ... @@ -67,7 +67,8 @@
67 67 #define raw_smp_processor_id() (current_thread_info()->cpu)
68 68  
69 69 extern cpumask_t cpu_callout_map;
70   -#define cpu_possible_map cpu_callout_map
  70 +extern cpumask_t cpu_possible_map;
  71 +extern cpumask_t cpu_present_map;
71 72  
72 73 static __inline__ int hard_smp_processor_id(void)
73 74 {