From nobody Tue Nov 17 16:39:39 2026 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 4jTVnS2jm8z71NFd 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 4jTVnR6XbFz3Lw5 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=1794933579; 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=lWuRpVQaHa735IUOOmlKM1FPADbq3hRZ2Acrk45WOvi4E6Kzn03FgMBHQjrMLWEi8yC9LV eVMTqrUlEsNQYTuSj3bGq2EDvO1k18KcaLYsId+IIUOZYaRD8V/b667am7rPOD7iAZ+Gut 6jWKVy93Tp6wTaG3aViljKFiQ4Kyqsa/6OVSgYbfql/H2EYZo3UYn4Ute9bKynOe/vkv4O swa3AckBjpaQqDKE+qRIPAU4hUZ5WSOPn+f5lR2CWH/QO3vTloZYRc50Spps8BDOcH53dC czHDryHfWWi/k9ersJLV7gWrQTxObACkeKbuonxe0wR9uNqXpqPeWVYXuA5eBQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794933579; b=lw8gmOJofEEloUMzvVk7+aAodyP0eNAry5+uvV878+dI5c1L9+L6pVgjeGlkoLnhYDtMhk muKfqYPRlDJ+4hKi22cxaeaOe8IvxigpaQAV2kM9j/cwkXXVXn30vonsLBowDpoXQJcFPs 3rHDoAe8JDJVTEaeQYUYNVcmerjX09xPEJvFKBDBZrUYUw1INMRYqLKEVc7++BDU36rQht AvR+J+Bz+Qu3SXeEuibZU8jSn6rNngn+2n/zQ8A9XXpHz3PBe1kYVPxk2rlX/XfLEsjht5 Qm8fbXHMPU0FcUHlc3sruwnDtuVhW7Wt3JI6bwALkenFqCwgefkKfY5xqUUhbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794933579; 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=Y1ffIaUCwcUSZwpHLuohLu7+q8I3VmcaqXX2EaLEhueu7SabtS/CKSp0+T0V/V8xW2jznv nC+kcoRXU23jqRwJc/XFrJ6MZzHunNEGIQ1Yai8DnpZZJ4wYtKCpRqgl0KvfnCVgCB7wnr Byh0Yf4/7wquTUZFX9vhYiEVWUiq27Fl/tJ3jksYHCIL2al1rr1rhs+lhGN1ktS50oyl0n SgMfi50+0be/I7BdxPojrvxWQVZkjy6rSEMc4fhZxajtQeegV6bYTmHGSrPR2HuwOwrVuh ruaXo+KrTOb587DIdEUixz6gmFjMxeta5wb4x/lox+iBQsZaEXnFVBFDYoxaKw== 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 4jTVnR5k2vzqc4 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-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches 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);