From owner-svn-src-user@FreeBSD.ORG Fri Apr 23 23:09:18 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B53F106566B; Fri, 23 Apr 2010 23:09:18 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FDFE8FC08; Fri, 23 Apr 2010 23:09:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NN9IwF042195; Fri, 23 Apr 2010 23:09:18 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NN9IU8042191; Fri, 23 Apr 2010 23:09:18 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004232309.o3NN9IU8042191@svn.freebsd.org> From: Juli Mallett Date: Fri, 23 Apr 2010 23:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207136 - in user/jmallett/octeon/sys/mips: include mips X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2010 23:09:18 -0000 Author: jmallett Date: Fri Apr 23 23:09:18 2010 New Revision: 207136 URL: http://svn.freebsd.org/changeset/base/207136 Log: o) Insert nops after disabling interrupts to avoid getting interrupted. o) When changing wiring, in addition to maybe setting PG_W, maybe clear it. o) Get rid of lmem locks, since this is all CPU local now, and remove pinning and simply disable interrupts. o) Likewise, don't possibly cause an IPI for lmem, since interrupts are disabled at that point. Besides, they operate on inherently per-CPU VAs. Modified: user/jmallett/octeon/sys/mips/include/pmap.h user/jmallett/octeon/sys/mips/mips/exception.S user/jmallett/octeon/sys/mips/mips/pmap.c Modified: user/jmallett/octeon/sys/mips/include/pmap.h ============================================================================== --- user/jmallett/octeon/sys/mips/include/pmap.h Fri Apr 23 22:42:49 2010 (r207135) +++ user/jmallett/octeon/sys/mips/include/pmap.h Fri Apr 23 23:09:18 2010 (r207136) @@ -112,12 +112,6 @@ extern struct pmap kernel_pmap_store; #define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) #define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) -#define PMAP_LGMEM_LOCK_INIT(sysmap) mtx_init(&(sysmap)->lock, "pmap-lgmem", \ - "per-cpu-map", (MTX_DEF| MTX_DUPOK)) -#define PMAP_LGMEM_LOCK(sysmap) mtx_lock(&(sysmap)->lock) -#define PMAP_LGMEM_UNLOCK(sysmap) mtx_unlock(&(sysmap)->lock) -#define PMAP_LGMEM_DESTROY(sysmap) mtx_destroy(&(sysmap)->lock) - /* * For each vm_page_t, there is a list of all currently valid virtual * mappings of that page. An entry is a pv_entry_t, the list is pv_table. Modified: user/jmallett/octeon/sys/mips/mips/exception.S ============================================================================== --- user/jmallett/octeon/sys/mips/mips/exception.S Fri Apr 23 22:42:49 2010 (r207135) +++ user/jmallett/octeon/sys/mips/mips/exception.S Fri Apr 23 23:09:18 2010 (r207136) @@ -241,13 +241,15 @@ SlowFault: or a0, a0, a2 ; \ li a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER) ; \ and a0, a0, a2 ; \ - mtc0 a0, COP_0_STATUS_REG + mtc0 a0, COP_0_STATUS_REG ; \ + ITLBNOPFIX #else #define CLEAR_STATUS \ mfc0 a0, COP_0_STATUS_REG ;\ li a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER) ; \ and a0, a0, a2 ; \ - mtc0 a0, COP_0_STATUS_REG + mtc0 a0, COP_0_STATUS_REG ; \ + ITLBNOPFIX #endif /* Modified: user/jmallett/octeon/sys/mips/mips/pmap.c ============================================================================== --- user/jmallett/octeon/sys/mips/mips/pmap.c Fri Apr 23 22:42:49 2010 (r207135) +++ user/jmallett/octeon/sys/mips/mips/pmap.c Fri Apr 23 23:09:18 2010 (r207136) @@ -198,7 +198,6 @@ static void pmap_update_page_action(void #if !defined(__mips_n64) struct local_sysmaps { - struct mtx lock; vm_offset_t base; uint16_t valid1, valid2; }; @@ -218,28 +217,24 @@ caddr_t virtual_sys_start = (caddr_t)0; struct local_sysmaps *sysm; \ pt_entry_t *pte, npte; \ \ + intr = intr_disable(); \ cpu = PCPU_GET(cpuid); \ sysm = &sysmap_lmem[cpu]; \ - PMAP_LGMEM_LOCK(sysm); \ - intr = intr_disable(); \ - sched_pin(); \ va = sysm->base; \ npte = TLBLO_PA_TO_PFN(phys) | \ PG_D | PG_V | PG_G | PG_W | PG_C_CNC; \ pte = pmap_pte(kernel_pmap, va); \ *pte = npte; \ - sysm->valid1 = 1; + sysm->valid1 = 1 #define PMAP_LMEM_MAP2(va1, phys1, va2, phys2) \ int cpu; \ struct local_sysmaps *sysm; \ pt_entry_t *pte, npte; \ \ + intr = intr_disable(); \ cpu = PCPU_GET(cpuid); \ sysm = &sysmap_lmem[cpu]; \ - PMAP_LGMEM_LOCK(sysm); \ - intr = intr_disable(); \ - sched_pin(); \ va1 = sysm->base; \ va2 = sysm->base + PAGE_SIZE; \ npte = TLBLO_PA_TO_PFN(phys2) | \ @@ -251,20 +246,18 @@ caddr_t virtual_sys_start = (caddr_t)0; pte = pmap_pte(kernel_pmap, va2); \ *pte = npte; \ sysm->valid1 = 1; \ - sysm->valid2 = 1; + sysm->valid2 = 1 #define PMAP_LMEM_UNMAP() \ pte = pmap_pte(kernel_pmap, sysm->base); \ *pte = PG_G; \ - pmap_invalidate_page(kernel_pmap, sysm->base); \ + tlb_invalidate_address(kernel_pmap, sysm->base); \ sysm->valid1 = 0; \ pte = pmap_pte(kernel_pmap, sysm->base + PAGE_SIZE); \ *pte = PG_G; \ - pmap_invalidate_page(kernel_pmap, sysm->base + PAGE_SIZE); \ + tlb_invalidate_address(kernel_pmap, sysm->base + PAGE_SIZE); \ sysm->valid2 = 0; \ - sched_unpin(); \ - intr_restore(intr); \ - PMAP_LGMEM_UNLOCK(sysm); + intr_restore(intr) #endif @@ -451,7 +444,6 @@ again: sysmap_lmem[i].base = virtual_avail; virtual_avail += PAGE_SIZE * 2; sysmap_lmem[i].valid1 = sysmap_lmem[i].valid2 = 0; - PMAP_LGMEM_LOCK_INIT(&sysmap_lmem[i]); } } virtual_sys_start = (caddr_t)virtual_avail; @@ -2181,6 +2173,8 @@ pmap_change_wiring(pmap_t pmap, vm_offse */ if (wired) pte_set(pte, PG_W); + else + pte_clear(pte, PG_W); PMAP_UNLOCK(pmap); }