diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-02-16 06:08:09 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-02-16 06:08:09 -0500 |
commit | 7bbb79403163e047c6e333ff169db34e3c969e65 (patch) | |
tree | 423e32c02baa1d61085c67865d11a448db34857a | |
parent | ba09cf2bcf9b74d852dcb5ea957ac6af2bc0e057 (diff) |
[ARM] Fix SMP initialisation oops
A change to the SMP initialisation caused the following oops:
CPU1: Booted secondary processor
CPU1: D VIPT write-back cache
CPU1: I cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets
CPU1: D cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets
<7>Calibrating delay loop... 83.14 BogoMIPS (lpj=415744)
<1>Unable to handle kernel NULL pointer dereference at virtual address 0000001c
...
PC is at enqueue_task+0x1c/0x64
LR is at activate_task+0xcc/0xe4
SMP initialisation now requires cpu_possible_map to be initialised in
setup_arch(). Move this from smp_prepare_cpus() to smp_init_cpus()
and call it from our setup_arch() if CONFIG_SMP is enabled.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/setup.c | 5 | ||||
-rw-r--r-- | arch/arm/kernel/smp.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-integrator/platsmp.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-realview/platsmp.c | 21 | ||||
-rw-r--r-- | include/asm-arm/smp.h | 5 |
5 files changed, 40 insertions, 13 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index c45d10d07bde..68273b4dc882 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/root_dev.h> | 23 | #include <linux/root_dev.h> |
24 | #include <linux/cpu.h> | 24 | #include <linux/cpu.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/smp.h> | ||
26 | 27 | ||
27 | #include <asm/cpu.h> | 28 | #include <asm/cpu.h> |
28 | #include <asm/elf.h> | 29 | #include <asm/elf.h> |
@@ -771,6 +772,10 @@ void __init setup_arch(char **cmdline_p) | |||
771 | paging_init(&meminfo, mdesc); | 772 | paging_init(&meminfo, mdesc); |
772 | request_standard_resources(&meminfo, mdesc); | 773 | request_standard_resources(&meminfo, mdesc); |
773 | 774 | ||
775 | #ifdef CONFIG_SMP | ||
776 | smp_init_cpus(); | ||
777 | #endif | ||
778 | |||
774 | cpu_init(); | 779 | cpu_init(); |
775 | 780 | ||
776 | /* | 781 | /* |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 7338948bd7d3..02aa300c4633 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -338,7 +338,6 @@ void __init smp_prepare_boot_cpu(void) | |||
338 | 338 | ||
339 | per_cpu(cpu_data, cpu).idle = current; | 339 | per_cpu(cpu_data, cpu).idle = current; |
340 | 340 | ||
341 | cpu_set(cpu, cpu_possible_map); | ||
342 | cpu_set(cpu, cpu_present_map); | 341 | cpu_set(cpu, cpu_present_map); |
343 | cpu_set(cpu, cpu_online_map); | 342 | cpu_set(cpu, cpu_online_map); |
344 | } | 343 | } |
diff --git a/arch/arm/mach-integrator/platsmp.c b/arch/arm/mach-integrator/platsmp.c index ea10bd8c972c..1bc8534ef0c6 100644 --- a/arch/arm/mach-integrator/platsmp.c +++ b/arch/arm/mach-integrator/platsmp.c | |||
@@ -140,6 +140,18 @@ static void __init poke_milo(void) | |||
140 | mb(); | 140 | mb(); |
141 | } | 141 | } |
142 | 142 | ||
143 | /* | ||
144 | * Initialise the CPU possible map early - this describes the CPUs | ||
145 | * which may be present or become present in the system. | ||
146 | */ | ||
147 | void __init smp_init_cpus(void) | ||
148 | { | ||
149 | unsigned int i, ncores = get_core_count(); | ||
150 | |||
151 | for (i = 0; i < ncores; i++) | ||
152 | cpu_set(i, cpu_possible_map); | ||
153 | } | ||
154 | |||
143 | void __init smp_prepare_cpus(unsigned int max_cpus) | 155 | void __init smp_prepare_cpus(unsigned int max_cpus) |
144 | { | 156 | { |
145 | unsigned int ncores = get_core_count(); | 157 | unsigned int ncores = get_core_count(); |
@@ -176,14 +188,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
176 | max_cpus = ncores; | 188 | max_cpus = ncores; |
177 | 189 | ||
178 | /* | 190 | /* |
179 | * Initialise the possible/present maps. | 191 | * Initialise the present map, which describes the set of CPUs |
180 | * cpu_possible_map describes the set of CPUs which may be present | 192 | * actually populated at the present time. |
181 | * cpu_present_map describes the set of CPUs populated | ||
182 | */ | 193 | */ |
183 | for (i = 0; i < max_cpus; i++) { | 194 | for (i = 0; i < max_cpus; i++) |
184 | cpu_set(i, cpu_possible_map); | ||
185 | cpu_set(i, cpu_present_map); | 195 | cpu_set(i, cpu_present_map); |
186 | } | ||
187 | 196 | ||
188 | /* | 197 | /* |
189 | * Do we need any more CPUs? If so, then let them know where | 198 | * Do we need any more CPUs? If so, then let them know where |
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index a8fbd76d8be5..b8484e15dacb 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c | |||
@@ -143,6 +143,18 @@ static void __init poke_milo(void) | |||
143 | mb(); | 143 | mb(); |
144 | } | 144 | } |
145 | 145 | ||
146 | /* | ||
147 | * Initialise the CPU possible map early - this describes the CPUs | ||
148 | * which may be present or become present in the system. | ||
149 | */ | ||
150 | void __init smp_init_cpus(void) | ||
151 | { | ||
152 | unsigned int i, ncores = get_core_count(); | ||
153 | |||
154 | for (i = 0; i < ncores; i++) | ||
155 | cpu_set(i, cpu_possible_map); | ||
156 | } | ||
157 | |||
146 | void __init smp_prepare_cpus(unsigned int max_cpus) | 158 | void __init smp_prepare_cpus(unsigned int max_cpus) |
147 | { | 159 | { |
148 | unsigned int ncores = get_core_count(); | 160 | unsigned int ncores = get_core_count(); |
@@ -179,14 +191,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
179 | local_timer_setup(cpu); | 191 | local_timer_setup(cpu); |
180 | 192 | ||
181 | /* | 193 | /* |
182 | * Initialise the possible/present maps. | 194 | * Initialise the present map, which describes the set of CPUs |
183 | * cpu_possible_map describes the set of CPUs which may be present | 195 | * actually populated at the present time. |
184 | * cpu_present_map describes the set of CPUs populated | ||
185 | */ | 196 | */ |
186 | for (i = 0; i < max_cpus; i++) { | 197 | for (i = 0; i < max_cpus; i++) |
187 | cpu_set(i, cpu_possible_map); | ||
188 | cpu_set(i, cpu_present_map); | 198 | cpu_set(i, cpu_present_map); |
189 | } | ||
190 | 199 | ||
191 | /* | 200 | /* |
192 | * Do we need any more CPUs? If so, then let them know where | 201 | * Do we need any more CPUs? If so, then let them know where |
diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index 5a72e50ca9fc..fe45f7f61223 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h | |||
@@ -42,6 +42,11 @@ extern void show_ipi_list(struct seq_file *p); | |||
42 | asmlinkage void do_IPI(struct pt_regs *regs); | 42 | asmlinkage void do_IPI(struct pt_regs *regs); |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Setup the SMP cpu_possible_map | ||
46 | */ | ||
47 | extern void smp_init_cpus(void); | ||
48 | |||
49 | /* | ||
45 | * Move global data into per-processor storage. | 50 | * Move global data into per-processor storage. |
46 | */ | 51 | */ |
47 | extern void smp_store_cpu_info(unsigned int cpuid); | 52 | extern void smp_store_cpu_info(unsigned int cpuid); |