o Invalidate the correct page in pmap_protect().

With this bug fix we don't need to invalidate all the entries.
o Remove a call to pmap_invalidate_all(). This was never called
  as the anyvalid variable is never set.

Obtained from:	arm64/pmap.c (r322797, r322800)
Sponsored by:	DARPA, AFRL
This commit is contained in:
Ruslan Bukin 2017-11-22 14:10:58 +00:00
parent a9abb85906
commit 0d4435dfab

View File

@ -1804,7 +1804,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
pd_entry_t *l1, *l2;
pt_entry_t l3_pte, *l3;
struct spglist free;
int anyvalid;
/*
* Perform an unsynchronized read. This is, however, safe.
@ -1812,7 +1811,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
if (pmap->pm_stats.resident_count == 0)
return;
anyvalid = 0;
SLIST_INIT(&free);
rw_rlock(&pvh_global_lock);
@ -1885,8 +1883,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
}
if (lock != NULL)
rw_wunlock(lock);
if (anyvalid)
pmap_invalidate_all(pmap);
rw_runlock(&pvh_global_lock);
PMAP_UNLOCK(pmap);
pmap_free_zero_pages(&free);
@ -2014,14 +2010,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
pmap_load_store(l3p, entry);
PTE_SYNC(l3p);
/* XXX: Use pmap_invalidate_range */
pmap_invalidate_page(pmap, va);
pmap_invalidate_page(pmap, sva);
}
}
}
PMAP_UNLOCK(pmap);
/* TODO: Only invalidate entries we are touching */
pmap_invalidate_all(pmap);
}
/*