amd64 pmap: assert and explain why pmap_qremove() is safe WRT supermappings

Based on alc@ comments from https://reviews.freebsd.org/D47678.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47717
This commit is contained in:
Konstantin Belousov 2024-11-23 23:02:25 +02:00
parent aebac84982
commit 2d6923790b

View File

@ -4082,7 +4082,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;
}