Module Name: src Committed By: matt Date: Wed Feb 26 02:07:58 UTC 2014
Modified Files: src/sys/arch/arm/arm32: cpuswitch.S genassym.cf pmap.c Log Message: Move pmap_recent_user to ci->ci_pmap_lastuser and pmap_previous_active_lwp to ci->ci_lastlwp. Fix some comments. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/arch/arm/arm32/cpuswitch.S cvs rdiff -u -r1.66 -r1.67 src/sys/arch/arm/arm32/genassym.cf cvs rdiff -u -r1.266 -r1.267 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/arm32/cpuswitch.S diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.81 src/sys/arch/arm/arm32/cpuswitch.S:1.82 --- src/sys/arch/arm/arm32/cpuswitch.S:1.81 Thu Dec 26 18:49:23 2013 +++ src/sys/arch/arm/arm32/cpuswitch.S Wed Feb 26 02:07:58 2014 @@ -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 @@ ENTRY(cpu_switchto) IRQenable #endif - /* rem: r3 = curlwp */ + /* rem: r3 = curcpu() */ /* rem: r4 = old lwp */ /* rem: r6 = new lwp */ /* rem: r7 = new pcb */ @@ -192,7 +190,7 @@ ENTRY(cpu_switchto) 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 @@ ENTRY(cpu_switchto) * 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 @@ ENTRY(cpu_switchto) /* 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 @@ ENTRY(cpu_switchto) #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 */ Index: src/sys/arch/arm/arm32/genassym.cf diff -u src/sys/arch/arm/arm32/genassym.cf:1.66 src/sys/arch/arm/arm32/genassym.cf:1.67 --- src/sys/arch/arm/arm32/genassym.cf:1.66 Sat Nov 9 17:28:58 2013 +++ src/sys/arch/arm/arm32/genassym.cf Wed Feb 26 02:07:58 2014 @@ -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 @@ define CI_CC_NSOFT offsetof(struct cpu_ 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 Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.266 src/sys/arch/arm/arm32/pmap.c:1.267 --- src/sys/arch/arm/arm32/pmap.c:1.266 Wed Feb 26 01:51:11 2014 +++ src/sys/arch/arm/arm32/pmap.c Wed Feb 26 02:07:58 2014 @@ -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 @@ int arm_poolpage_vmfreelist = VM_FREEL #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 @@ static inline bool 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 @@ pmap_unwire(pmap_t pm, vaddr_t va) 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 @@ pmap_activate(struct lwp *l) * 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 @@ pmap_activate(struct lwp *l) * 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 @@ pmap_activate(struct lwp *l) 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 @@ pmap_activate(struct lwp *l) */ 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 @@ pmap_deactivate(struct lwp *l) * 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_destroy(pmap_t pm) 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);