Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa Adjust for UVM locking changes.



details:   https://anonhg.NetBSD.org/src/rev/9e5926249562
branches:  trunk
changeset: 1007650:9e5926249562
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Feb 24 20:42:18 2020 +0000

description:
Adjust for UVM locking changes.

diffstat:

 sys/arch/hppa/hppa/pmap.c    |  45 ++++++++++++++++++++++---------------------
 sys/arch/hppa/include/pmap.h |   6 ++--
 2 files changed, 26 insertions(+), 25 deletions(-)

diffs (159 lines):

diff -r f18dfdeffb40 -r 9e5926249562 sys/arch/hppa/hppa/pmap.c
--- a/sys/arch/hppa/hppa/pmap.c Mon Feb 24 20:31:56 2020 +0000
+++ b/sys/arch/hppa/hppa/pmap.c Mon Feb 24 20:42:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.103 2020/02/23 15:46:39 ad Exp $    */
+/*     $NetBSD: pmap.c,v 1.104 2020/02/24 20:42:18 ad 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.103 2020/02/23 15:46:39 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2020/02/24 20:42:18 ad Exp $");
 
 #include "opt_cputype.h"
 
@@ -74,6 +74,7 @@
 #include <sys/malloc.h>
 #include <sys/proc.h>
 #include <sys/mutex.h>
+#include <sys/rwlock.h>
 
 #include <uvm/uvm.h>
 #include <uvm/uvm_page_array.h>
@@ -237,16 +238,16 @@
 #define pmap_pvh_attrs(a) \
        (((a) & (PVF_MOD|PVF_REF)) ^ PVF_REF)
 
-#define PMAP_LOCK(pm)                                  \
-       do {                                            \
-               if ((pm) != pmap_kernel())              \
-                       mutex_enter((pm)->pm_lock);     \
+#define PMAP_LOCK(pm)                                          \
+       do {                                                    \
+               if ((pm) != pmap_kernel())                      \
+                       rw_enter((pm)->pm_lock, RW_WRITER);     \
        } while (/*CONSTCOND*/0)
 
-#define PMAP_UNLOCK(pm)                                        \
-       do {                                            \
-               if ((pm) != pmap_kernel())              \
-                       mutex_exit((pm)->pm_lock);      \
+#define PMAP_UNLOCK(pm)                                                \
+       do {                                                    \
+               if ((pm) != pmap_kernel())                      \
+                       rw_exit((pm)->pm_lock);                 \
        } while (/*CONSTCOND*/0)
 
 struct vm_page *
@@ -346,7 +347,7 @@
            ("%s(%p, 0x%lx, %p)\n", __func__, pm, va, pdep));
 
        KASSERT(pm != pmap_kernel());
-       KASSERT(mutex_owned(pm->pm_lock));
+       KASSERT(rw_write_held(pm->pm_lock));
 
        pg = pmap_pagealloc(&pm->pm_obj, va);
 
@@ -694,7 +695,7 @@
        kpm = pmap_kernel();
        memset(kpm, 0, sizeof(*kpm));
 
-       mutex_init(&kpm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
+       rw_init(&kpm->pm_obj_lock);
        uvm_obj_init(&kpm->pm_obj, NULL, false, 1);
        uvm_obj_setlock(&kpm->pm_obj, &kpm->pm_obj_lock);
 
@@ -1057,7 +1058,7 @@
 
        DPRINTF(PDB_FOLLOW|PDB_PMAP, ("%s: pmap = %p\n", __func__, pmap));
 
-       mutex_init(&pmap->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
+       rw_init(&pmap->pm_obj_lock);
        uvm_obj_init(&pmap->pm_obj, NULL, false, 1);
        uvm_obj_setlock(&pmap->pm_obj, &pmap->pm_obj_lock);
 
@@ -1110,9 +1111,9 @@
 
        DPRINTF(PDB_FOLLOW|PDB_PMAP, ("%s(%p)\n", __func__, pmap));
 
-       mutex_enter(pmap->pm_lock);
+       rw_enter(pmap->pm_lock, RW_WRITER);
        refs = --pmap->pm_obj.uo_refs;
-       mutex_exit(pmap->pm_lock);
+       rw_exit(pmap->pm_lock);
 
        if (refs > 0)
                return;
@@ -1120,7 +1121,7 @@
 #ifdef DIAGNOSTIC
        uvm_page_array_init(&a);
        off = 0;
-       mutex_enter(pmap->pm_lock);
+       rw_enter(pmap->pm_lock, RW_WRITER);
        while ((pg = uvm_page_array_fill_and_peek(&a, &pmap->pm_obj, off, 0, 0))
            != NULL) {
                pt_entry_t *pde, *epde;
@@ -1161,16 +1162,16 @@
                }
                DPRINTF(PDB_FOLLOW, ("\n"));
        }
-       mutex_exit(pmap->pm_lock);
+       rw_exit(pmap->pm_lock);
        uvm_page_array_fini(&a);
 #endif
        pmap_sdir_set(pmap->pm_space, 0);
-       mutex_enter(pmap->pm_lock);
+       rw_enter(pmap->pm_lock, RW_WRITER);
        pmap_pagefree(pmap->pm_pdir_pg);
-       mutex_exit(pmap->pm_lock);
+       rw_exit(pmap->pm_lock);
 
        uvm_obj_destroy(&pmap->pm_obj, false);
-       mutex_destroy(&pmap->pm_obj_lock);
+       rw_destroy(&pmap->pm_obj_lock);
        pool_put(&pmap_pool, pmap);
 }
 
@@ -1183,9 +1184,9 @@
 
        DPRINTF(PDB_FOLLOW|PDB_PMAP, ("%s(%p)\n", __func__, pmap));
 
-       mutex_enter(pmap->pm_lock);
+       rw_enter(pmap->pm_lock, RW_WRITER);
        pmap->pm_obj.uo_refs++;
-       mutex_exit(pmap->pm_lock);
+       rw_exit(pmap->pm_lock);
 }
 
 
diff -r f18dfdeffb40 -r 9e5926249562 sys/arch/hppa/include/pmap.h
--- a/sys/arch/hppa/include/pmap.h      Mon Feb 24 20:31:56 2020 +0000
+++ b/sys/arch/hppa/include/pmap.h      Mon Feb 24 20:42:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.38 2019/08/12 09:18:30 skrll Exp $  */
+/*     $NetBSD: pmap.h,v 1.39 2020/02/24 20:42:18 ad Exp $     */
 
 /*     $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $       */
 
@@ -39,7 +39,7 @@
 #include "opt_cputype.h"
 #endif
 
-#include <sys/mutex.h>
+#include <sys/rwlock.h>
 #include <machine/pte.h>
 #include <machine/cpufunc.h>
 
@@ -53,7 +53,7 @@
 struct pmap {
        struct uvm_object pm_obj;       /* object (lck by object lock) */
 #define        pm_lock pm_obj.vmobjlock
-       kmutex_t        pm_obj_lock;    /* lock for pm_obj */
+       krwlock_t       pm_obj_lock;    /* lock for pm_obj */
        struct vm_page  *pm_ptphint;
        struct vm_page  *pm_pdir_pg;    /* vm_page for pdir */
        volatile uint32_t *pm_pdir;     /* page dir (read-only after create) */



Home | Main Index | Thread Index | Old Index