NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/58666: panic: lock error: Reader / writer lock: rw_vector_enter,357: locking against myself



Can you please try the attached patch and see if you can still
reproduce the issue?

I don't know why this might have changed from 9.3 to 10.0_STABLE, but
the bug the patch fixes may explain your symptom.
# HG changeset patch
# User Taylor R Campbell <riastradh%NetBSD.org@localhost>
# Date 1725793843 0
#      Sun Sep 08 11:10:43 2024 +0000
# Branch trunk
# Node ID 136d545c35b390c461167f41873831ea1109c668
# Parent  38029f50cf37ce95668214c8d1a5a30aa712814a
# EXP-Topic riastradh-pr58666-i386pmapcrash
x86/pmap: Use UVM_KMF_WAITVA to ensure pmap_pdp_alloc never fails.

This is used as the backing page allocator for pmap_pdp_pool, and
pmap_ctor assumes that PR_WAITOK allocations from it don't fail and
unconditionally writes to the resulting kva, which if null leads
nowhere good.

It is unclear to me why uvm_km_alloc can accept any combination of
the options UVM_KMF_NOWAIT and UVM_KMF_WAITVA.  It seems to me that
at least one should be required (and they should be exclusive), and
any other use should trip an assertion.

PR kern/58666: panic: lock error: Reader / writer lock:
rw_vector_enter,357: locking against myself

diff -r 38029f50cf37 -r 136d545c35b3 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c	Sat Aug 31 15:49:02 2024 +0000
+++ b/sys/arch/x86/x86/pmap.c	Sun Sep 08 11:10:43 2024 +0000
@@ -2844,7 +2844,8 @@ pmap_pdp_alloc(struct pool *pp, int flag
 {
 	return (void *)uvm_km_alloc(kernel_map,
 	    PAGE_SIZE * PDP_SIZE, PAGE_SIZE * PDP_SIZE,
-	    ((flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK) |
+	    ((flags & PR_WAITOK) ? UVM_KMF_WAITVA
+		: UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK) |
 	    UVM_KMF_WIRED);
 }
 


Home | Main Index | Thread Index | Old Index