Re: 2.6.9-rc2-mm4

From: Ingo Molnar
Date: Mon Sep 27 2004 - 18:02:38 EST



could you try the patch below ontop of -mm4 and try again the .config
that failed before? Does the bootup still hang?

The early bootup stage is pretty fragile because the idle thread is not
yet functioning as such and so we need preemption disabled. Whether the
bootup fails or not seems to depend on timing details so e.g. the
presence of SCHED_SMT makes it go away.

disabling preemption explicitly has another advantage: the atomicity
check in schedule() will catch early-bootup schedule() calls from now
on.

the patch also fixes another preempt-bkl buglet: interrupt-driven
forced-preemption didnt go through preempt_schedule() so it resulted in
auto-dropping of the BKL. Now we go through preempt_schedule() which
properly deals with the BKL.

Ingo

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

--- linux/init/main.c.orig
+++ linux/init/main.c
@@ -435,6 +435,12 @@ static void noinline rest_init(void)
{
kernel_thread(init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
+ /*
+ * Re-enable preemption but disable interrupts to make sure
+ * we dont get preempted until we schedule() in cpu_idle().
+ */
+ local_irq_disable();
+ preempt_enable_no_resched();
unlock_kernel();
cpu_idle();
}
@@ -501,6 +507,7 @@ asmlinkage void __init start_kernel(void
* time - but meanwhile we still have a functioning scheduler.
*/
sched_init();
+ preempt_disable();
build_all_zonelists();
page_alloc_init();
trap_init();
--- linux/arch/i386/kernel/entry.S.orig
+++ linux/arch/i386/kernel/entry.S
@@ -197,10 +197,8 @@ need_resched:
jz restore_all
testl $IF_MASK,EFLAGS(%esp) # interrupts off (exception path) ?
jz restore_all
- movl $PREEMPT_ACTIVE,TI_preempt_count(%ebp)
sti
- call schedule
- movl $0,TI_preempt_count(%ebp)
+ call preempt_schedule
cli
jmp need_resched
#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/