From nobody Thu Nov 02 18:47:47 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 4SLtD35TPGz503cm; Thu, 2 Nov 2023 18:47:47 +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 4SLtD33csRz3X5L; Thu, 2 Nov 2023 18:47:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698950867; 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=ZxdvcrrYn1HlzsY1uaG4eoF0+F1g0sqf/EXUauVhhlY=; b=FjUcf955evzhrlNd39DmRhzTQdEXfpf0r1agHC6/+YM8EXZmHX12xeF8oXrhUt8G2Qm3RR nsqW1IGs88HEA6Xc4GLhpD6XsUXKSksTIusUFmPNU/GYhX5DfAb3mEG4xbEe7+FxdVebzu aJSIv7boNMpGkruIzVtFb56VOwe7U/h6fhWWcA7eEJolsgYqVQpXeq3hyWkpF2lTCUrKTy pP4C715ZPm+n/0D1vyYhAIA6UXM9Y3AKplpuszfAMO6lfFz5cAUtU+5ryzS2fm4OApSBhP kBB6sv0U8tsn0MLRdXJFgtx8nWNGV3OImG+qQ4CvhdVFTF3UfH8WQuJP4jyJIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698950867; 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=ZxdvcrrYn1HlzsY1uaG4eoF0+F1g0sqf/EXUauVhhlY=; b=AcVdrcPqiyck/ky0y3QPqfG4AHDNS2EHU49oeLLS8uxETl85O5kz6QQ6gkxRQcu+HEVyFi 2JXFrcoANZlNWvBsCfiTnm2CMpfpsXay5MJuRzwvl4L3DZZSLt9XtUnRqVtffBvvh3/58Y FX+cKWAiIPxU6XDzNAY8J7TA8oTozc5UuelVu6YS2gBIGaB6M/P/HrYbDcSK8sRDYSFkTx RC/gSm8/8oCmaHFoAyFz+aLN8EzXs8FZ8tSy/RGr87kMMG5dBFN7RFXtrozbmzyEWhJ4uz PGCV13J9kBcSS0tKpWl2wYmQoEbwG0xOqX0g0/M2v+Y4TpGyjOK1u0XplTwtLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698950867; a=rsa-sha256; cv=none; b=EAlBpd+tsNVm5b/lSFhW3amJdQtvRNQ1lCUPmfB0ODyxl6dJsnp2Shl1f+n00dHylipqJl teyohS2/aiklZIZk6DE7ONdNx4OQCNy3jhuoXpDPv88pQ08UrDeRke3nyO7M/b/qA0aY/f F3RcGsJ9HeU5a6qbak4ImtG7e9GJQIoZ5OjtH6GCCbmBGi5Y2GUCveg3QPsRkJjVjExOEZ nsGreeoN1WNnokmEm2a/T7EPKz5HxviyN42/aLVkvQ5c/TThQONW/LS2D6FQY6zUaJhIYI Ss7owwkL26HSXjZiVHhTexIwW6fmTgMGPKztPtlNswjS63XBBmCvjhbA2jv2dQ== 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 4SLtD32kpQzgdq; Thu, 2 Nov 2023 18:47:47 +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 3A2IllPs044807; Thu, 2 Nov 2023 18:47:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A2IllTH044804; Thu, 2 Nov 2023 18:47:47 GMT (envelope-from git) Date: Thu, 2 Nov 2023 18:47:47 GMT Message-Id: <202311021847.3A2IllTH044804@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: 71b77a7172c2 - main - riscv: Remove unnecessary invalidations in pmap_enter_quick_locked() 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: 71b77a7172c26783a9d2181d3bed27cf62974200 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=71b77a7172c26783a9d2181d3bed27cf62974200 commit 71b77a7172c26783a9d2181d3bed27cf62974200 Author: Mark Johnston AuthorDate: 2023-11-02 18:34:26 +0000 Commit: Mark Johnston CommitDate: 2023-11-02 18:34:26 +0000 riscv: Remove unnecessary invalidations in pmap_enter_quick_locked() This function always overwrites an invalid PTE, so if pmap_try_insert_pv_entry() fails it is certainly not necessary to invalidate anything, because the PTE has not yet been written by that point. It should also not be necessary to invalidate TLBs after overwriting an invalid entry. In principle the TLB could cache negative entries, but then the worst case scenario is a spurious fault. Since pmap_enter() does not bother issuing an sfence.vma, pmap_enter_quick_locked() should behave similarly. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D42291 --- sys/riscv/riscv/pmap.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index ebb0f069b4ab..f0108b611937 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -3458,11 +3458,9 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, if (l3 == NULL) panic("pmap_enter_quick_locked: No l3"); if (pmap_load(l3) != 0) { - if (mpte != NULL) { + if (mpte != NULL) mpte->ref_count--; - mpte = NULL; - } - return (mpte); + return (NULL); } /* @@ -3472,13 +3470,10 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, !pmap_try_insert_pv_entry(pmap, va, m, lockp)) { if (mpte != NULL) { SLIST_INIT(&free); - if (pmap_unwire_ptp(pmap, va, mpte, &free)) { - pmap_invalidate_page(pmap, va); + if (pmap_unwire_ptp(pmap, va, mpte, &free)) vm_page_free_pages_toq(&free, false); - } - mpte = NULL; } - return (mpte); + return (NULL); } /* @@ -3524,7 +3519,6 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, } #endif - pmap_invalidate_page(pmap, va); return (mpte); }