Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2024 01:46:16 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 8e9f1e10c624 - stable/14 - amd64 pmap: assert and explain why pmap_qremove() is safe WRT supermappings
Message-ID:  <202412020146.4B21kGwq026480@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib:

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

commit 8e9f1e10c624e289212a9244c317b61ea8195a7e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-11-23 21:02:25 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-12-02 01:44:55 +0000

    amd64 pmap: assert and explain why pmap_qremove() is safe WRT supermappings
    
    (cherry picked from commit 2d6923790b16785ac691cedb23234067672fe1cc)
---
 sys/amd64/amd64/pmap.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 9e6196de2e89..5a6c2b479937 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4077,7 +4077,19 @@ pmap_qremove(vm_offset_t sva, int count)
 
 	va = sva;
 	while (count-- > 0) {
+		/*
+		 * pmap_enter() calls within the kernel virtual
+		 * address space happen on virtual addresses from
+		 * subarenas that import superpage-sized and -aligned
+		 * address ranges.  So, the virtual address that we
+		 * allocate to use with pmap_qenter() can't be close
+		 * enough to one of those pmap_enter() calls for it to
+		 * be caught up in a promotion.
+		 */
 		KASSERT(va >= VM_MIN_KERNEL_ADDRESS, ("usermode va %lx", va));
+		KASSERT((*vtopde(va) & X86_PG_PS) == 0,
+		    ("pmap_qremove on promoted va %#lx", va));
+
 		pmap_kremove(va);
 		va += PAGE_SIZE;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412020146.4B21kGwq026480>