git: ab81ea52f422 - stable/15 - arm64 pmap: combine L3C accessed bits in pmap_mincore()

From: Alan Cox <alc_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 03:49:16 UTC
The branch stable/15 has been updated by alc:

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

commit ab81ea52f422e82194123b9a9e055b59d26e6bfe
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2026-11-02 01:18:01 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2026-11-17 03:47:46 +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.
    
    (cherry picked from commit 3ba68f5c5dcc9a4bcd513c28efce29afdfcb76ff)
---
 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 6c2ed9631b93..1a0a1abf5e51 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -9026,7 +9026,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;