SMP race condition on startup with patch

From: D.J. Barrow (barrow_dj@yahoo.com)
Date: Tue Apr 30 2002 - 06:55:10 EST


Hi All,

I found a smp race condition on startup
of the 2.4.18 kernel when I put a printk
in schedule.

See the comment below in
/init/main.c
/*
 * We need to finalize in a non-__init function or
else race conditions
 * between the root thread and the init thread may
cause start_kernel to
 * be reaped by free_initmem before the root thread
has proceeded to
 * cpu_idle.
 */
static void rest_init(void)

Note that init_idle the first thing called from
cpu_idle.
& it is freed from
free_initmem in the init function in main.c
which may be called before the cpu
gets into cpu_idle.

Here is the patch.

--- linux.orig/kernel/sched.c Fri Dec 21 17:42:04
2001
+++ linux/kernel/sched.c Tue Apr 30 12:22:02
2002
@@ -1299,7 +1299,7 @@

 extern unsigned long wait_init_idle;

-void __init init_idle(void)
+void init_idle(void)
 {
        struct schedule_data * sched_data;
        sched_data =
&aligned_data[smp_processor_id()].schedule_data;

=====
D.J. Barrow Linux kernel developer
eMail: dj_barrow@ariasoft.ie
Home: +353-22-47196.
Work: +353-91-758353

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 30 2002 - 22:00:19 EST