From nobody Thu Nov 02 18:47:45 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 4SLtD12C3Jz503nN; Thu, 2 Nov 2023 18:47:45 +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 4SLtD11kSVz3Wnl; Thu, 2 Nov 2023 18:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698950865; 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=LZY7irm36bn52JRM5Qn/Ts4/jK+sIo/Z2eULztnQfn8=; b=v8fXk7WIraKtR0PcMQB7lOoh/JPAf3BOfZ50XnK+Yizfj2OSrhvGnxKaNxHy5QNt2rUr0u 3W/4OtLTOlm7srDdscuOiLImFGwsNifg36YdDftcgi83BWDNSrGj6wyL9fsPDZuCrHspn3 vWF1SAfQkxrREyocEOhgabEAp2LfUDuV4xoDSu4QXVZd0TWD7jsKafzB3kgi4nQOmBy3KT WR+daqlq+afN6SIZFzohLV7ngJvWzfFjcouFARY74+zlG+kEfqDBxzQp4JRTs/PU3DFfdu zJDDG789cXC9HfMFkgHUb0Dn8B/KnvNIICkBpb0rcmc/FCG/ZemLwyZRvh+hnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698950865; 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=LZY7irm36bn52JRM5Qn/Ts4/jK+sIo/Z2eULztnQfn8=; b=Ol2LZHd1iuThoGVi3lQ8oR3En1/U52Zk2GlWoQlpTodQMqP5TJ4FwR4y3IN9YF1Y1ig/so rCbF7B8mRYXEKBZGHXxXuhGUEkLK7HrnMK2wbxsGaBsPvISyiJg4I1t9NmCpviqO8/Ns6q 5jLeKoFXBWiH+ulwI0FIu7/osXEIgRUZyem2J+LPUqHnCeHd96PzCnVNaey+hcG8LnpoO8 gXOquQK2dXVYq8T3KkOU88uG7ZL/RMvtAq7Z4iFxB8GWbarW1LFk5bA2BpNGdgQTVwTCmR RZ+9GSP08Ue7JL24GexVC36Be5IAHJhxIDAq0pBw8AxVeqgsm9u1gIw8SS2GrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698950865; a=rsa-sha256; cv=none; b=GTHhqyPuQuzcZDoVGuWXhFslzb4m6U43XxowIYCUBygOx+nNtIxKjivyZQvi0XiVdHKG2c Mr7WCgDlQC/NwnHg+wj99WKXLgkUjx3TsMTaOXLuDXQfqtGejX1Ins5WwvhkRJYgcu+nUy oi1i6OuEx1b2Yw3ANRExXP1Ee8+swPfafU89LCJ9UDumINIfVZx9qKdY+Pn5PLvlWv5uKx kNwMqT8CuXTRCYbkGhH6uIpuzoQZ5VtUDZdYBto5VVbJKw1wdtsRNKe2sMB3pkZbbV0/vH MQFX16Dca5WdSskdZyrFZGuHYsX8kpY96OCJFCpxcOSv0RQ25bsFdIFTDimpKg== 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 4SLtD10nTFzgh9; Thu, 2 Nov 2023 18:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A2IljuW044709; Thu, 2 Nov 2023 18:47:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A2IljII044706; Thu, 2 Nov 2023 18:47:45 GMT (envelope-from git) Date: Thu, 2 Nov 2023 18:47:45 GMT Message-Id: <202311021847.3A2IljII044706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3c4f46b0d57b - main - riscv: Port improvements from arm64/amd64 pmaps, part 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c4f46b0d57b76d304f8a94862c6ba9be0273565 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3c4f46b0d57b76d304f8a94862c6ba9be0273565 commit 3c4f46b0d57b76d304f8a94862c6ba9be0273565 Author: Mark Johnston AuthorDate: 2023-11-02 18:33:55 +0000 Commit: Mark Johnston CommitDate: 2023-11-02 18:33:55 +0000 riscv: Port improvements from arm64/amd64 pmaps, part 2 - Give pmap_promote_l2() a return value indicating whether or not promotion succeeded. - Check pmap_ps_enabled() in pmap_promote_l2() rather than making callers do it. - Annotate superpages_enabled with __read_frequently. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D42289 --- sys/riscv/riscv/pmap.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 30bcf113628c..9b2866d7dd4d 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -256,7 +256,7 @@ CTASSERT(VM_EARLY_DTB_ADDRESS < (VM_MAX_KERNEL_ADDRESS - PMAP_MAPDEV_EARLY_SIZE) static struct rwlock_padalign pvh_global_lock; static struct mtx_padalign allpmaps_lock; -static int superpages_enabled = 1; +static int __read_frequently superpages_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, CTLFLAG_RDTUN, &superpages_enabled, 0, "Enable support for transparent superpages"); @@ -2759,7 +2759,7 @@ pmap_demote_l2_locked(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, } #if VM_NRESERVLEVEL > 0 -static void +static bool pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3, struct rwlock **lockp) { @@ -2767,6 +2767,8 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3, vm_paddr_t pa; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + if (!pmap_ps_enabled(pmap)) + return (false); KASSERT((pmap_load(l2) & PTE_RWX) == 0, ("pmap_promote_l2: invalid l2 entry %p", l2)); @@ -2783,7 +2785,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3, CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); atomic_add_long(&pmap_l2_p_failures, 1); - return; + return (false); } /* @@ -2817,7 +2819,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); atomic_add_long(&pmap_l2_p_failures, 1); - return; + return (false); } while ((l3e & (PTE_W | PTE_D)) == PTE_W) { if (atomic_fcmpset_64(l3, &l3e, l3e & ~PTE_W)) { @@ -2830,7 +2832,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); atomic_add_long(&pmap_l2_p_failures, 1); - return; + return (false); } all_l3e_PTE_A &= l3e; pa -= PAGE_SIZE; @@ -2857,7 +2859,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3, CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); atomic_add_long(&pmap_l2_p_failures, 1); - return; + return (false); } if ((firstl3e & PTE_SW_MANAGED) != 0) @@ -2868,6 +2870,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3, atomic_add_long(&pmap_l2_promotions, 1); CTR2(KTR_PMAP, "pmap_promote_l2: success for va %#lx in pmap %p", va, pmap); + return (true); } #endif @@ -3133,10 +3136,9 @@ validate: #if VM_NRESERVLEVEL > 0 if (mpte != NULL && mpte->ref_count == Ln_ENTRIES && - pmap_ps_enabled(pmap) && (m->flags & PG_FICTITIOUS) == 0 && vm_reserv_level_iffullpop(m) == 0) - pmap_promote_l2(pmap, l2, va, mpte, &lock); + (void)pmap_promote_l2(pmap, l2, va, mpte, &lock); #endif rv = KERN_SUCCESS;