Subject: Re: 1.4 pmax buglets?
To: Michael L. Hitch <mhitch@lightning.oscs.montana.edu>
From: Simon Burge <simonb@netbsd.org>
List: port-alpha
Date: 04/20/1999 15:15:30
[[ Cc'd to port-alpha because it may have the uninitialised minaddr problem ]]

"Michael L. Hitch" wrote:

> On Tue, 20 Apr 1999, Andy Doran wrote:
> 
> > On Tue, 20 Apr 1999, Simon Burge wrote:
> > 
> > > People are still getting the problem - Tracy J. Di Marco White got a
> > > "panic: uvm_km_suballoc: unable to allocate space in parent map" on a 3
> > > day old 1.4_ALPHA kernel.  I've not seen the problem at all on machines
> > > with 24MB, 32MB, 96MB and 128MB of RAM...
> > 
> > I think it's related to image size. It happens every now and again to me.
> > If I add/remove a bit of code I'm working on, it magically disappears.
> > We're loosing at least 128kB VA range worth of PTEs, otherwise the first
> > uvm_km_suballoc would suceed.
> 
>   I still contend the problem is that minaddr is an uninitialized value.
> This should be very easy to check - initialize minaddr to 0xffffffff and
> see if it always fails.

I had thought the same thing and mailed out a patch that had initialise
minaddr to 0 in an "#if 0" section.  I never did hear any results of
this.

Well, I just tried adding:

	minaddr = 0xffffffff;

at the start of cpu_startup() in machdep.c, and sure enough:

	panic: uvm_km_suballoc: unable to allocate space in parent map
	halted.

Set it to 0, and fine.  Looking at other ports, all but the Alpha and
macppc initialise minaddr to (vaddr_t)buffers.  The Alpha just plain
doesn't initialise it, and the macppc initialises it 0.  Setting to to
(vaddr_t)buffers works on a 24MB 3100 and a 96MB 5900-260.

So, does the following patch look ok?  If so I'll commit it and request
a pull-up to releng.

Thanks Michael!
Simon.

Index: machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/pmax/pmax/machdep.c,v
retrieving revision 1.135
diff -u -r1.135 machdep.c
--- machdep.c	1999/04/11 04:04:09	1.135
+++ machdep.c	1999/04/20 04:55:18
@@ -548,9 +548,16 @@
 		    NULL, UVM_UNKNOWN_OFFSET,
 		    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
 				UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
-		panic("startup: cannot allocate VM for buffers");
+		panic("cpu_startup: cannot allocate VM for buffers");
+
+	minaddr = (vaddr_t)buffers;
+        if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
+        	bufpages = btoc(MAXBSIZE) * nbuf; /* do not overallocate RAM */
+        }
 	base = bufpages / nbuf;
 	residual = bufpages % nbuf;
+
+        /* now allocate RAM for buffers */
 	for (i = 0; i < nbuf; i++) {
 		vsize_t curbufsize;
 		vaddr_t curbuf;