Skip to content

Commit

Permalink
riscv: Grab pvh_global_lock in pmap_caploadgen_update()
Browse files Browse the repository at this point in the history
This is required when promoting or demoting superpages, both of which may be
done here.
  • Loading branch information
markjdb authored and bsdjhb committed Oct 23, 2024
1 parent 503de77 commit 938846c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sys/riscv/riscv/pmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3880,6 +3880,7 @@ pmap_caploadgen_update(pmap_t pmap, vm_offset_t va, vm_page_t *mp, int flags)
pt_entry_t *pte, oldpte = 0;
vm_page_t m;

rw_rlock(&pvh_global_lock);
PMAP_LOCK(pmap);

KASSERT(!(csr_read(sccsr) & SCCSR_UGCLG) == !(pmap->flags.uclg),
Expand Down Expand Up @@ -4010,6 +4011,7 @@ pmap_caploadgen_update(pmap_t pmap, vm_offset_t va, vm_page_t *mp, int flags)
sfence_vma_page(va);
}
PMAP_UNLOCK(pmap);
rw_runlock(&pvh_global_lock);
pmap_caploadgen_test_all_clean(m);
m = NULL;
goto out_unlocked;
Expand Down Expand Up @@ -4133,6 +4135,7 @@ pmap_caploadgen_update(pmap_t pmap, vm_offset_t va, vm_page_t *mp, int flags)
#endif /* VM_NRESERVLEVEL > 0 */

PMAP_UNLOCK(pmap);
rw_runlock(&pvh_global_lock);
out_unlocked:

if (*mp != NULL) {
Expand Down

0 comments on commit 938846c

Please sign in to comment.