Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc sun4/sun4c DIAGNOSTIC: fix tally of loc...



details:   https://anonhg.NetBSD.org/src/rev/1801aed01e59
branches:  trunk
changeset: 550775:1801aed01e59
user:      pk <pk%NetBSD.org@localhost>
date:      Thu Aug 21 09:36:28 2003 +0000

description:
sun4/sun4c DIAGNOSTIC: fix tally of locked down pmegs.
pmap_page_protect: DIAGNOSTIC: show `pg' argument in panic.
pmap_unwire: for now, only used for sun4/sun4c MMUs.

diffstat:

 sys/arch/sparc/sparc/pmap.c |  34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diffs (122 lines):

diff -r f7682e2c9dba -r 1801aed01e59 sys/arch/sparc/sparc/pmap.c
--- a/sys/arch/sparc/sparc/pmap.c       Thu Aug 21 08:36:56 2003 +0000
+++ b/sys/arch/sparc/sparc/pmap.c       Thu Aug 21 09:36:28 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.267 2003/08/16 19:21:21 pk Exp $ */
+/*     $NetBSD: pmap.c,v 1.268 2003/08/21 09:36:28 pk Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.267 2003/08/16 19:21:21 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.268 2003/08/21 09:36:28 pk Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1984,6 +1984,11 @@
        struct mmuentry *me = &mmusegments[pmeg];
        MMUQ_REMOVE(me, me_list);
        MMUQ_INSERT_TAIL(&segm_locked, me, me_list);
+#ifdef DIAGNOSTIC
+       (*me->me_statp)--;
+       pmap_stats.ps_npmeg_locked++;
+       me->me_statp = &pmap_stats.ps_npmeg_locked;
+#endif
 }
 
 static void
@@ -1992,6 +1997,11 @@
        struct mmuentry *me = &mmusegments[pmeg];
        MMUQ_REMOVE(me, me_list);
        MMUQ_INSERT_TAIL(&segm_lru, me, me_list);
+#ifdef DIAGNOSTIC
+       (*me->me_statp)--;
+       pmap_stats.ps_npmeg_lru++;
+       me->me_statp = &pmap_stats.ps_npmeg_lru;
+#endif
 }
 
 static void
@@ -3389,7 +3399,7 @@
                /* set up the mmu entry */
                MMUQ_INSERT_TAIL(&segm_locked, mmuseg, me_list);
 #ifdef DIAGNOSTIC
-               mmuseg->me_statp = NULL;
+               mmuseg->me_statp = &pmap_stats.ps_npmeg_locked;
 #endif
                TAILQ_INSERT_TAIL(&pmap_kernel()->pm_seglist, mmuseg, me_pmchain);
                pmap_stats.ps_npmeg_locked++;
@@ -5041,9 +5051,9 @@
                        pte = getpte4(pteva);
 #ifdef DIAGNOSTIC
                        if ((pte & PG_V) == 0)
-                               panic("pmap_page_protect !PG_V: "
+                               panic("pmap_page_protect !PG_V: pg %p "
                                      "ctx %d, va 0x%lx, pte 0x%x",
-                                     pm->pm_ctxnum, va, pte);
+                                     pg, pm->pm_ctxnum, va, pte);
 #endif
                        flags |= MR4_4C(pte);
 
@@ -5281,7 +5291,8 @@
 {
        struct pvlist *pv, *npv;
        struct pmap *pm;
-       int va, vr, vs, tpte;
+       vaddr_t va;
+       int vr, vs, tpte;
        int flags, nleft, s;
        struct regmap *rp;
        struct segmap *sp;
@@ -5347,7 +5358,7 @@
                    pm->pm_ctx != NULL, pm->pm_ctxnum, PMAP_CPUSET(pm));
 
                if ((tpte & SRMMU_TETYPE) != SRMMU_TEPTE)
-                       panic("pmap_page_protect !PG_V");
+                       panic("pmap_page_protect !PG_V: pg %p va %lx", pg, va);
 
                flags |= MR4M(tpte);
 
@@ -6658,7 +6669,6 @@
 /*
  * Clear the wiring attribute for a map/virtual-address pair.
  */
-int printunwire=0;
 /* ARGSUSED */
 void
 pmap_unwire(pm, va)
@@ -6669,17 +6679,22 @@
        struct regmap *rp;
        struct segmap *sp;
 
+       /* For now, `wired page accounting' is only used on sun4/sun4c */
+       if (CPU_HAS_SRMMU)
+               return;
+
        vr = VA_VREG(va);
        vs = VA_VSEG(va);
        rp = &pm->pm_regmap[vr];
        sp = &rp->rg_segmap[vs];
        ptep = &sp->sg_pte[VA_VPG(va)];
        pte = *ptep;
+
+#if defined(SUN4) || defined(SUN4C)
        if ((pte & PG_WIRED) == 0) {
                pmap_stats.ps_useless_changewire++;
                return;
        }
-if (printunwire) printf("pmap_unwire: pm %p, va %lx\n", pm, va);
 
        pte &= ~PG_WIRED;
        *ptep = pte;
@@ -6692,6 +6707,7 @@
                if (sp->sg_pmeg != seginval)
                        mmu_pmeg_unlock(sp->sg_pmeg);
        }
+#endif
 }
 
 /*



Home | Main Index | Thread Index | Old Index