aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/smp.c')
-rw-r--r--arch/mips/kernel/smp.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index c937506a03a..bc7d9b05e2f 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -22,6 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/smp.h>
25#include <linux/spinlock.h> 26#include <linux/spinlock.h>
26#include <linux/threads.h> 27#include <linux/threads.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -44,7 +45,7 @@
44#include <asm/mipsmtregs.h> 45#include <asm/mipsmtregs.h>
45#endif /* CONFIG_MIPS_MT_SMTC */ 46#endif /* CONFIG_MIPS_MT_SMTC */
46 47
47static volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ 48volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */
48int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ 49int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
49int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ 50int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
50 51
@@ -200,6 +201,8 @@ void __devinit smp_prepare_boot_cpu(void)
200 * and keep control until "cpu_online(cpu)" is set. Note: cpu is 201 * and keep control until "cpu_online(cpu)" is set. Note: cpu is
201 * physical, not logical. 202 * physical, not logical.
202 */ 203 */
204static struct task_struct *cpu_idle_thread[NR_CPUS];
205
203int __cpuinit __cpu_up(unsigned int cpu) 206int __cpuinit __cpu_up(unsigned int cpu)
204{ 207{
205 struct task_struct *idle; 208 struct task_struct *idle;
@@ -209,9 +212,16 @@ int __cpuinit __cpu_up(unsigned int cpu)
209 * The following code is purely to make sure 212 * The following code is purely to make sure
210 * Linux can schedule processes on this slave. 213 * Linux can schedule processes on this slave.
211 */ 214 */
212 idle = fork_idle(cpu); 215 if (!cpu_idle_thread[cpu]) {
213 if (IS_ERR(idle)) 216 idle = fork_idle(cpu);
214 panic(KERN_ERR "Fork failed for CPU %d", cpu); 217 cpu_idle_thread[cpu] = idle;
218
219 if (IS_ERR(idle))
220 panic(KERN_ERR "Fork failed for CPU %d", cpu);
221 } else {
222 idle = cpu_idle_thread[cpu];
223 init_idle(idle, cpu);
224 }
215 225
216 mp_ops->boot_secondary(cpu, idle); 226 mp_ops->boot_secondary(cpu, idle);
217 227