From: Martin Pieuchot Subject: splbio() in page cache To: tech@openbsd.org Date: Sun, 9 Nov 2025 10:50:15 +0000 arm64 and riscv pmap_copy_page(9) use splbio(9) and document why it is required. The same apply to uvm_pmr_cache_* functions. The diff below applies the same comment and document why those spl are required. ok? Index: uvm/uvm_pmemrange.c =================================================================== RCS file: /cvs/src/sys/uvm/uvm_pmemrange.c,v diff -u -p -r1.77 uvm_pmemrange.c --- uvm/uvm_pmemrange.c 19 Feb 2025 11:10:54 -0000 1.77 +++ uvm/uvm_pmemrange.c 9 Nov 2025 10:44:19 -0000 @@ -2239,7 +2239,7 @@ uvm_pmr_cache_alloc(struct uvm_pmr_cache int flags = UVM_PLA_NOWAIT|UVM_PLA_NOWAKE; int npages = UVM_PMR_CACHEMAGSZ; - splassert(IPL_VM); + splassert(IPL_BIO); KASSERT(upci->upci_npages == 0); TAILQ_INIT(&pgl); @@ -2264,7 +2264,11 @@ uvm_pmr_cache_get(int flags) struct vm_page *pg; int s; - s = splvm(); + /* + * XXX The buffer flipper (incorrectly?) allocates & frees pages + * (from uvm_pagerealloc_multi()) from interrupt context! + */ + s = splbio(); upci = &upc->upc_magz[upc->upc_actv]; if (upci->upci_npages == 0) { unsigned int prev; @@ -2301,7 +2305,7 @@ uvm_pmr_cache_free(struct uvm_pmr_cache_ struct pglist pgl; unsigned int i; - splassert(IPL_VM); + splassert(IPL_BIO); TAILQ_INIT(&pgl); for (i = 0; i < upci->upci_npages; i++) @@ -2334,7 +2338,11 @@ uvm_pmr_cache_put(struct vm_page *pg) return; } - s = splvm(); + /* + * XXX The buffer flipper (incorrectly?) allocates & frees pages + * (from uvm_pagerealloc_multi()) from interrupt context! + */ + s = splbio(); upci = &upc->upc_magz[upc->upc_actv]; if (upci->upci_npages >= UVM_PMR_CACHEMAGSZ) { unsigned int prev; @@ -2362,7 +2370,11 @@ uvm_pmr_cache_drain(void) unsigned int freed = 0; int s; - s = splvm(); + /* + * XXX The buffer flipper (incorrectly?) allocates & frees pages + * (from uvm_pagerealloc_multi()) from interrupt context! + */ + s = splbio(); freed += uvm_pmr_cache_free(&upc->upc_magz[0]); freed += uvm_pmr_cache_free(&upc->upc_magz[1]); splx(s);