Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa Convert PMAPDEBUG to UVMHIST



details:   https://anonhg.NetBSD.org/src/rev/afc2f9250606
branches:  trunk
changeset: 1009182:afc2f9250606
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Apr 15 15:50:15 2020 +0000

description:
Convert PMAPDEBUG to UVMHIST

diffstat:

 sys/arch/hppa/gsc/if_ie_gsc.c |   12 +-
 sys/arch/hppa/hppa/machdep.c  |   16 +-
 sys/arch/hppa/hppa/pmap.c     |  386 ++++++++++++++++++-----------------------
 3 files changed, 177 insertions(+), 237 deletions(-)

diffs (truncated from 977 to 300 lines):

diff -r f7d2d40570b6 -r afc2f9250606 sys/arch/hppa/gsc/if_ie_gsc.c
--- a/sys/arch/hppa/gsc/if_ie_gsc.c     Wed Apr 15 15:25:33 2020 +0000
+++ b/sys/arch/hppa/gsc/if_ie_gsc.c     Wed Apr 15 15:50:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ie_gsc.c,v 1.4 2019/04/25 10:08:45 msaitoh Exp $    */
+/*     $NetBSD: if_ie_gsc.c,v 1.5 2020/04/15 15:50:15 skrll Exp $      */
 
 /*     $OpenBSD: if_ie_gsc.c,v 1.6 2001/01/12 22:57:04 mickey Exp $    */
 
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.4 2019/04/25 10:08:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie_gsc.c,v 1.5 2020/04/15 15:50:15 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -378,11 +378,6 @@
        int rseg;
        int rv;
        uint8_t myaddr[ETHER_ADDR_LEN];
-#ifdef PMAPDEBUG
-       extern int pmapdebug;
-       int opmapdebug = pmapdebug;
-       pmapdebug = 0;
-#endif
 
        if (ga->ga_type.iodc_sv_model == HPPA_FIO_GLAN)
                gsc->flags |= IEGSC_GECKO;
@@ -506,9 +501,6 @@
                bus_dmamem_free(gsc->iemt, &seg, rseg);
                return;
        }
-#ifdef PMAPDEBUG
-       pmapdebug = opmapdebug;
-#endif
        if (!rv)
                return;
 
diff -r f7d2d40570b6 -r afc2f9250606 sys/arch/hppa/hppa/machdep.c
--- a/sys/arch/hppa/hppa/machdep.c      Wed Apr 15 15:25:33 2020 +0000
+++ b/sys/arch/hppa/hppa/machdep.c      Wed Apr 15 15:50:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.12 2019/12/31 13:07:10 ad Exp $  */
+/*     $NetBSD: machdep.c,v 1.13 2020/04/15 15:50:15 skrll Exp $       */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2019/12/31 13:07:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.13 2020/04/15 15:50:15 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -126,10 +126,6 @@
 #include <hppa/hppa/pim.h>
 #include <hppa/dev/cpudevs.h>
 
-#ifdef PMAPDEBUG
-#include <hppa/hppa/hpt.h>
-#endif
-
 #include "ksyms.h"
 #include "lcd.h"
 
@@ -898,12 +894,7 @@
 {
        vaddr_t minaddr, maxaddr;
        char pbuf[3][9];
-#ifdef PMAPDEBUG
-       extern int pmapdebug;
-       int opmapdebug = pmapdebug;
 
-       pmapdebug = 0;
-#endif
        /* Initialize the message buffer. */
        initmsgbuf(msgbufaddr, MSGBUFSIZE);
 
@@ -940,9 +931,6 @@
        phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
            VM_PHYS_SIZE, 0, false, NULL);
 
-#ifdef PMAPDEBUG
-       pmapdebug = opmapdebug;
-#endif
        format_bytes(pbuf[0], sizeof(pbuf[0]), ptoa(uvm_availmem()));
        printf("avail mem = %s\n", pbuf[0]);
 }
diff -r f7d2d40570b6 -r afc2f9250606 sys/arch/hppa/hppa/pmap.c
--- a/sys/arch/hppa/hppa/pmap.c Wed Apr 15 15:25:33 2020 +0000
+++ b/sys/arch/hppa/hppa/pmap.c Wed Apr 15 15:50:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.108 2020/04/15 15:22:37 skrll Exp $ */
+/*     $NetBSD: pmap.c,v 1.109 2020/04/15 15:50:15 skrll Exp $ */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2020/04/15 15:22:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2020/04/15 15:50:15 skrll Exp $");
 
 #include "opt_cputype.h"
 
@@ -94,52 +94,6 @@
 #include <ddb/db_output.h>
 #endif
 
-#ifdef PMAPDEBUG
-
-#define        static  /**/
-#define        inline  /**/
-
-#define        DPRINTF(l,s)    do {            \
-       if ((pmapdebug & (l)) == (l))   \
-               printf s;               \
-} while(0)
-
-#define        PDB_FOLLOW      0x00000001
-#define        PDB_INIT        0x00000002
-#define        PDB_ENTER       0x00000004
-#define        PDB_REMOVE      0x00000008
-#define        PDB_CREATE      0x00000010
-#define        PDB_PTPAGE      0x00000020
-#define        PDB_CACHE       0x00000040
-#define        PDB_BITS        0x00000080
-#define        PDB_COLLECT     0x00000100
-#define        PDB_PROTECT     0x00000200
-#define        PDB_EXTRACT     0x00000400
-#define        PDB_VP          0x00000800
-#define        PDB_PV          0x00001000
-#define        PDB_PARANOIA    0x00002000
-#define        PDB_WIRING      0x00004000
-#define        PDB_PMAP        0x00008000
-#define        PDB_STEAL       0x00010000
-#define        PDB_PHYS        0x00020000
-#define        PDB_POOL        0x00040000
-#define        PDB_ALIAS       0x00080000
-int pmapdebug = 0
-       | PDB_INIT
-       | PDB_FOLLOW
-       | PDB_VP
-       | PDB_PV
-       | PDB_ENTER
-       | PDB_REMOVE
-       | PDB_STEAL
-       | PDB_PROTECT
-       | PDB_PHYS
-       | PDB_ALIAS
-       ;
-#else
-#define        DPRINTF(l,s)    /* */
-#endif
-
 int            pmap_hptsize = 16 * PAGE_SIZE;  /* patchable */
 vaddr_t                pmap_hpt;
 
@@ -331,9 +285,9 @@
 static inline void
 pmap_pde_set(pmap_t pm, vaddr_t va, paddr_t ptp)
 {
-
-       DPRINTF(PDB_FOLLOW|PDB_VP,
-           ("%s(%p, 0x%lx, 0x%lx)\n", __func__, pm, va, ptp));
+       UVMHIST_FUNC(__func__);
+       UVMHIST_CALLARGS(maphist, "pm %#jx va %#jx ptp %#jx", (uintptr_t)pm,
+           va, ptp, 0);
 
        KASSERT((ptp & PGOFSET) == 0);
 
@@ -346,8 +300,9 @@
        struct vm_page *pg;
        paddr_t pa;
 
-       DPRINTF(PDB_FOLLOW|PDB_VP,
-           ("%s(%p, 0x%lx, %p)\n", __func__, pm, va, pdep));
+       UVMHIST_FUNC(__func__);
+       UVMHIST_CALLARGS(maphist, "pm %#jx va %#jx pdep %#jx", (uintptr_t)pm,
+           va, (uintptr_t)pdep, 0);
 
        KASSERT(pm != pmap_kernel());
        KASSERT(rw_write_held(pm->pm_lock));
@@ -359,7 +314,7 @@
 
        pa = VM_PAGE_TO_PHYS(pg);
 
-       DPRINTF(PDB_FOLLOW|PDB_VP, ("%s: pde %lx\n", __func__, pa));
+       UVMHIST_LOG(maphist, "pde %#jx", pa, 0, 0, 0);
 
        pg->flags &= ~PG_BUSY;          /* never busy */
        pg->wire_count = 1;             /* no mappings yet */
@@ -376,12 +331,15 @@
 {
        paddr_t pa = (paddr_t)pde;
 
-       DPRINTF(PDB_FOLLOW|PDB_PV, ("%s(%p, %p)\n", __func__, pm, pde));
+       UVMHIST_FUNC(__func__);
+       UVMHIST_CALLARGS(maphist, "pm %#jx va %#jx pdep %#jx", (uintptr_t)pm,
+           (uintptr_t)pde, 0, 0);
 
        if (pm->pm_ptphint && VM_PAGE_TO_PHYS(pm->pm_ptphint) == pa)
                return (pm->pm_ptphint);
 
-       DPRINTF(PDB_FOLLOW|PDB_PV, ("%s: lookup 0x%lx\n", __func__, pa));
+       UVMHIST_LOG(maphist, "<--- done (%#jx)",
+           (uintptr_t)PHYS_TO_VM_PAGE(pa), 0, 0, 0);
 
        return (PHYS_TO_VM_PAGE(pa));
 }
@@ -389,14 +347,14 @@
 static inline void
 pmap_pde_release(pmap_t pmap, vaddr_t va, struct vm_page *ptp)
 {
-
-       DPRINTF(PDB_FOLLOW|PDB_PV,
-           ("%s(%p, 0x%lx, %p)\n", __func__, pmap, va, ptp));
+       UVMHIST_FUNC(__func__);
+       UVMHIST_CALLARGS(maphist, "pm %#jx va %#jx ptp %#jx", (uintptr_t)pmap,
+           va, (uintptr_t)ptp, 0);
 
        KASSERT(pmap != pmap_kernel());
        if (--ptp->wire_count <= 1) {
-               DPRINTF(PDB_FOLLOW|PDB_PV,
-                   ("%s: disposing ptp %p\n", __func__, ptp));
+               UVMHIST_LOG(maphist, "disposing ptp %#jx", (uintptr_t)ptp, 0,
+                   0, 0);
                pmap_pde_set(pmap, va, 0);
                pmap->pm_stats.resident_count--;
                if (pmap->pm_ptphint == ptp)
@@ -420,8 +378,12 @@
 pmap_pte_set(volatile pt_entry_t *pde, vaddr_t va, pt_entry_t pte)
 {
 
-       DPRINTF(PDB_FOLLOW|PDB_VP, ("%s(%p, 0x%lx, 0x%x)\n",
-           __func__, pde, va, pte));
+       /* too verbose due to hppa_pagezero_{,un}map */
+#if 0
+       UVMHIST_FUNC(__func__);
+       UVMHIST_CALLARGS(maphist, "pdep %#jx va %#jx pte %#jx", (uintptr_t)pde,
+           va, pte, 0);
+#endif
 
        KASSERT(pde != NULL);
        KASSERT(((paddr_t)pde & PGOFSET) == 0);
@@ -433,6 +395,12 @@
 pmap_pte_flush(pmap_t pmap, vaddr_t va, pt_entry_t pte)
 {
 
+       UVMHIST_FUNC(__func__);
+       if (pmap != pmap_kernel() && va != 0) {
+               UVMHIST_CALLARGS(maphist, "pm %#jx va %#jx pte %#jx",
+                   (uintptr_t)pmap, va, (uintptr_t)pte, 0);
+       }
+
        fdcache(pmap->pm_space, va, PAGE_SIZE);
        if (pte & PTE_PROT(TLB_EXECUTE)) {
                ficache(pmap->pm_space, va, PAGE_SIZE);
@@ -528,21 +496,30 @@
        struct pv_entry *pve;
        int ret = 0;
 
+       UVMHIST_FUNC(__func__);
+       UVMHIST_CALLARGS(maphist, "pg %#jx va %#jx pte %#jx", (uintptr_t)pg,
+           va, pte, 0);
+
        /* check for non-equ aliased mappings */
        for (pve = md->pvh_list; pve; pve = pve->pv_next) {
                vaddr_t pva = pve->pv_va & PV_VAMASK;
 
+               UVMHIST_LOG(maphist, "... pm %#jx va %#jx",
+                   (uintptr_t)pve->pv_pmap, pva, 0, 0);
+
                pte |= pmap_vp_find(pve->pv_pmap, pva);
                if ((va & HPPA_PGAOFF) != (pva & HPPA_PGAOFF) &&
                    (pte & PTE_PROT(TLB_WRITE))) {
+                       UVMHIST_LOG(maphist,
+                           "aliased writable mapping %#jx:%#jx",
+                           pve->pv_pmap->pm_space, pve->pv_va, 0, 0);
 
-                       DPRINTF(PDB_FOLLOW|PDB_ALIAS,
-                           ("%s: aliased writable mapping 0x%x:0x%lx\n",
-                           __func__, pve->pv_pmap->pm_space, pve->pv_va));
                        ret++;
                }
        }
 
+       UVMHIST_LOG(maphist, "<--- done (%jd)", ret, 0, 0, 0);
+
        return (ret);
 }
 
@@ -554,12 +531,8 @@
 {
        struct pv_entry *pv;



Home | Main Index | Thread Index | Old Index