Subject: Re: NetBSD/ofppc boots multiuser on Pegasos
To: <>
From: =?ISO-8859-1?Q?Jorge_Acereda_Maci=E1?= <jacereda@gmail.com>
List: port-ofppc
Date: 07/29/2006 21:47:28
Jorge Acereda Maciá wrote:
> Simon Burge wrote:
> 
>> Maybe try regress/sys/uvm/mmap ?
> 
> 
> Bingo :-)
> 
> mmap: mmap anon MAP_WIRED: Cannot allocate memory
> 
> 

BTW, what's the normal output of the mmap regression test? I don't have 
a NetBSD box here to test...

pmap_wired_count() was returning negative values. This patch seems to 
fix that, but I'm afraid those 128 resident pages aren't normal :-) 
Perhaps someone more experienced than me can take a look at it?


 >>> MAPPING FILE <<<
     CHECKING RESIDENCY
     LOCKING RANGE
     CHECKING RESIDENCY
     UNLOCKING RANGE
 >>> MAPPING 128 PAGE ANONYMOUS REGION WITH MAP_WIRED <<<
     CHECKING RESIDENCY
 >>> MAPPING 128 PAGE ANONYMOUS REGION <<<
     CHECKING RESIDENCY
     LOCKING ALL - CURRENT and FUTURE
     CHECKING RESIDENCY
 >>> MAPPING ANOTHER 128 PAGE ANONYMOUS REGION <<<
     CHECKING RESIDENCY
 >>> MAPPING THIRD 128 PAGE ANONYMOUS REGION, PROT_NONE <<<
     CHECKING RESIDENCY
     PROT_READ'ING MAPPING
     CHECKING RESIDENCY
     UNLOCKING ALL
     CHECKING RESIDENCY
 >>> MADV_FREE'ING SECOND ANONYMOUS REGION <<<
     CHECKING RESIDENCY
 >>> MADV_FREE'ING FIRST ANONYMOUS REGION <<<
     CHECKING RESIDENCY
 >>> ZEROING FIRST ANONYMOUS REGION <<<
     CHECKING RESIDENCY
 >>> MADV_FREE'ING FIRST ANONYMOUS REGION AGAIN <<<
     CHECKING RESIDENCY
 >>> UNMAPPING ANONYMOUS REGIONS <<<
 >>> CREATING MAPPED FILE <<<
     WRITING TEST PATTERN
     SYNCING FILE
     UNMAPPING FILE
     READING FILE
     CHECKING TEST PATTERN
 >>> CREATING SYSV SHM SEGMENT <<<
     CHECKING RESIDENCY
     ZEROING SEGMENT
     CHECKING RESIDENCY
     MADV_FREE'ING SEGMENT
     CHECKING RESIDENCY
     RESIDENCY CHECK: 128 pages still resident

Index: sys/arch/powerpc/oea/pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/oea/pmap.c,v
retrieving revision 1.37
diff -u -r1.37 pmap.c
--- sys/arch/powerpc/oea/pmap.c	13 May 2006 04:04:45 -0000	1.37
+++ sys/arch/powerpc/oea/pmap.c	29 Jul 2006 19:46:02 -0000
@@ -1241,6 +1241,8 @@
  pmap_destroy(pmap_t pm)
  {
  	if (--pm->pm_refs == 0) {
+		KASSERT(pm->pm_stats.resident_count == 0);
+		KASSERT(pm->pm_stats.wired_count == 0);
  		pmap_release(pm);
  		pool_put(&pmap_pool, pm);
  	}
@@ -1657,7 +1659,7 @@
  	pmap_pte_create(&pvo->pvo_pte, pm, va, pa | pte_lo);

  	LIST_INSERT_HEAD(pvo_head, pvo, pvo_vlink);
-	if (pvo->pvo_pte.pte_lo & PVO_WIRED)
+	if (pvo->pvo_vaddr & PVO_WIRED)
  		pvo->pvo_pmap->pm_stats.wired_count++;
  	pvo->pvo_pmap->pm_stats.resident_count++;
  #if defined(DEBUG)
@@ -1751,7 +1753,7 @@
  	 * Update our statistics.
  	 */
  	pvo->pvo_pmap->pm_stats.resident_count--;
-	if (pvo->pvo_pte.pte_lo & PVO_WIRED)
+	if (pvo->pvo_vaddr & PVO_WIRED)
  		pvo->pvo_pmap->pm_stats.wired_count--;

  	/*