From 9e7f3703138062f082f4b28632de81f98fa8c222 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 9 Oct 2024 13:51:16 +0000 Subject: [PATCH] riscv: Grab pvh_global_lock in pmap_caploadgen_update() This is required when promoting or demoting superpages, both of which may be done here. --- sys/riscv/riscv/pmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index d136bee27996..574116037f9b 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -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), @@ -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; @@ -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) {