From owner-dev-commits-src-all@freebsd.org Thu Jun 24 03:37:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7D12365CC20; Thu, 24 Jun 2021 03:37:59 +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 4G9Qng2qBVz5023; Thu, 24 Jun 2021 03:37:59 +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 4901D10BB0; Thu, 24 Jun 2021 03:37:59 +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 15O3bxO0055314; Thu, 24 Jun 2021 03:37:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15O3bxZN055313; Thu, 24 Jun 2021 03:37:59 GMT (envelope-from git) Date: Thu, 24 Jun 2021 03:37:59 GMT Message-Id: <202106240337.15O3bxZN055313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 0c188c06c627 - main - arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c188c06c627b5de30eeeeb7cde00d071a80ecfa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2021 03:37:59 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=0c188c06c627b5de30eeeeb7cde00d071a80ecfa commit 0c188c06c627b5de30eeeeb7cde00d071a80ecfa Author: Alan Cox AuthorDate: 2021-06-23 19:14:31 +0000 Commit: Alan Cox CommitDate: 2021-06-24 03:35:46 +0000 arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2() Revise pmap_remove_l2() to use the constant-time function page_to_pvh() instead of the linear-time function pa_to_pvh(). Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30876 --- sys/arm64/arm64/pmap.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 7def96bca70b..bc3d4fd6446b 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -2834,8 +2834,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, { struct md_page *pvh; pt_entry_t old_l2; - vm_offset_t eva, va; - vm_page_t m, ml3; + vm_page_t m, ml3, mt; PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT((sva & L2_OFFSET) == 0, ("pmap_remove_l2: sva is not aligned")); @@ -2853,19 +2852,18 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, pmap->pm_stats.wired_count -= L2_SIZE / PAGE_SIZE; pmap_resident_count_dec(pmap, L2_SIZE / PAGE_SIZE); if (old_l2 & ATTR_SW_MANAGED) { + m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); + pvh = page_to_pvh(m); CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, old_l2 & ~ATTR_MASK); - pvh = pa_to_pvh(old_l2 & ~ATTR_MASK); pmap_pvh_free(pvh, pmap, sva); - eva = sva + L2_SIZE; - for (va = sva, m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); - va < eva; va += PAGE_SIZE, m++) { + for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) { if (pmap_pte_dirty(pmap, old_l2)) - vm_page_dirty(m); + vm_page_dirty(mt); if (old_l2 & ATTR_AF) - vm_page_aflag_set(m, PGA_REFERENCED); - if (TAILQ_EMPTY(&m->md.pv_list) && + vm_page_aflag_set(mt, PGA_REFERENCED); + if (TAILQ_EMPTY(&mt->md.pv_list) && TAILQ_EMPTY(&pvh->pv_list)) - vm_page_aflag_clear(m, PGA_WRITEABLE); + vm_page_aflag_clear(mt, PGA_WRITEABLE); } } if (pmap == kernel_pmap) {