From owner-svn-src-all@FreeBSD.ORG Sat Mar 24 22:32:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D420106564A; Sat, 24 Mar 2012 22:32:20 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DBF88FC18; Sat, 24 Mar 2012 22:32:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2OMWJqi051664; Sat, 24 Mar 2012 22:32:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2OMWJIJ051662; Sat, 24 Mar 2012 22:32:19 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201203242232.q2OMWJIJ051662@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 24 Mar 2012 22:32:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233436 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2012 22:32:20 -0000 Author: nwhitehorn Date: Sat Mar 24 22:32:19 2012 New Revision: 233436 URL: http://svn.freebsd.org/changeset/base/233436 Log: Only call vm_page_dirty() on pages that are writable in order not to confuse the VM. Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Mar 24 21:10:19 2012 (r233435) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Mar 24 22:32:19 2012 (r233436) @@ -1889,6 +1889,7 @@ static void moea64_pvo_protect(mmu_t mmu, pmap_t pm, struct pvo_entry *pvo, vm_prot_t prot) { uintptr_t pt; + uint64_t oldlo; /* * Grab the PTE pointer before we diddle with the cached PTE @@ -1900,11 +1901,15 @@ moea64_pvo_protect(mmu_t mmu, pmap_t pm /* * Change the protection of the page. */ + oldlo = pvo->pvo_pte.lpte.pte_lo; pvo->pvo_pte.lpte.pte_lo &= ~LPTE_PP; - pvo->pvo_pte.lpte.pte_lo |= LPTE_BR; pvo->pvo_pte.lpte.pte_lo &= ~LPTE_NOEXEC; if ((prot & VM_PROT_EXECUTE) == 0) pvo->pvo_pte.lpte.pte_lo |= LPTE_NOEXEC; + if (prot & VM_PROT_WRITE) + pvo->pvo_pte.lpte.pte_lo |= LPTE_BW; + else + pvo->pvo_pte.lpte.pte_lo |= LPTE_BR; /* * If the PVO is in the page table, update that pte as well. @@ -1921,9 +1926,11 @@ moea64_pvo_protect(mmu_t mmu, pmap_t pm } /* - * Update vm about the REF/CHG bits if the page is managed. + * Update vm about the REF/CHG bits if the page is managed and we have + * removed write access. */ - if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED) { + if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED && + (oldlo & LPTE_PP) != LPTE_BR && !(prot && VM_PROT_WRITE)) { struct vm_page *pg; pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN); @@ -2345,7 +2352,8 @@ moea64_pvo_remove(mmu_t mmu, struct pvo_ /* * Update vm about the REF/CHG bits if the page is managed. */ - if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED) { + if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED && + (pvo->pvo_pte.lpte.pte_lo & LPTE_PP) != LPTE_BR) { struct vm_page *pg; pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN);