Re: [PATCH] idle thread preemption fix

From: Olaf Hering
Date: Fri Jan 28 2005 - 17:44:49 EST


On Sat, Jan 08, Linux Kernel Mailing List wrote:

> ChangeSet 1.2316, 2005/01/08 13:53:41-08:00, mingo@xxxxxxx
>
> [PATCH] idle thread preemption fix
>
> 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.
>
> Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxx>

> diff -Nru a/init/main.c b/init/main.c
> --- a/init/main.c 2005-01-08 15:18:18 -08:00
> +++ b/init/main.c 2005-01-08 15:18:18 -08:00
> @@ -373,6 +373,12 @@
> {
> 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();
> }

Whats the purpose of local_irq_disable() here? Locks up my toys in
atkbd_init or IP hash foo functions.


-
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/