From nobody Tue Nov 17 16:39:39 2026 X-Original-To: dev-commits-src-main@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 4jTVnS2jGNz71N0f for ; Tue, 17 Nov 2026 16:39:40 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTVnR6pXZz3Ljb for ; Tue, 17 Nov 2026 16:39:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794933580; 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=NRUXC0bs1Vf+whTeOT5PX2o1xg+Y4SCWgxcf2tq8szg=; b=OlaW/rvVH9JE82BQ+OzoxyL9AcPEo7RYCu8dib9v7LkJQ8Xp7iS7MboZgqx/QmqKi7Hz9x DK9YirZMgzexGG6gqpIgy8afyMqADGKipxb2OXyFE2gJ1ew1veFvUMlrnenoqWiCTLyLeU 5DEoyo2hBOST0u0StM2zHgtqhCU6QnsqiYF31+PRcQgFI3PdY2IUVMicxWAAzgdqhTfOAl 4ax3RoIvySYnm5niRJV/aTY3zrCx4wgjK2oRlKqnJGfRw0SkSFQr8hFc+6vHg5TuvyCIGw 0zQEd78l661Hdd1i1Pb6MljWtrVlYOoFuLWCwkrFmae03T5oDqg3EyQNVNzOHg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794933580; b=gkodGNzJ2xWLYurup+xeE35G9tY6G8pnXbDWe0mc6fuiTXVYSQpxkbrjQwgzRrnGuWEUvI OUf4a9Q6pDGffkL9sVyQc97cj/xKW3om9sHGEUuChanrAaGvSbgInf/P8xnFq0V79JFsVS kSgfKcngY8zGC94O457OCmtDyFicHiu7gcu80ZMw4u8z3ifZByM8dikds3QFvBbUCUSmfc binGxPDrNk+kHo8dsGRIfXZQCYs4mavvoGaLTtG8U3oH0BFWny7vzLD8Czpc5TI0gfXeWx onfRwm0Z2e3t+A+o5yk91rz48W6+UrjTM7ie5kS8jVcKfqlRDBhiXcAEVGZWUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794933580; 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=NRUXC0bs1Vf+whTeOT5PX2o1xg+Y4SCWgxcf2tq8szg=; b=C1nLyjCJ1LnLNRENrfPsJHpgsXz0dHpnI+xHrv5T3MLp6CXaIJExOLJzNFiID1AhgnSkbn p4RKV2iwiOgBAmTk+ZnxQ+JP39FcL8+sbJyZ0CUhRkCw3COx+9TG/lBoeYFfFWoTZkZY17 DuS+a9BJsRE8VkHTiYAlGYhKu7zDv8TMNQ2gS0rpVrlSUGh/wxriEbAkFwKWIgqh8PYQxb /WKj8DRVHVrxd0vmnYyBYGVI5WoLsDpUe3euw+yATzoEPtJQEw44MTGBL0+yjXB+CXQKsz punQSwuo5I896NDzxhkxjuG5ZkW0/S/oM/LdrA7NSQ2O6hCJOz4fmyJY2uyVsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTVnR5kzczqc5 for ; Tue, 17 Nov 2026 16:39:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a349 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 16:39:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: fd6a3eae051e - main - arm64 pmap: Invalidate the TLB in pmap_enter_largepage() List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd6a3eae051ee553403c016c9a93d57e680d5f7a Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 16:39:39 +0000 Message-Id: <6afc834b.1a349.5eb52225@gitrepo.freebsd.org> The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=fd6a3eae051ee553403c016c9a93d57e680d5f7a commit fd6a3eae051ee553403c016c9a93d57e680d5f7a Author: Alan Cox AuthorDate: 2026-11-13 09:14:52 +0000 Commit: Alan Cox CommitDate: 2026-11-17 16:20:18 +0000 arm64 pmap: Invalidate the TLB in pmap_enter_largepage() The amd64 version of pmap_enter_largepage(), on which the arm64 version was based, never invalidates the TLB. That is correct on amd64, because a page fault automatically invalidates the TLB entry for the faulting address. However, on arm64 an entry that causes a permission fault may remain in the TLB. Consequently, we need to invalidate the TLB whenever pmap_enter_largepage() changes a valid mapping, unless only the wired bit changes. This only impacts large page shared memory objects created by shm_create_largepage() or memfd_create() with MFD_HUGETLB. Fixes: 4168aedcde0b ("Add largepage support to the arm64 pmap.") Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D61549 --- sys/arm64/arm64/pmap.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index c7fa75d1f25f..c4435d7dd3eb 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5645,8 +5645,26 @@ restart: pmap_store(tl3p, newpte); newpte += L3_SIZE; } + /* + * Revert to the last L3 entry within the L3C superpage to + * detect wiring-only changes. + */ + newpte -= L3_SIZE; } - dsb(ishst); + + /* + * A page fault does not automatically invalidate the TLB entry for a + * valid mapping, so we must perform an invalidation on any change to + * a valid mapping, including changes that add permissions. The only + * exception is a wiring-only change. One TLB invalidation suffices + * for L1 or L2 block mappings. + */ + if ((origpte & ATTR_DESCR_VALID) != 0 && + ((origpte ^ newpte) & ~ATTR_SW_WIRED) != 0) + pmap_invalidate_range(pmap, va, va + (psind == 1 ? + L3C_SIZE : PAGE_SIZE), true); + else + dsb(ishst); if ((origpte & ATTR_DESCR_VALID) == 0) pmap_resident_count_inc(pmap, pagesizes[psind] / PAGE_SIZE);