Fix assert condition in pmap_large_unmap().

pmap_large_unmap() asserts that an unmapping request covers the
entirety of a 2M or 1G page.  The logic in the asserts was out of date
with the loop logic.  Correct the test to actually check that
destroying the current superpage mapping does not unmap addresses
beyond those requested by the caller.

Submitted by:	D Scott Phillips <d.scott.phillips@intel.com>
Reviewed by:	alc
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18345
This commit is contained in:
Konstantin Belousov 2018-11-27 21:40:51 +00:00
parent fbec776de0
commit 32b083531f

View File

@ -8441,9 +8441,10 @@ pmap_large_unmap(void *svaa, vm_size_t len)
KASSERT((va & PDPMASK) == 0,
("PDPMASK bit set, va %#lx pdpe %#lx pdp %#lx", va,
(u_long)pdpe, pdp));
KASSERT(len <= NBPDP,
("len < NBPDP, sva %#lx va %#lx pdpe %#lx pdp %#lx "
"len %#lx", sva, va, (u_long)pdpe, pdp, len));
KASSERT(va + NBPDP <= sva + len,
("unmap covers partial 1GB page, sva %#lx va %#lx "
"pdpe %#lx pdp %#lx len %#lx", sva, va,
(u_long)pdpe, pdp, len));
*pdpe = 0;
inc = NBPDP;
continue;
@ -8457,9 +8458,10 @@ pmap_large_unmap(void *svaa, vm_size_t len)
KASSERT((va & PDRMASK) == 0,
("PDRMASK bit set, va %#lx pde %#lx pd %#lx", va,
(u_long)pde, pd));
KASSERT(len <= NBPDR,
("len < NBPDR, sva %#lx va %#lx pde %#lx pd %#lx "
"len %#lx", sva, va, (u_long)pde, pd, len));
KASSERT(va + NBPDR <= sva + len,
("unmap covers partial 2MB page, sva %#lx va %#lx "
"pde %#lx pd %#lx len %#lx", sva, va, (u_long)pde,
pd, len));
pde_store(pde, 0);
inc = NBPDR;
m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pde));