diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2024-11-20 22:25:39 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2024-11-20 22:25:39 +0000 |
commit | 08c3b839c393cd3d69f2aef80edc5af6ed46d00b (patch) | |
tree | 640d813ffc59e322e7935cbbf6ed9ddf43bf9cb2 | |
parent | a6ab23279a7b515b1f67d23a0dcc3fa21acf291c (diff) |
The buffer flipper (incorrectly?) uses pmap_copy_page() from interrupt
context (when it calls uvm_pagerealloc_multi()). But the current
implementation of pmap_copy_page() assumes it only runs in process context.
Use splbio() to block the interrupts while we're doing the copy.
Same diff as the one committed to arm64 a bit over a week ago.
ok mpi@, jca@
-rw-r--r-- | sys/arch/riscv64/riscv64/pmap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/riscv64/riscv64/pmap.c b/sys/arch/riscv64/riscv64/pmap.c index 67247ca7346..15615e48efc 100644 --- a/sys/arch/riscv64/riscv64/pmap.c +++ b/sys/arch/riscv64/riscv64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.42 2024/09/04 07:54:51 mglocker Exp $ */ +/* $OpenBSD: pmap.c,v 1.43 2024/11/20 22:25:38 kettenis Exp $ */ /* * Copyright (c) 2019-2020 Brian Bamsch <bbamsch@google.com> @@ -792,12 +792,19 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) paddr_t dstpa = VM_PAGE_TO_PHYS(dstpg); vaddr_t srcva = copy_src_page + cpu_number() * PAGE_SIZE; vaddr_t dstva = copy_dst_page + cpu_number() * PAGE_SIZE; + int s; + /* + * XXX The buffer flipper (incorrectly?) uses pmap_copy_page() + * (from uvm_pagerealloc_multi()) from interrupt context! + */ + s = splbio(); pmap_kenter_pa(srcva, srcpa, PROT_READ); pmap_kenter_pa(dstva, dstpa, PROT_READ|PROT_WRITE); memcpy((void *)dstva, (void *)srcva, PAGE_SIZE); pmap_kremove_pg(srcva); pmap_kremove_pg(dstva); + splx(s); } void |