aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorNick Piggin <nickpiggin@yahoo.com.au>2005-11-09 00:39:01 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:33 -0500
commit5bfb5d690f36d316a5f3b4f7775fda996faa6b12 (patch)
treeea53f15293d1ddb49c316eb65df85e939a4f6e5e /arch/mips
parentede3d0fba99520f268067917b50858d788bc41da (diff)
[PATCH] sched: disable preempt in idle tasks
Run idle threads with preempt disabled. Also corrected a bugs in arm26's cpu_idle (make it actually call schedule()). How did it ever work before? Might fix the CPU hotplugging hang which Nigel Cunningham noted. We think the bug hits if the idle thread is preempted after checking need_resched() and before going to sleep, then the CPU offlined. After calling stop_machine_run, the CPU eventually returns from preemption and into the idle thread and goes to sleep. The CPU will continue executing previous idle and have no chance to call play_dead. By disabling preemption until we are ready to explicitly schedule, this bug is fixed and the idle threads generally become more robust. From: alexs <ashepard@u.washington.edu> PPC build fix From: Yoichi Yuasa <yuasa@hh.iij4u.or.jp> MIPS build fix Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Yoichi Yuasa <yuasa@hh.iij4u.or.jp> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/process.c2
-rw-r--r--arch/mips/kernel/smp.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 4fe3d5715c41..dd725779d91f 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -52,7 +52,9 @@ ATTRIB_NORET void cpu_idle(void)
52 while (!need_resched()) 52 while (!need_resched())
53 if (cpu_wait) 53 if (cpu_wait)
54 (*cpu_wait)(); 54 (*cpu_wait)();
55 preempt_enable_no_resched();
55 schedule(); 56 schedule();
57 preempt_disable();
56 } 58 }
57} 59}
58 60
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index fcacf1aae98a..25472fcaf715 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -82,7 +82,7 @@ extern ATTRIB_NORET void cpu_idle(void);
82 */ 82 */
83asmlinkage void start_secondary(void) 83asmlinkage void start_secondary(void)
84{ 84{
85 unsigned int cpu = smp_processor_id(); 85 unsigned int cpu;
86 86
87 cpu_probe(); 87 cpu_probe();
88 cpu_report(); 88 cpu_report();
@@ -95,6 +95,8 @@ asmlinkage void start_secondary(void)
95 */ 95 */
96 96
97 calibrate_delay(); 97 calibrate_delay();
98 preempt_disable();
99 cpu = smp_processor_id();
98 cpu_data[cpu].udelay_val = loops_per_jiffy; 100 cpu_data[cpu].udelay_val = loops_per_jiffy;
99 101
100 prom_smp_finish(); 102 prom_smp_finish();