Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Mar 2012 22:32:19 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233436 - head/sys/powerpc/aim
Message-ID:  <201203242232.q2OMWJIJ051662@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203242232.q2OMWJIJ051662>