Subject: Re: G4, 2GB RAM report (fwd)
To: Bill Studenmund <wrstuden@zembu.com>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-macppc
Date: 08/09/2000 11:16:53
Bill Studenmund forwarded this message to me...

 > 1. int physmem:
 > 
 >    the page hash table is auto-sized in pmap_bootstrap()\pmap.c:
 > 
 > 	#ifdef  HTABENTS
 > 		ptab_cnt = HTABENTS;
 > 	#else /* HTABENTS */
 > 		ptab_cnt = 1024;
 > 		while ((HTABSIZE << 7) < ctob(physmem))
 > 			ptab_cnt <<= 1;
 > 	#endif /* HTABENTS */
 > 
 >    with >= 2GB RAM, ctob(physmem) as a signed quantity 
 >    will evaluate negative right off so ptab_cnt never gets
 >    adjusted upwards.  The result is overflow of the (puny)
 >    page table during startup before VM is initialized
 >    which results in panic("poalloc").

There are numerous ways to fix this problem, and something similar
has happened on other ports.

Here's another possible fix:

Index: pmap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/powerpc/powerpc/pmap.c,v
retrieving revision 1.30
diff -c -r1.30 pmap.c
*** pmap.c	2000/06/29 07:48:18	1.30
--- pmap.c	2000/08/09 18:14:05
***************
*** 401,407 ****
  	ptab_cnt = HTABENTS;
  #else /* HTABENTS */
  	ptab_cnt = 1024;
! 	while ((HTABSIZE << 7) < ctob(physmem))
  		ptab_cnt <<= 1;
  #endif /* HTABENTS */
  
--- 401,407 ----
  	ptab_cnt = HTABENTS;
  #else /* HTABENTS */
  	ptab_cnt = 1024;
! 	while (btoc(HTABSIZE << 7) < physmem)
  		ptab_cnt <<= 1;
  #endif /* HTABENTS */
  

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>