From owner-svn-src-head@FreeBSD.ORG Thu Jan 15 22:31:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 733FA1065672; Thu, 15 Jan 2009 22:31:55 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 3A84A8FC1C; Thu, 15 Jan 2009 22:31:55 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id D0C1E2C2AAC; Thu, 15 Jan 2009 16:31:54 -0600 (CST) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2nE38bTT8lLM; Thu, 15 Jan 2009 16:31:47 -0600 (CST) Received: from [10.195.94.71] (unknown [10.195.94.71]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 03B532C2A81; Thu, 15 Jan 2009 16:31:46 -0600 (CST) Message-ID: <496FB94A.6070308@cs.rice.edu> Date: Thu, 15 Jan 2009 16:31:38 -0600 From: Alan Cox User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Oleksandr Tymoshenko References: <200901151831.n0FIVaJv083960@svn.freebsd.org> In-Reply-To: <200901151831.n0FIVaJv083960@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187301 - in head/sys/mips: include mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 22:31:56 -0000 You should not be reintroducing pmap_track_modified(). See revision 1.2 of this file. Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Thu Jan 15 18:31:36 2009 > New Revision: 187301 > URL: http://svn.freebsd.org/changeset/base/187301 > > Log: > MFp4: > > - Add debug output > - Fix pmap_zero_page and related places: use uncached segments and invalidate > cache after zeroing memory. > - Do not test for modified bit if it's not neccessary > (merged from mips-juniper p4 branch) > - Some #includes reorganization > > Modified: > head/sys/mips/include/pmap.h > head/sys/mips/mips/pmap.c > > Modified: head/sys/mips/include/pmap.h > ============================================================================== > --- head/sys/mips/include/pmap.h Thu Jan 15 17:15:03 2009 (r187300) > +++ head/sys/mips/include/pmap.h Thu Jan 15 18:31:36 2009 (r187301) > @@ -1,4 +1,4 @@ > -/* > +/*- > * Copyright (c) 1991 Regents of the University of California. > * All rights reserved. > * > @@ -47,10 +47,8 @@ > #define _MACHINE_PMAP_H_ > > #include > +#include > > -/* > - * Pte related macros > - */ > #define VADDR(pdi, pti) ((vm_offset_t)(((pdi)< > #define NKPT 120 /* actual number of kernel page tables */ > @@ -65,11 +63,9 @@ > #ifndef LOCORE > > #include > -#include > #include > #include > > - > /* > * Pmap stuff > */ > @@ -104,10 +100,7 @@ struct pmap { > > typedef struct pmap *pmap_t; > > -#ifdef _KERNEL > -#include > -#include > -#include > +#ifdef _KERNEL > > pt_entry_t *pmap_pte(pmap_t, vm_offset_t); > pd_entry_t pmap_segmap(pmap_t pmap, vm_offset_t va); > @@ -132,8 +125,6 @@ extern pmap_t kernel_pmap; > #define PMAP_LGMEM_UNLOCK(sysmap) mtx_unlock(&(sysmap)->lock) > #define PMAP_LGMEM_DESTROY(sysmap) mtx_destroy(&(sysmap)->lock) > > -#endif /* _KERNEL */ > - > /* > * 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. > @@ -148,8 +139,6 @@ typedef struct pv_entry { > } *pv_entry_t; > > > -#ifdef _KERNEL > - > #if defined(DIAGNOSTIC) > #define PMAP_DIAGNOSTIC > #endif > @@ -182,7 +171,6 @@ vm_offset_t pmap_steal_memory(vm_size_t > void pmap_set_modified(vm_offset_t pa); > int page_is_managed(vm_offset_t pa); > void pmap_page_is_free(vm_page_t m); > -void pmap_kushmem_reattach(struct proc *); > /* PMAP_INLINE */ void pmap_kenter(vm_offset_t va, vm_paddr_t pa); > /* PMAP_INLINE */ void pmap_kremove(vm_offset_t va); > void *pmap_kenter_temporary(vm_paddr_t pa, int i); > > Modified: head/sys/mips/mips/pmap.c > ============================================================================== > --- head/sys/mips/mips/pmap.c Thu Jan 15 17:15:03 2009 (r187300) > +++ head/sys/mips/mips/pmap.c Thu Jan 15 18:31:36 2009 (r187301) > @@ -103,6 +103,8 @@ __FBSDID("$FreeBSD$"); > #define PMAP_DIAGNOSTIC > #endif > > +#undef PMAP_DEBUG > + > #ifndef PMAP_SHPGPERPROC > #define PMAP_SHPGPERPROC 200 > #endif > @@ -489,6 +491,24 @@ pmap_nw_modified(pt_entry_t pte) > #endif > > > +/* > + * this routine defines the region(s) of memory that should > + * not be tested for the modified bit. > + */ > +static PMAP_INLINE int > +pmap_track_modified(vm_offset_t va) > +{ > + /* > + * Kernel submap initialization has been moved for MD to MI code. ie > + * from cpu_startup() to vm_ksubmap_init(). clean_sva and clean_eva > + * are part of the kmi structure. > + */ > + if ((va < kmi.clean_sva) || (va >= kmi.clean_eva)) > + return (1); > + else > + return (0); > +} > + > static void > pmap_invalidate_all(pmap_t pmap) > { > @@ -672,6 +692,9 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p > register pt_entry_t *pte; > pt_entry_t npte, opte; > > +#ifdef PMAP_DEBUG > + printf("pmap_kenter: va: 0x%08x -> pa: 0x%08x\n", va, pa); > +#endif > npte = mips_paddr_to_tlbpfn(pa) | PTE_RW | PTE_V | PTE_G | PTE_W; > > if (is_cacheable_mem(pa)) > @@ -1421,7 +1444,8 @@ pmap_remove_pte(struct pmap *pmap, pt_en > va, oldpte); > } > #endif > - vm_page_dirty(m); > + if (pmap_track_modified(va)) > + vm_page_dirty(m); > } > if (m->md.pv_flags & PV_TABLE_REF) > vm_page_flag_set(m, PG_REFERENCED); > @@ -1778,6 +1802,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, > validate: > rw = init_pte_prot(va, m, prot); > > +#ifdef PMAP_DEBUG > + printf("pmap_enter: va: 0x%08x -> pa: 0x%08x\n", va, pa); > +#endif > /* > * Now validate mapping with desired protection/wiring. > */ > @@ -2147,9 +2174,10 @@ pmap_zero_page(vm_page_t m) > #endif > if (phys < MIPS_KSEG0_LARGEST_PHYS) { > > - va = MIPS_PHYS_TO_CACHED(phys); > + va = MIPS_PHYS_TO_UNCACHED(phys); > > bzero((caddr_t)va, PAGE_SIZE); > + mips_dcache_wbinv_range(va, PAGE_SIZE); > } else { > int cpu; > struct local_sysmaps *sysm; > @@ -2202,8 +2230,9 @@ pmap_zero_page_area(vm_page_t m, int off > } else > #endif > if (phys < MIPS_KSEG0_LARGEST_PHYS) { > - va = MIPS_PHYS_TO_CACHED(phys); > + va = MIPS_PHYS_TO_UNCACHED(phys); > bzero((char *)(caddr_t)va + off, size); > + mips_dcache_wbinv_range(va + off, size); > } else { > int cpu; > struct local_sysmaps *sysm; > @@ -2240,8 +2269,9 @@ pmap_zero_page_idle(vm_page_t m) > } else > #endif > if (phys < MIPS_KSEG0_LARGEST_PHYS) { > - va = MIPS_PHYS_TO_CACHED(phys); > + va = MIPS_PHYS_TO_UNCACHED(phys); > bzero((caddr_t)va, PAGE_SIZE); > + mips_dcache_wbinv_range(va, PAGE_SIZE); > } else { > int cpu; > struct local_sysmaps *sysm; >