Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 Move pmap_recent_user to ci->ci_pmap_last...



details:   https://anonhg.NetBSD.org/src/rev/4ffd0541f0b4
branches:  trunk
changeset: 327048:4ffd0541f0b4
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Feb 26 02:07:58 2014 +0000

description:
Move pmap_recent_user to ci->ci_pmap_lastuser and
pmap_previous_active_lwp to ci->ci_lastlwp.  Fix some comments.

diffstat:

 sys/arch/arm/arm32/cpuswitch.S |  17 +++++++----------
 sys/arch/arm/arm32/genassym.cf |   3 ++-
 sys/arch/arm/arm32/pmap.c      |  39 +++++++++++++++------------------------
 3 files changed, 24 insertions(+), 35 deletions(-)

diffs (206 lines):

diff -r 043d2be4bdc5 -r 4ffd0541f0b4 sys/arch/arm/arm32/cpuswitch.S
--- a/sys/arch/arm/arm32/cpuswitch.S    Wed Feb 26 02:03:40 2014 +0000
+++ b/sys/arch/arm/arm32/cpuswitch.S    Wed Feb 26 02:07:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuswitch.S,v 1.81 2013/12/26 18:49:23 joerg Exp $     */
+/*     $NetBSD: cpuswitch.S,v 1.82 2014/02/26 02:07:58 matt Exp $      */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
 #include <arm/asm.h>
 #include <arm/locore.h>
 
-       RCSID("$NetBSD: cpuswitch.S,v 1.81 2013/12/26 18:49:23 joerg Exp $")
+       RCSID("$NetBSD: cpuswitch.S,v 1.82 2014/02/26 02:07:58 matt Exp $")
 
 /* LINTSTUB: include <sys/param.h> */
        
@@ -116,8 +116,6 @@
 #endif
 
        .text
-.Lpmap_previous_active_lwp:
-       .word   _C_LABEL(pmap_previous_active_lwp)
 
 /*
  * struct lwp *
@@ -177,7 +175,7 @@
        IRQenable
 #endif
 
-       /* rem: r3 = curlwp */
+       /* rem: r3 = curcpu() */
        /* rem: r4 = old lwp */
        /* rem: r6 = new lwp */
        /* rem: r7 = new pcb */
@@ -192,7 +190,7 @@
        teq     r4, #0
        beq     .Ldo_switch
 
-       /* rem: r3 = curlwp */
+       /* rem: r3 = curcpu() */
        /* rem: r4 = old lwp */
        /* rem: r6 = new lwp */
        /* rem: r7 = new pcb */
@@ -225,7 +223,7 @@
         * them for the new process.
         */
 
-       /* rem: r3 = curlwp */
+       /* rem: r3 = curcpu() */
        /* rem: r4 = old lwp */
        /* rem: r5 = old pcb */
        /* rem: r6 = new lwp */
@@ -235,7 +233,7 @@
        /* Restore saved context */
 
 .Ldo_switch:
-       /* rem: r3 = curlwp */
+       /* rem: r3 = curcpu() */
        /* rem: r4 = old lwp */
        /* rem: r6 = new lwp */
        /* rem: r7 = new pcb */
@@ -281,8 +279,7 @@
 #endif
 
        /* Record the old lwp for pmap_activate()'s benefit */
-       ldr     r1, .Lpmap_previous_active_lwp          /* XXXSMP */
-       str     r4, [r1]
+       str     r4, [r3, #CI_LASTLWP]
 
        /* rem: r4 = old lwp */
        /* rem: r5 = new lwp's proc */
diff -r 043d2be4bdc5 -r 4ffd0541f0b4 sys/arch/arm/arm32/genassym.cf
--- a/sys/arch/arm/arm32/genassym.cf    Wed Feb 26 02:03:40 2014 +0000
+++ b/sys/arch/arm/arm32/genassym.cf    Wed Feb 26 02:07:58 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.66 2013/11/09 17:28:58 jmcneill Exp $
+#      $NetBSD: genassym.cf,v 1.67 2014/02/26 02:07:58 matt Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -213,6 +213,7 @@
 ifdef FPU_VFP
 define CI_VFP_ID               offsetof(struct cpu_info, ci_vfp_id)
 endif
+define CI_LASTLWP              offsetof(struct cpu_info, ci_lastlwp)
 
 define VFP_FPEXC_EN            VFP_FPEXC_EN
 
diff -r 043d2be4bdc5 -r 4ffd0541f0b4 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Wed Feb 26 02:03:40 2014 +0000
+++ b/sys/arch/arm/arm32/pmap.c Wed Feb 26 02:07:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.266 2014/02/26 01:51:11 matt Exp $  */
+/*     $NetBSD: pmap.c,v 1.267 2014/02/26 02:07:58 matt Exp $  */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -209,7 +209,7 @@
 #include <arm/locore.h>
 #include <arm/arm32/katelib.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.266 2014/02/26 01:51:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.267 2014/02/26 02:07:58 matt Exp $");
 
 #ifdef PMAP_DEBUG
 
@@ -259,18 +259,6 @@
 #endif
 
 /*
- * Which pmap is currently 'live' in the cache
- *
- * XXXSCW: Fix for SMP ...
- */
-static pmap_t pmap_recent_user;
-
-/*
- * Pointer to last active lwp, or NULL if it exited.
- */
-struct lwp *pmap_previous_active_lwp;
-
-/*
  * Pool and cache that pmap structures are allocated from.
  * We use a cache to avoid clearing the pm_l2[] array (1KB)
  * in pmap_create().
@@ -826,8 +814,9 @@
 pmap_is_cached(pmap_t pm)
 {
 
-       if (pm == pmap_kernel() || pmap_recent_user == NULL ||
-           pmap_recent_user == pm)
+       struct cpu_info * const ci = curcpu();
+       if (pm == pmap_kernel() || ci->ci_pmap_lastuser == NULL ||
+           ci->ci_pmap_lastuser == pm)
                return (true);
 
        return false;
@@ -4134,6 +4123,7 @@
 void
 pmap_activate(struct lwp *l)
 {
+       struct cpu_info * const ci = curcpu();
        extern int block_userspace_access;
        pmap_t opm, npm, rpm;
        uint32_t odacr, ndacr;
@@ -4155,8 +4145,8 @@
         * If TTB and DACR are unchanged, short-circuit all the
         * TLB/cache management stuff.
         */
-       if (pmap_previous_active_lwp != NULL) {
-               opm = pmap_previous_active_lwp->l_proc->p_vmspace->vm_map.pmap;
+       if (ci->ci_lastlwp != NULL) {
+               opm = ci->ci_lastlwp->l_proc->p_vmspace->vm_map.pmap;
                odacr = (DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) |
                    (DOMAIN_CLIENT << (pmap_domain(opm) * 2));
 
@@ -4174,7 +4164,7 @@
         * live in the cache, we must write-back and invalidate the
         * entire cache.
         */
-       rpm = pmap_recent_user;
+       rpm = ci->ci_pmap_lastuser;
 
 /*
  * XXXSCW: There's a corner case here which can leave turds in the cache as
@@ -4195,7 +4185,7 @@
        if (rpm) {
                rpm->pm_cstate.cs_cache = 0;
                if (npm == pmap_kernel())
-                       pmap_recent_user = NULL;
+                       ci->ci_pmap_lastuser = NULL;
 #ifdef PMAP_CACHE_VIVT
                cpu_idcache_wbinv_all();
 #endif
@@ -4250,7 +4240,7 @@
         */
        npm->pm_cstate.cs_all = PMAP_CACHE_STATE_ALL;
        if (npm != pmap_kernel())
-               pmap_recent_user = npm;
+               ci->ci_pmap_lastuser = npm;
 
        /* The old pmap is not longer active */
        if (opm != NULL)
@@ -4270,7 +4260,7 @@
         * otherwise skip. See PR port-arm/38950.
         */
        if (l->l_proc->p_sflag & PS_WEXIT)
-               pmap_previous_active_lwp = NULL;
+               curcpu()->ci_lastlwp = NULL;
 
        l->l_proc->p_vmspace->vm_map.pmap->pm_activated = false;
 }
@@ -4378,8 +4368,9 @@
 
        pmap_free_l1(pm);
 
-       if (pmap_recent_user == pm)
-               pmap_recent_user = NULL;
+       struct cpu_info * const ci = curcpu();
+       if (ci->ci_pmap_lastuser == pm)
+               ci->ci_pmap_lastuser = NULL;
 
        uvm_obj_destroy(&pm->pm_obj, false);
        mutex_destroy(&pm->pm_obj_lock);



Home | Main Index | Thread Index | Old Index