Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/bde2a84f5935
branches:  trunk
changeset: 745190:bde2a84f5935
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Feb 24 20:31:56 2020 +0000

description:
Adjust for UVM locking changes

diffstat:

 sys/arch/arm/arm32/pmap.c         |  37 ++++++++++++++-----------------------
 sys/arch/arm/include/arm32/pmap.h |   7 +++----
 2 files changed, 17 insertions(+), 27 deletions(-)

diffs (128 lines):

diff -r b9adc578e72e -r bde2a84f5935 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Mon Feb 24 20:11:45 2020 +0000
+++ b/sys/arch/arm/arm32/pmap.c Mon Feb 24 20:31:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.393 2020/02/23 10:22:07 skrll Exp $ */
+/*     $NetBSD: pmap.c,v 1.394 2020/02/24 20:31:56 ad Exp $    */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -198,8 +198,9 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.393 2020/02/23 10:22:07 skrll Exp $");
-
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.394 2020/02/24 20:31:56 ad Exp $");
+
+#include <sys/atomic.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -548,7 +549,7 @@
                return;
 #endif
 
-       mutex_enter(pm->pm_lock);
+       mutex_enter(&pm->pm_lock);
 }
 
 static inline void
@@ -558,7 +559,7 @@
        if (__predict_false(db_onproc != NULL))
                return;
 #endif
-       mutex_exit(pm->pm_lock);
+       mutex_exit(&pm->pm_lock);
 }
 
 static inline void
@@ -3026,10 +3027,9 @@
 
        pm = pool_cache_get(&pmap_cache, PR_WAITOK);
 
-       mutex_init(&pm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
-       uvm_obj_init(&pm->pm_obj, NULL, false, 1);
-       uvm_obj_setlock(&pm->pm_obj, &pm->pm_obj_lock);
-
+       mutex_init(&pm->pm_lock, MUTEX_DEFAULT, IPL_NONE);
+
+       pm->pm_refs = 1;
        pm->pm_stats.wired_count = 0;
        pm->pm_stats.resident_count = 1;
 #ifdef ARM_MMU_EXTENDED
@@ -5219,8 +5219,6 @@
 {
        UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
 
-       u_int count;
-
        if (pm == NULL)
                return;
 
@@ -5239,10 +5237,7 @@
        /*
         * Drop reference count
         */
-       mutex_enter(pm->pm_lock);
-       count = --pm->pm_obj.uo_refs;
-       mutex_exit(pm->pm_lock);
-       if (count > 0) {
+       if (atomic_dec_uint_nv(&pm->pm_refs) > 0) {
 #ifndef ARM_MMU_EXTENDED
                if (pmap_is_current(pm)) {
                        if (pm != pmap_kernel())
@@ -5280,8 +5275,7 @@
                ci->ci_pmap_lastuser = NULL;
 #endif
 
-       uvm_obj_destroy(&pm->pm_obj, false);
-       mutex_destroy(&pm->pm_obj_lock);
+       mutex_destroy(&pm->pm_lock);
        pool_cache_put(&pmap_cache, pm);
        UVMHIST_LOG(maphist, "  <-- done", 0, 0, 0, 0);
 }
@@ -5303,9 +5297,7 @@
        pmap_use_l1(pm);
 #endif
 
-       mutex_enter(pm->pm_lock);
-       pm->pm_obj.uo_refs++;
-       mutex_exit(pm->pm_lock);
+       atomic_inc_uint(&pm->pm_refs);
 }
 
 #if (ARM_MMU_V6 + ARM_MMU_V7) > 0
@@ -6209,9 +6201,8 @@
         */
        mutex_init(&pmap_lock, MUTEX_DEFAULT, IPL_VM);
        mutex_init(&kpm_lock, MUTEX_DEFAULT, IPL_NONE);
-       mutex_init(&pm->pm_obj_lock, MUTEX_DEFAULT, IPL_VM);
-       uvm_obj_init(&pm->pm_obj, NULL, false, 1);
-       uvm_obj_setlock(&pm->pm_obj, &pm->pm_obj_lock);
+       mutex_init(&pm->pm_lock, MUTEX_DEFAULT, IPL_VM);
+       pm->pm_refs = 1;
 
        VPRINTF("l1pt ");
        /*
diff -r b9adc578e72e -r bde2a84f5935 sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Mon Feb 24 20:11:45 2020 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Mon Feb 24 20:31:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.162 2020/02/23 15:12:18 skrll Exp $ */
+/*     $NetBSD: pmap.h,v 1.163 2020/02/24 20:31:56 ad Exp $    */
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -229,9 +229,8 @@
  * The pmap structure itself
  */
 struct pmap {
-       struct uvm_object       pm_obj;
-       kmutex_t                pm_obj_lock;
-#define        pm_lock pm_obj.vmobjlock
+       kmutex_t                pm_lock;
+       u_int                   pm_refs;
 #ifndef ARM_HAS_VBAR
        pd_entry_t              *pm_pl1vec;
        pd_entry_t              pm_l1vec;



Home | Main Index | Thread Index | Old Index