Adopt assert from amd64 in pmap_remove_pages().

Suggested by:	kib
Approved by:	kib (mentor)
This commit is contained in:
Svatopluk Kraus 2015-12-16 10:55:19 +00:00
parent 427c2f4ef0
commit 4729bd79cb

View File

@ -4153,10 +4153,25 @@ pmap_remove_pages(pmap_t pmap)
uint32_t inuse, bitmask;
boolean_t allfree;
if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
printf("warning: %s called with non-current pmap\n", __func__);
return;
/*
* Assert that the given pmap is only active on the current
* CPU. Unfortunately, we cannot block another CPU from
* activating the pmap while this function is executing.
*/
KASSERT(pmap == vmspace_pmap(curthread->td_proc->p_vmspace),
("%s: non-current pmap %p", __func__, pmap));
#if defined(SMP) && defined(INVARIANTS)
{
cpuset_t other_cpus;
sched_pin();
other_cpus = pmap->pm_active;
CPU_CLR(PCPU_GET(cpuid), &other_cpus);
sched_unpin();
KASSERT(CPU_EMPTY(&other_cpus),
("%s: pmap %p active on other cpus", __func__, pmap));
}
#endif
SLIST_INIT(&free);
rw_wlock(&pvh_global_lock);
PMAP_LOCK(pmap);