linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* vmalloc allocations in ipc needs smp initialized (and vm must be allowed to schedule in 2.6)
@ 2003-08-29  1:30 Andrea Arcangeli
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Arcangeli @ 2003-08-29  1:30 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel

Hi Marcelo,

I submit you this patch for 2.4.23 merging. In short if you change
SEMMNI to 8192 the kernel will crash at boot, beause it tries to call
vmalloc before the smp is initialized. The reason is that vmalloc calls
into the pte alloc code, and the fast pte alloc is tried first, but that
reads into the pte_quicklist, that requires the cpu_data to be
initialized (and that happens in smp_init()).

the patch is obviously safe, since no piece of kernel (especially the
code in the check_bugs and smp_init paths ;) calls into the ipc
subsystem.

The reason this started to trigger wasn't really that we increased
SEMMNI, but what happend is that some IPC data structure grown, and for
some reason the corruption due the uninitalized pte_quicklist
triggers only for smp boxes with less than 1G (not very common anymore
;). So it wasn't immediatly reproducible on all setups.

2.6 doesn't suffer from the same problem, simply because 2.6 isn't using
the quicklist anymore, but I think it would be much more correct to make
the same change in 2.6 too, since whatever cond_resched() in the vm
paths (and they're definitely allowed to call it), will lead to a crash
since the init task isn't initialized and the scheduler can't be invoked
yet. (and 2.6 already has the bigger data structures that should trigger
the vmalloc all the time on all setups)

--- x/init/main.c.~1~	2003-08-26 00:13:17.000000000 +0200
+++ x/init/main.c	2003-08-29 03:20:46.000000000 +0200
@@ -424,9 +424,6 @@ asmlinkage void __init start_kernel(void
 #ifdef CONFIG_PROC_FS
 	proc_root_init();
 #endif
-#if defined(CONFIG_SYSVIPC)
-	ipc_init();
-#endif
 	check_bugs();
 	printk("POSIX conformance testing by UNIFIX\n");
 
@@ -436,6 +433,9 @@ asmlinkage void __init start_kernel(void
 	 *	make syscalls (and thus be locked).
 	 */
 	smp_init();
+#if defined(CONFIG_SYSVIPC)
+	ipc_init();
+#endif
 	rest_init();
 }
 
Andrea

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: vmalloc allocations in ipc needs smp initialized (and vm must be allowed to schedule in 2.6)
@ 2003-08-29  5:40 Manfred Spraul
  0 siblings, 0 replies; 2+ messages in thread
From: Manfred Spraul @ 2003-08-29  5:40 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: linux-kernel

Andrea wrote:

>the patch is obviously safe, since no piece of kernel (especially the
>code in the check_bugs and smp_init paths ;) calls into the ipc
>subsystem.
>  
>
What about making ipc_init a proper initcall? I think that's better than 
moving the ipc_init call around.

--
    Manfred


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-29  5:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-29  1:30 vmalloc allocations in ipc needs smp initialized (and vm must be allowed to schedule in 2.6) Andrea Arcangeli
2003-08-29  5:40 Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).