aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/kernel
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/ppc/kernel
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/ppc/kernel')
-rw-r--r--arch/ppc/kernel/idle.c17
-rw-r--r--arch/ppc/kernel/smp.c1
2 files changed, 13 insertions, 5 deletions
diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
index 11e5b44713f7..a6141f05c919 100644
--- a/arch/ppc/kernel/idle.c
+++ b/arch/ppc/kernel/idle.c
@@ -53,10 +53,6 @@ void default_idle(void)
53 } 53 }
54#endif 54#endif
55 } 55 }
56 if (need_resched())
57 schedule();
58 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
59 cpu_die();
60} 56}
61 57
62/* 58/*
@@ -64,11 +60,22 @@ void default_idle(void)
64 */ 60 */
65void cpu_idle(void) 61void cpu_idle(void)
66{ 62{
67 for (;;) 63 int cpu = smp_processor_id();
64
65 for (;;) {
68 if (ppc_md.idle != NULL) 66 if (ppc_md.idle != NULL)
69 ppc_md.idle(); 67 ppc_md.idle();
70 else 68 else
71 default_idle(); 69 default_idle();
70 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
71 cpu_die();
72 if (need_resched()) {
73 preempt_enable_no_resched();
74 schedule();
75 preempt_disable();
76 }
77
78 }
72} 79}
73 80
74#if defined(CONFIG_SYSCTL) && defined(CONFIG_6xx) 81#if defined(CONFIG_SYSCTL) && defined(CONFIG_6xx)
diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
index bc5bf1124836..43b8fc2ca591 100644
--- a/arch/ppc/kernel/smp.c
+++ b/arch/ppc/kernel/smp.c
@@ -341,6 +341,7 @@ int __devinit start_secondary(void *unused)
341 cpu = smp_processor_id(); 341 cpu = smp_processor_id();
342 smp_store_cpu_info(cpu); 342 smp_store_cpu_info(cpu);
343 set_dec(tb_ticks_per_jiffy); 343 set_dec(tb_ticks_per_jiffy);
344 preempt_disable();
344 cpu_callin_map[cpu] = 1; 345 cpu_callin_map[cpu] = 1;
345 346
346 printk("CPU %d done callin...\n", cpu); 347 printk("CPU %d done callin...\n", cpu);