Date: Thu, 3 Oct 2013 18:58:35 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256029 - projects/bhyve_npt_pmap/sys/amd64/amd64 Message-ID: <201310031858.r93IwZTK057807@svn.freebsd.org>
index | next in thread | raw e-mail
Author: neel Date: Thu Oct 3 18:58:35 2013 New Revision: 256029 URL: http://svnweb.freebsd.org/changeset/base/256029 Log: Delay the initialization of the PG_xx bits until the point that it is actually needed. The PG_M bit can be set gratuitously for all unmanaged, writeable mappings regardless of the pmap type. Verify that the 'dst_pmap' and 'src_pmap' are of the same type in pmap_copy(). Pointed out by: alc@ Modified: projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c Modified: projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c ============================================================================== --- projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c Thu Oct 3 18:53:13 2013 (r256028) +++ projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c Thu Oct 3 18:58:35 2013 (r256029) @@ -3836,11 +3836,6 @@ pmap_protect(pmap_t pmap, vm_offset_t sv pt_entry_t *pte, PG_G, PG_M, PG_RW, PG_V; boolean_t anychanged, pv_lists_locked; - PG_G = pmap_global_bit(pmap); - PG_M = pmap_modified_bit(pmap); - PG_V = pmap_valid_bit(pmap); - PG_RW = pmap_rw_bit(pmap); - if ((prot & VM_PROT_READ) == VM_PROT_NONE) { pmap_remove(pmap, sva, eva); return; @@ -3850,6 +3845,10 @@ pmap_protect(pmap_t pmap, vm_offset_t sv (VM_PROT_WRITE|VM_PROT_EXECUTE)) return; + PG_G = pmap_global_bit(pmap); + PG_M = pmap_modified_bit(pmap); + PG_V = pmap_valid_bit(pmap); + PG_RW = pmap_rw_bit(pmap); pv_lists_locked = FALSE; resume: anychanged = FALSE; @@ -4154,16 +4153,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, newpte |= PG_G; newpte |= pmap_cache_bits(pmap, m->md.pat_mode, 0); - if (pmap_emulate_ad_bits(pmap)) { - /* - * Set modified bit gratuitously for writeable mappings if - * the page is unmanaged. We do not want to take a fault - * to do the dirty bit accounting for these mappings. - */ - if ((m->oflags & VPO_UNMANAGED) != 0) { - if ((newpte & PG_RW) != 0) - newpte |= PG_M; - } + /* + * Set modified bit gratuitously for writeable mappings if + * the page is unmanaged. We do not want to take a fault + * to do the dirty bit accounting for these mappings. + */ + if ((m->oflags & VPO_UNMANAGED) != 0) { + if ((newpte & PG_RW) != 0) + newpte |= PG_M; } mpte = NULL; @@ -4762,6 +4759,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm if (dst_addr != src_addr) return; + if (dst_pmap->pm_type != src_pmap->pm_type) + return; + if (pmap_emulate_ad_bits(dst_pmap)) return;help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310031858.r93IwZTK057807>
