From nobody Wed Mar 15 15:49:16 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PcFF84SPcz3ygDk; Wed, 15 Mar 2023 15:49:16 +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 4PcFF83vnrz4ZNd; Wed, 15 Mar 2023 15:49:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678895356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ji551VYxhRlNEIZ7FnTJk8Y2AXl4HWFFzZfyyyuQJ3A=; b=nMyNP+zbwekd7YQ9ynEoE56676+ZPwmaFPXviTOd9P36cO+mr7umKDS02Es2uxditVGgit z4L1nEBJols6iIyIkUgioR1dPGxm8+JlIEe/kaUsvVYIPXAga/hGr9ZeiP1N7f9oX6g+kV FSwFzs80xUZwWM+fb4YPIZv7GUukCD+hgx5ONL/XTSeKLOLxG1wrCsE33Ge/dTBnOnurUp /UfP89HNlki54Mw5bB1y94Lz6LBnL1ka8cPbxfraSeSLeyXv7NS01nS8G4d7BJl6rZ0YNW Bhd8Lj9ml3z//3twTy47dkfK+fRCcBA+/dfxuWSXQxBwvkWnVJC56NgMVDM42A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678895356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ji551VYxhRlNEIZ7FnTJk8Y2AXl4HWFFzZfyyyuQJ3A=; b=OCngdb+Mm4UTM/QOVGGFoJw4zYE7duvOOLz+sy6iJCS2JIIz3CBQwQJCJSn96fJV9lsHoK ES4Uktdv34MvHuSF4D6D91ceMUZxUwfr2oNo6w5pjzM7+R0dwIM4z1ykT9BB6wvxdyf+EC SYpOFkKICj9/XrUGrtSem8S6PAHm9Hnh6WKChFnC5qy9tCarYMm0rPkWieay8/qpKXW3VJ B672WLXO75w3ZQ4+0PiBLjPec6ZufF6iJOS17BMjva92VIfT8RDPy741kIesTiV4bMMf2l ne85KgZZWE0oPjiqxC5jYuzb3oMX5LsPNqEy1hlHZoddaLqC3Cuy4u5fqhkJxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678895356; a=rsa-sha256; cv=none; b=oSJ4Xdu4zsDMMkINbwibicAUFrtJYcqwTEPsQaVqC/Pb0bFPuOMZ2QilPLekZm8Sg7QMAY s1xegsZl1686kXr8L3b8i0psnw9e5aYc+m7HKpfDoN/PuF6I44tAMQJ/MTclY6+Qh/yXPB gPP7mo4mVd907aORbA/kZWni3z/SpHq2wQSni66tOKr8lnAOVR9Ef09cjFjvwr/4/Mxpiu aePtSL18uoOzqxt7skDhCR9rAE2pqVckl6f7DOpe/QaKkBsivU+orCd3UTAzTdLPuPS9px ribGvDfglLH2UpyIbXC+tiPPGtDrsqZ1MqXYBrhYhXmNLRbLr5hAj+dF9FpGMA== 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 4PcFF82zs8z1MTc; Wed, 15 Mar 2023 15:49:16 +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 32FFnGlC058774; Wed, 15 Mar 2023 15:49:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32FFnGbU058773; Wed, 15 Mar 2023 15:49:16 GMT (envelope-from git) Date: Wed, 15 Mar 2023 15:49:16 GMT Message-Id: <202303151549.32FFnGbU058773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 51308cd29b3b - main - Support the arm64 pmap_remove_write for stage 2 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51308cd29b3b21cbee3e841a6f44c58987647dbb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=51308cd29b3b21cbee3e841a6f44c58987647dbb commit 51308cd29b3b21cbee3e841a6f44c58987647dbb Author: Andrew Turner AuthorDate: 2022-11-15 17:49:42 +0000 Commit: Andrew Turner CommitDate: 2023-03-15 15:49:00 +0000 Support the arm64 pmap_remove_write for stage 2 The fields we need to adjust are different in stage 1 and stage 2 tables. Handle this by adding variables to hold the bits to check, set, and clear. Reviewed by: alc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37399 --- sys/arm64/arm64/pmap.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index a272bf5756ae..2ea007418c9d 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5804,7 +5804,7 @@ pmap_remove_write(vm_page_t m) pmap_t pmap; struct rwlock *lock; pv_entry_t next_pv, pv; - pt_entry_t oldpte, *pte; + pt_entry_t oldpte, *pte, set, clear, mask, val; vm_offset_t va; int md_gen, pvh_gen; @@ -5842,7 +5842,6 @@ retry: } TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); - PMAP_ASSERT_STAGE1(pmap); if (!PMAP_TRYLOCK(pmap)) { pvh_gen = pvh->pv_gen; md_gen = m->md.pv_gen; @@ -5858,13 +5857,25 @@ retry: pte = pmap_pte_exists(pmap, pv->pv_va, 3, __func__); oldpte = pmap_load(pte); if ((oldpte & ATTR_SW_DBM) != 0) { + if (pmap->pm_stage == PM_STAGE1) { + set = ATTR_S1_AP_RW_BIT; + clear = 0; + mask = ATTR_S1_AP_RW_BIT; + val = ATTR_S1_AP(ATTR_S1_AP_RW); + } else { + set = 0; + clear = ATTR_S2_S2AP(ATTR_S2_S2AP_WRITE); + mask = ATTR_S2_S2AP(ATTR_S2_S2AP_WRITE); + val = ATTR_S2_S2AP(ATTR_S2_S2AP_WRITE); + } + clear |= ATTR_SW_DBM; while (!atomic_fcmpset_64(pte, &oldpte, - (oldpte | ATTR_S1_AP_RW_BIT) & ~ATTR_SW_DBM)) + (oldpte | set) & ~clear)) cpu_spinwait(); - if ((oldpte & ATTR_S1_AP_RW_BIT) == - ATTR_S1_AP(ATTR_S1_AP_RW)) + + if ((oldpte & mask) == val) vm_page_dirty(m); - pmap_s1_invalidate_page(pmap, pv->pv_va, true); + pmap_invalidate_page(pmap, pv->pv_va, true); } PMAP_UNLOCK(pmap); }