From owner-dev-commits-src-all@freebsd.org Mon Jun 14 20:25:32 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 8A85165033C; Mon, 14 Jun 2021 20:25:32 +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 4G3jcq6drzz4kkC; Mon, 14 Jun 2021 20:25:31 +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 7D2211AFB3; Mon, 14 Jun 2021 20:25:31 +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 15EKPV1q073365; Mon, 14 Jun 2021 20:25:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15EKPVgP073364; Mon, 14 Jun 2021 20:25:31 GMT (envelope-from git) Date: Mon, 14 Jun 2021 20:25:31 GMT Message-Id: <202106142025.15EKPVgP073364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fa3cfd1a845a - stable/13 - arm64: Fix pmap_copy()'s handling of 2MB mappings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa3cfd1a845a33dbee88fcd80599c3ecc3268e26 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: Mon, 14 Jun 2021 20:25:33 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fa3cfd1a845a33dbee88fcd80599c3ecc3268e26 commit fa3cfd1a845a33dbee88fcd80599c3ecc3268e26 Author: Mark Johnston AuthorDate: 2021-06-06 20:40:45 +0000 Commit: Mark Johnston CommitDate: 2021-06-14 20:25:15 +0000 arm64: Fix pmap_copy()'s handling of 2MB mappings When copying mappings from parent to child, we clear the accessed and dirty bits. This is done for both 4KB and 2MB PTEs. However, pmap_demote_l2() asserts that writable superpages must be dirty. This is to avoid races with the MMU setting the dirty bit during promotion and demotion. pmap_copy() can create clean, writable superpage mappings, so it violates this assertion. Modify pmap_copy() to preserve the accessed and dirty bits when copying 2MB mappings, like we do on amd64. Fixes: ca2cae0b4dd Reported by: Jenkins via mhorne Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30643 (cherry picked from commit 4e4035ef1fb5e2f9da6b658ffae8a54862b4d018) --- sys/arm64/arm64/pmap.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index b49ec4194e19..e9dd27981d61 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4751,11 +4751,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, ((srcptepaddr & ATTR_SW_MANAGED) == 0 || pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - mask = ATTR_AF | ATTR_SW_WIRED; - nbits = 0; - if ((srcptepaddr & ATTR_SW_DBM) != 0) - nbits |= ATTR_S1_AP_RW_BIT; - pmap_store(l2, (srcptepaddr & ~mask) | nbits); + mask = ATTR_SW_WIRED; + pmap_store(l2, srcptepaddr & ~mask); pmap_resident_count_inc(dst_pmap, L2_SIZE / PAGE_SIZE); atomic_add_long(&pmap_l2_mappings, 1);