Clear PGA_WRITEABLE in riscv's pmap_remove_l3().

pmap_remove_l3() may remove the last mapping of a page, in which case
it must clear PGA_WRITEABLE.

Reported by:	Jenkins, via lwhsu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2019-10-08 14:54:35 +00:00
parent 4661f8af40
commit 7992921bfe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353306

View File

@ -2085,6 +2085,7 @@ static int
pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va,
pd_entry_t l2e, struct spglist *free, struct rwlock **lockp) pd_entry_t l2e, struct spglist *free, struct rwlock **lockp)
{ {
struct md_page *pvh;
pt_entry_t old_l3; pt_entry_t old_l3;
vm_paddr_t phys; vm_paddr_t phys;
vm_page_t m; vm_page_t m;
@ -2104,6 +2105,12 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va,
vm_page_aflag_set(m, PGA_REFERENCED); vm_page_aflag_set(m, PGA_REFERENCED);
CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m); CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m);
pmap_pvh_free(&m->md, pmap, va); pmap_pvh_free(&m->md, pmap, va);
if (TAILQ_EMPTY(&m->md.pv_list) &&
(m->flags & PG_FICTITIOUS) == 0) {
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
if (TAILQ_EMPTY(&pvh->pv_list))
vm_page_aflag_clear(m, PGA_WRITEABLE);
}
} }
return (pmap_unuse_pt(pmap, va, l2e, free)); return (pmap_unuse_pt(pmap, va, l2e, free));