Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add some DIAGNOSTIC checks for inconsistent use of ...



details:   https://anonhg.NetBSD.org/src/rev/5149ba8bb101
branches:  trunk
changeset: 473219:5149ba8bb101
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 25 20:33:33 1999 +0000

description:
Add some DIAGNOSTIC checks for inconsistent use of pmap_enter/pmap_kremove.

diffstat:

 sys/arch/i386/i386/pmap.new.c   |  51 ++++++++++++++++++++++++----------------
 sys/arch/pc532/pc532/pmap.new.c |  33 +++++++++++++++-----------
 2 files changed, 49 insertions(+), 35 deletions(-)

diffs (170 lines):

diff -r aa020291f9ea -r 5149ba8bb101 sys/arch/i386/i386/pmap.new.c
--- a/sys/arch/i386/i386/pmap.new.c     Tue May 25 20:32:29 1999 +0000
+++ b/sys/arch/i386/i386/pmap.new.c     Tue May 25 20:33:33 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.new.c,v 1.27 1999/05/20 23:03:23 thorpej Exp $    */
+/*     $NetBSD: pmap.new.c,v 1.28 1999/05/25 20:33:33 thorpej Exp $    */
 
 /*
  *
@@ -635,28 +635,20 @@
 
   len = len / NBPG;
 
+  s = splimp();
+  simple_lock(&pm->pm_obj.vmobjlock);
+
   for ( /* null */ ; len ; len--, va += NBPG) {
 
     pte = vtopte(va);    
 
-    /* 
-     * XXXCDC: we can get PVLIST if the mapping was created by uvm_fault
-     * as part of a pageable kernel mapping.  in that case we need to
-     * update the pvlists, so we punt the problem to the more powerful
-     * (and complex) pmap_remove() function.   this is kind of ugly...
-     * need to rethink this a bit.
-     */
-    if (*pte & PG_PVLIST) {
-      pmap_remove(pmap_kernel(), va, va + (len*NBPG)); /* punt ... */
-      return;
-    }
-
-    s = splimp();
-    simple_lock(&pm->pm_obj.vmobjlock);
+#ifdef DIAGNOSTIC
+    if (*pte & PG_PVLIST)
+      panic("pmap_kremove: PG_PVLIST mapping for 0x%lx\n", va);
+#endif
+
     pm->pm_stats.resident_count--;
     pm->pm_stats.wired_count--;
-    simple_unlock(&pm->pm_obj.vmobjlock);
-    splx(s);
 
     *pte = 0;          /* zap! */
 #if defined(I386_CPU)
@@ -666,6 +658,9 @@
     
   }
 
+  simple_unlock(&pm->pm_obj.vmobjlock);
+  splx(s);
+
 #if defined(I386_CPU)
   if (cpu_class == CPUCLASS_386)
     pmap_update();
@@ -688,14 +683,16 @@
 
   s = splimp();
   simple_lock(&pm->pm_obj.vmobjlock);
+
   pm->pm_stats.resident_count--;
   pm->pm_stats.wired_count--;
-  simple_unlock(&pm->pm_obj.vmobjlock);
-  splx(s);
 
   pte = vtopte(va);
   *pte = 0;            /* zap! */
   pmap_update_pg(va);
+
+  simple_unlock(&pm->pm_obj.vmobjlock);
+  splx(s);
 }
 
 /*
@@ -2233,8 +2230,14 @@
     /*
      * if we are not on a pv_head list we are done.
      */
-    if ((opte & PG_PVLIST) == 0)
+    if ((opte & PG_PVLIST) == 0) {
+#ifdef DIAGNOSTIC
+      if (vm_physseg_find(i386_btop(opte & PG_FRAME), &off) != -1)
+       panic("pmap_remove_ptes: managed page without PG_PVLIST for 0x%lx",
+         startva);
+#endif
       continue;
+    }
 
     bank = vm_physseg_find(i386_btop(opte & PG_FRAME), &off);
     if (bank == -1)
@@ -2307,8 +2310,14 @@
   /*
    * if we are not on a pv_head list we are done.
    */
-  if ((opte & PG_PVLIST) == 0)
+  if ((opte & PG_PVLIST) == 0) {
+#ifdef DIAGNOSTIC
+      if (vm_physseg_find(i386_btop(opte & PG_FRAME), &off) != -1)
+       panic("pmap_remove_ptes: managed page without PG_PVLIST for 0x%lx",
+         va);
+#endif
     return(TRUE);
+  }
 
   bank = vm_physseg_find(i386_btop(opte & PG_FRAME), &off);
   if (bank == -1)
diff -r aa020291f9ea -r 5149ba8bb101 sys/arch/pc532/pc532/pmap.new.c
--- a/sys/arch/pc532/pc532/pmap.new.c   Tue May 25 20:32:29 1999 +0000
+++ b/sys/arch/pc532/pc532/pmap.new.c   Tue May 25 20:33:33 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.new.c,v 1.13 1999/05/20 23:03:23 thorpej Exp $    */
+/*     $NetBSD: pmap.new.c,v 1.14 1999/05/25 20:37:49 thorpej Exp $    */
 
 /*
  *
@@ -616,17 +616,10 @@
 
     pte = vtopte(va);    
 
-    /* 
-     * XXXCDC: we can get PVLIST if the mapping was created by uvm_fault
-     * as part of a pageable kernel mapping.  in that case we need to
-     * update the pvlists, so we punt the problem to the more powerful
-     * (and complex) pmap_remove() function.   this is kind of ugly...
-     * need to rethink this a bit.
-     */
-    if (*pte & PG_PVLIST) {
-      pmap_remove(pmap_kernel(), va, va + (len*NBPG)); /* punt ... */
-      return;
-    }
+#ifdef DIAGNOSTIC
+    if (*pte & PG_PVLIST)
+      panic("pmap_kremove: PG_PVLIST mapping for 0x%lx\n", va);
+#endif
 
     *pte = 0;          /* zap! */
     pmap_update_pg(va);
@@ -2019,8 +2012,14 @@
     /*
      * if we are not on a pv_head list we are done.
      */
-    if ((opte & PG_PVLIST) == 0)
+    if ((opte & PG_PVLIST) == 0) {
+#ifdef DIAGNOSTIC
+      if (vm_physseg_find(ns532_btop(opte & PG_FRAME), &off) != -1)
+       panic("pmap_remove_ptes: managed page without PG_PVLIST for 0x%lx",
+         startva);
+#endif
       continue;
+    }
 
     bank = vm_physseg_find(ns532_btop(opte & PG_FRAME), &off);
     if (bank == -1)
@@ -2093,8 +2092,14 @@
   /*
    * if we are not on a pv_head list we are done.
    */
-  if ((opte & PG_PVLIST) == 0)
+  if ((opte & PG_PVLIST) == 0) {
+#ifdef DIAGNOSTIC
+    if (vm_physseg_find(ns532_btop(opte & PG_FRAME), &off) != -1)
+      panic("pmap_remove_ptes: managed page without PG_PVLIST for 0x%lx",
+       va);
+#endif
     return(TRUE);
+  }
 
   bank = vm_physseg_find(ns532_btop(opte & PG_FRAME), &off);
   if (bank == -1)



Home | Main Index | Thread Index | Old Index