git: 09947faee84b - main - Apply r350335(5d18382b728) to powerpc64 radix pmap

Justin Hibbits jhibbits at FreeBSD.org
Sat May 29 20:15:04 UTC 2021


The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=09947faee84b84f8126fd9dcf30ea8fd9a0cae92

commit 09947faee84b84f8126fd9dcf30ea8fd9a0cae92
Author:     Justin Hibbits <jhibbits at FreeBSD.org>
AuthorDate: 2021-05-09 16:07:28 +0000
Commit:     Justin Hibbits <jhibbits at FreeBSD.org>
CommitDate: 2021-05-29 20:14:32 +0000

    Apply r350335(5d18382b728) to powerpc64 radix pmap
    
    Simplify pmap_clear_modify() a bit, by assuming that since the superpage
    demotion succeeded, all 4k mappings from it are valid.  Deindent the
    surrounding code, as there are no 'else' branches in the code anyway.
---
 sys/powerpc/aim/mmu_radix.c | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c
index 8f38b57e7852..e86bfa94c7ae 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -2433,28 +2433,24 @@ restart:
 		va = pv->pv_va;
 		l3e = pmap_pml3e(pmap, va);
 		oldl3e = be64toh(*l3e);
-		if ((oldl3e & PG_RW) != 0) {
-			if (pmap_demote_l3e_locked(pmap, l3e, va, &lock)) {
-				if ((oldl3e & PG_W) == 0) {
-					/*
-					 * Write protect the mapping to a
-					 * single page so that a subsequent
-					 * write access may repromote.
-					 */
-					va += VM_PAGE_TO_PHYS(m) - (oldl3e &
-					    PG_PS_FRAME);
-					pte = pmap_l3e_to_pte(l3e, va);
-					oldpte = be64toh(*pte);
-					if ((oldpte & PG_V) != 0) {
-						while (!atomic_cmpset_long(pte,
-						    htobe64(oldpte),
-							htobe64((oldpte | RPTE_EAA_R) & ~(PG_M | PG_RW))))
-							   oldpte = be64toh(*pte);
-						vm_page_dirty(m);
-						pmap_invalidate_page(pmap, va);
-					}
-				}
-			}
+		if ((oldl3e & PG_RW) != 0 &&
+		    pmap_demote_l3e_locked(pmap, l3e, va, &lock) &&
+		    (oldl3e & PG_W) == 0) {
+			/*
+			 * Write protect the mapping to a
+			 * single page so that a subsequent
+			 * write access may repromote.
+			 */
+			va += VM_PAGE_TO_PHYS(m) - (oldl3e &
+			    PG_PS_FRAME);
+			pte = pmap_l3e_to_pte(l3e, va);
+			oldpte = be64toh(*pte);
+			while (!atomic_cmpset_long(pte,
+			    htobe64(oldpte),
+				htobe64((oldpte | RPTE_EAA_R) & ~(PG_M | PG_RW))))
+				   oldpte = be64toh(*pte);
+			vm_page_dirty(m);
+			pmap_invalidate_page(pmap, va);
 		}
 		PMAP_UNLOCK(pmap);
 	}


More information about the dev-commits-src-main mailing list