From nobody Tue May 14 04:24:17 2024 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 4VdjtB3f0zz5KLHk; Tue, 14 May 2024 04:24:18 +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 4VdjtB1847z4bK1; Tue, 14 May 2024 04:24:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715660658; 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=ae5ZSaP6FkD4Urv+y9cOcbRGVBeIt4z/b94bibNSrFg=; b=dqZwgl5SLWB2Bey252JMOXqd8cTo1lxSuPnh3BacVwg6HxW0P5ZmBStAPjMg/ZWtBXwXzv OTbfllwCo6yyAO3zQwHEAMYVC89yCTLueZ60S8ROJojw5Cf3d1QjKK8V0OfsdzxprYvUo0 yrpugoYK4bwFxc9zMbO7+/sHB60z/IIq+jacG/4cmvO0lVvd5kHiS+MaFs0jPxN7ynftAu fBULpb21rVvr5JQHgTag8HupttjMo/7Ijfm1UayD8qJniEiYjEmL/TZpT/c9PlpakllP8h FxEsagLUMTUmmrhKZGhCHkhY6ibmjiHYqMfdq7F1/vjT7E/imdUZ8FDu0OHNOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715660658; a=rsa-sha256; cv=none; b=ClODODoZN0HlekCFCeROXyocZzgFRDVK6+K6Efit1ltnxa2jylHGmTyxWZ5Pp/x/iv9AYM eOrTb8gTFBzpXItpdxbPCRE0y7UzivmkBYdnEDkcR8iwO16T5kVndpze7aQqjwb1iv1lyR TNra5TotxcVQSpg2fv9uGVtEcJeAb5uPP2QOdNpxaTAQVqMcdtQyK1wGpuILhmYvVQlgM4 udaEckBkZcwLzWt2VA6YWy2PlpJlG7vjhIuMkCWH/Mkc33jo8dotxpVYZMrDVNI1TG+oZ2 AIGY9Do1BERQcUoxuzxXNYm+S2c/JxodFur+BSctbdZephDV0aIi/ctlBNKYPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715660658; 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=ae5ZSaP6FkD4Urv+y9cOcbRGVBeIt4z/b94bibNSrFg=; b=OmTxM9mFaZ6npv4gvsZBwLUwAnby7UAgKI7RzdkfOza3bZtYtij+0ibPMhQ74DtKx7y2W7 qPLEAg47wn5UL4n8sKq7VVIokpHC21WvmAc2hLtgRnYQ27wzkrgHNl1ORx7JxO2b6RcpRt 8hAloxeZ8mV9TiYje8nj1kN2Zz4HWYIXArOyz0xQV4Fxa1vx+JR5xDqMJQ8Ur/xfOlscBD fzv3IeH+H74RQv1spIEtjlQwjH3csYqH8IfmXDvDW4Se79Uf25mZkErK12imZGzzwv2f+V iNiLt16YKm0B+DsRojbANaTWD2lLC0cEv43AVPV1hSOomyJhAQF8ybOXk0mQDg== 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 4VdjtB0ly3zGtG; Tue, 14 May 2024 04:24:18 +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 44E4OI5F051111; Tue, 14 May 2024 04:24:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44E4OHm8051108; Tue, 14 May 2024 04:24:17 GMT (envelope-from git) Date: Tue, 14 May 2024 04:24:17 GMT Message-Id: <202405140424.44E4OHm8051108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: b5a1f0406b9d - main - arm64_pmap: narrow scope of bti_same test 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5a1f0406b9d6bba28e57377dcfc8b83bce987ad Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=b5a1f0406b9d6bba28e57377dcfc8b83bce987ad commit b5a1f0406b9d6bba28e57377dcfc8b83bce987ad Author: Doug Moore AuthorDate: 2024-05-14 04:22:52 +0000 Commit: Doug Moore CommitDate: 2024-05-14 04:22:52 +0000 arm64_pmap: narrow scope of bti_same test The pmap_bti_same test in pmap_enter_l3c only happens in the !ADDR_IS_KERNEL case; in the other case, a KASSERT fails. So move the test into that case to save a bit of time when ADDR_IS_KERNEL. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D45160 --- sys/arm64/arm64/pmap.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 7780c6ec8767..a6056a5edfc2 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5662,6 +5662,19 @@ retry: } } l3p = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(*ml3p)); + +have_l3p: + /* + * If bti is not the same for the whole L3C range, return + * failure and let vm_fault() cope. Check after L3 allocation, + * since it could sleep. + */ + if (!pmap_bti_same(pmap, va, va + L3C_SIZE)) { + (*ml3p)->ref_count -= L3C_ENTRIES - 1; + pmap_abort_ptp(pmap, va, *ml3p); + *ml3p = NULL; + return (KERN_PROTECTION_FAILURE); + } } else { *ml3p = NULL; @@ -5684,22 +5697,8 @@ retry: pmap_load(pde))); } } -have_l3p: l3p = &l3p[pmap_l3_index(va)]; - /* - * If bti is not the same for the whole L3C range, return failure - * and let vm_fault() cope. Check after L3 allocation, since - * it could sleep. - */ - if (!pmap_bti_same(pmap, va, va + L3C_SIZE)) { - KASSERT(*ml3p != NULL, ("pmap_enter_l3c: missing L3 PTP")); - (*ml3p)->ref_count -= L3C_ENTRIES - 1; - pmap_abort_ptp(pmap, va, *ml3p); - *ml3p = NULL; - return (KERN_PROTECTION_FAILURE); - } - /* * If there are existing mappings, either abort or remove them. */