Subject: Re: Boot failure with very -current on Indy
To: None <port-sgimips@netbsd.org>
From: Ilpo Ruotsalainen <lonewolf@iki.fi>
List: port-sgimips
Date: 01/03/2004 06:36:52
On Wed Dec 31 2003 at 12:43:03 +0200, Ilpo Ruotsalainen wrote:
> A very -current kernel hangs early on my Indy.
> 
> I traced it dying inside the uvm_pageboot_alloc() in mach_init()
> (allocating USPACE). The funny thing is, it seems we end up
> pmap_steal_memory()ing our own boot stack, because it *does* return from
> pmap_steal_memory() with correct looking pointers around (and clears the
> allocated memory) but it never gets back to uvm_pageboot_alloc() from
> where it was called... (Yup; printing a pointer to a stack variable
> yields a pointer near the address pmap_steal_memory() is returning.)
> 
> I guess ARCS either doesn't inform us about it's stack as being
> "non-free" memory or we use much more stack than ARCS allocates...

Okay, there were 2 different bugs here. First, the ARCS on my Indy
doesn't bother to report the region immediately before kernel as
FreeContiguous like ARCS spec says it should (to inform us it contains
the stack). Second, we would have ignored ARCS telling us about the
stack being there anyway...

I committed changes to sys/arch/sgimips/sgimips/machdep.c to leave 1
page before kernel untouched so we won't stomp our own stack (it would
be possible to free the page later in cpu_startup() since we're running
on proc0 stack at that point) and to fix the memory detection to cope
with the fact that kernel isn't completely inside one ARCS "block" of
memory anymore. My Indy boots happily with a very small kernel (that
would crash before these fixes) now.

This *might* fix some similar ("strange crash in mach_init()") problems.

-- 
Ilpo Ruotsalainen - <lonewolf@iki.fi> - http://www.iki.fi/lonewolf/