git: 3ba68f5c5dcc - main - arm64 pmap: combine L3C accessed bits in pmap_mincore()

From: Alan Cox <alc_at_FreeBSD.org>
Date: Mon, 09 Nov 2026 16:22:39 UTC
The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=3ba68f5c5dcc9a4bcd513c28efce29afdfcb76ff

commit 3ba68f5c5dcc9a4bcd513c28efce29afdfcb76ff
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2026-11-02 01:18:01 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2026-11-09 16:21:33 +0000

    arm64 pmap: combine L3C accessed bits in pmap_mincore()
    
    The accessed bit may be set in only some of an L3C superpage's L3
    PTEs.  However, when pmap_mincore() found an L3C mapping, it reported
    the accessed state of the specified L3 PTE only, so mincore(2) could
    fail to report MINCORE_REFERENCED for an L3C superpage that had been
    accessed.  When the accessed bit is not set in the specified entry, use
    pmap_load_l3c() to combine the accessed bits from all of the L3C
    superpage's L3 PTEs.
    
    Found by:       Claude Code (Opus 5.5)
    MFC after:      1 week
---
 sys/arm64/arm64/pmap.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index b03ad9b81828..c65de8094dcc 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -9508,7 +9508,16 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap)
 		switch (lvl) {
 		case 3:
 			mask = L3_OFFSET;
-			psind = (tpte & ATTR_CONTIGUOUS) != 0 ? 1 : 0;
+			if ((tpte & ATTR_CONTIGUOUS) != 0) {
+				/*
+				 * Only the accessed bit can differ among an
+				 * L3C superpage's PTEs.
+				 */
+				if ((tpte & ATTR_AF) == 0)
+					tpte = pmap_load_l3c(pte);
+				psind = 1;
+			} else
+				psind = 0;
 			break;
 		case 2:
 			mask = L2_OFFSET;