Port-sparc64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Early crash on SB2000 (panic: init: no memory



Hi,

> Is this after the failed pmap_read_memlist() call?

Yes.  This is after the panic: init: no memory.

> I've been reviewing the code and the only way I can see this happening is 
> if somehow the 1ffea0000,2000 entry is added to the property between the 
> OF_getproplen() call and the OF_getprop() call.  That shouldn't happen.

It seems that this is the case ...

> I suppose you could change the OF_getproplen() routine to do a "getprop" 
> call with a zero buflen parameter.  The return from "getprop" should be 
> the size of the property.
> 
> Or change pmap_read_memlist() to compare the return value from the 
> OF_getproplen() with the requested size and if the return is larger free 
> up the memory and try again with a larger size.

... even adding a second OF_getprop() allows this machine to boot (as per
the attached patch):

  /memory: changed size (0x60 to 0x70)
  kdata_alloc(): Allocated 112@0x1ed0590, 1243648 free.
  Available physical memory:
  kdata_alloc(): Allocated 112@0x1ed0600, 1243536 free.
  memlist start 1ffea0000 size 2000
  memlist start 1ffe8c000 size 4000
  memlist start 1ffdb0000 size a0000
  memlist start 1ffc00000 size 1a0000
  memlist start 1fec00000 size 3fe000
  memlist start 1fe008000 size 7f8000
  memlist start 0 size 1fe000000
  End of available physical memory

Thank you for the pointers!

J
-- 
   NetBSD: simple; works; documented    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/
Index: pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/pmap.c,v
retrieving revision 1.278
diff -u -r1.278 pmap.c
--- pmap.c      25 Mar 2012 02:31:00 -0000      1.278
+++ pmap.c      31 Oct 2012 21:38:52 -0000
@@ -629,7 +629,7 @@
                  int *ml_size, vaddr_t (* ml_alloc)(vsize_t, vsize_t))
 {
        void *va;
-       int size, handle;
+       int size, newsize, handle;
 
        if ( (handle = prom_finddevice(device)) == 0) {
                prom_printf("pmap_read_memlist(): No %s device found.\n",
@@ -641,11 +641,17 @@
                                device, property);
                prom_halt();
        }
+       newsize = OF_getproplen(handle, property);
+       if (newsize != size) {
+               BDPRINTF(PDB_BOOT, ("%s: changed size (0x%x to 0x%x)\n",
+                   device, size, newsize));
+               size = newsize;
+       }
        if ( (va = (void*)(* ml_alloc)(size, sizeof(uint64_t))) == NULL) {
                prom_printf("pmap_read_memlist(): Cannot allocate memlist.\n");
                prom_halt();
        }
-       if (OF_getprop(handle, property, va, size) <= 0) {
+       if ((newsize = OF_getprop(handle, property, va, size)) <= 0) {
                prom_printf("pmap_read_memlist(): Cannot read %s/%s.\n",
                                device, property);
                prom_halt();
@@ -1274,11 +1280,11 @@
        size = sizeof(struct pv_entry) * physmem;
        if (uvm_pglistalloc((psize_t)size, (paddr_t)0, (paddr_t)-1,
                (paddr_t)PAGE_SIZE, (paddr_t)0, &pglist, 1, 0) != 0)
-               panic("pmap_init: no memory");
+               panic("pmap_init: no memory (1)");
 
        va = uvm_km_alloc(kernel_map, size, 0, UVM_KMF_VAONLY);
        if (va == 0)
-               panic("pmap_init: no memory");
+               panic("pmap_init: no memory (2)");
 
        /* Map the pages */
        TAILQ_FOREACH(pg, &pglist, pageq.queue) {


Home | Main Index | Thread Index | Old Index