From owner-dev-commits-src-main@freebsd.org Sat May 29 20:15:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62898647019; Sat, 29 May 2021 20:15:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fst88246gz4YDF; Sat, 29 May 2021 20:15:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2ADB310A89; Sat, 29 May 2021 20:15:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14TKF4V8080509; Sat, 29 May 2021 20:15:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TKF4Tu080508; Sat, 29 May 2021 20:15:04 GMT (envelope-from git) Date: Sat, 29 May 2021 20:15:04 GMT Message-Id: <202105292015.14TKF4Tu080508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 09947faee84b - main - Apply r350335(5d18382b728) to powerpc64 radix pmap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09947faee84b84f8126fd9dcf30ea8fd9a0cae92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 May 2021 20:15:04 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=09947faee84b84f8126fd9dcf30ea8fd9a0cae92 commit 09947faee84b84f8126fd9dcf30ea8fd9a0cae92 Author: Justin Hibbits AuthorDate: 2021-05-09 16:07:28 +0000 Commit: Justin Hibbits 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); }