Subject: Re: 1.4 pmax buglets?
To: Andy Doran <ad@psn.ie>
From: Michael L. Hitch <mhitch@lightning.oscs.montana.edu>
List: port-pmax
Date: 04/19/1999 22:09:38
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.

In machdep.c:
        exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
                                   16 * NCARGS, TRUE, FALSE, NULL);

In uvm_km.c:
   474  struct vm_map *
   475  uvm_km_suballoc(map, min, max, size, pageable, fixed, submap)
   476          struct vm_map *map;
   477          vaddr_t *min, *max;             /* OUT, OUT */
...
   491          if (uvm_map(map, min, size, NULL, UVM_UNKNOWN_OFFSET,
   492              UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
   493              UVM_ADV_RANDOM, mapflags)) != KERN_SUCCESS) {
   494                 panic("uvm_km_suballoc: unable to allocate space in parent map");
   495          }

And in uvm_map.c:



   459  int
   460  uvm_map(map, startp, size, uobj, uoffset, flags)
   461          vm_map_t map;
   462          vaddr_t *startp;        /* IN/OUT */
...
   490          /*
   491           * step 1: figure out where to put new VM range
   492           */
   493
...
   499          if ((prev_entry = uvm_map_findspace(map, *startp, size, startp,
   500              uobj, uoffset, flags & UVM_FLAG_FIXED)) == NULL) {
   501                  UVMHIST_LOG(maphist,"<- uvm_map_findspace failed!",0,0,0,0);
   502                  vm_map_unlock(map);
   503                  return (KERN_NO_SPACE);
   504          }
...
   790  vm_map_entry_t
   791  uvm_map_findspace(map, hint, length, result, uobj, uoffset, fixed)
   792          vm_map_t map;
   793          vaddr_t hint;
   794          vsize_t length;
   795          vaddr_t *result; /* OUT */
...
   808          if (hint < map->min_offset) {   /* check ranges ... */
   809                  if (fixed) {
   810                          UVMHIST_LOG(maphist,"<- VA below map range",0,0,0,0);
   811                          return(NULL);
   812                  }
   813                  hint = map->min_offset;
   814          }
   815          if (hint > map->max_offset) {
   816                  UVMHIST_LOG(maphist,"<- VA 0x%x > range [0x%x->0x%x]",
   817                                  hint, map->min_offset, map->max_offset, 0);
   818                  return(NULL);
   819          }


First - note the conflict between the 'IN/OUT' comment for *startp in
uvm_map() and the 'OUT' comment for the corresponding *min in
uvm_km_suballoc().

Second, the value of minaddr is being used uvm_map_findspace() as the
'hint', and if that value exceeds the maximum offset of the specified map,
then uvm_map_findspace() causing uvm_map() to fail and uvm_km_suballoc()
to panic.

Michael