On 2017 Dec 14 (Thu) at 12:23:00 +0100 (+0100), Martin Pieuchot wrote: :On 14/12/17(Thu) 12:03, Peter Hessler wrote: :> This is the normal arm64 "pmap bug" panic. : :Thanks Peter, the diff below should fix the two problems present in your :trace: : :> ddb> show panic :> uvm_fault failed: ffffff80002619b4 : :I love that arm64 is doing the right thing and call panic(9) for UVM :faults. : :> ddb> bo re :> panic: mtx 0xffffff8000928138: locking against myself : :This happens when faulting/panic'ing with a mutex held. The diff below :contains the same trick I added for rwlock, close the eyes and try :harder. : :Note that the mutex part of the diff below is only for ARM64, I'll :generalize it if we reach a consensus. : :> ddb> # holding down enter, repeats last command 'bo re' :> panic: netlock: lock not held :> Stopped at panic+0x154: db_enter() at panic+0x150 :> panic() at if_downall+0x74 :> if_downall() at boot+0x68 : :This is new to me. My previous fix for rwlock() did not include a check :for the slow path of rw_exit_write(9)! Diff below should fix that. : :
This reads fine to me. While I haven't triggered a panic on arm64 yet, I think it should go in. OK :Index: kern/kern_rwlock.c :=================================================================== :RCS file: /cvs/src/sys/kern/kern_rwlock.c,v :retrieving revision 1.32 :diff -u -p -r1.32 kern_rwlock.c :--- kern/kern_rwlock.c 24 Oct 2017 08:53:15 -0000 1.32 :+++ kern/kern_rwlock.c 14 Dec 2017 11:16:29 -0000 :@@ -287,6 +287,10 @@ _rw_exit(struct rwlock *rwl LOCK_FL_VARS : int wrlock = owner & RWLOCK_WRLOCK; : unsigned long set; : :+ /* Avoid deadlocks after panic */ :+ if (panicstr) :+ return; :+ : if (wrlock) : rw_assert_wrlock(rwl); : else :Index: arch/arm64/arm64/arm64_mutex.c :=================================================================== :RCS file: /cvs/src/sys/arch/arm64/arm64/arm64_mutex.c,v :retrieving revision 1.2 :diff -u -p -r1.2 arm64_mutex.c :--- arch/arm64/arm64/arm64_mutex.c 30 Apr 2017 16:45:45 -0000 1.2 :+++ arch/arm64/arm64/arm64_mutex.c 14 Dec 2017 11:13:57 -0000 :@@ -57,6 +57,10 @@ mtx_enter(struct mutex *mtx) : int ticks = __mp_lock_spinout; : #endif : :+ /* Avoid deadlocks after panic */ :+ if (panicstr) :+ return; :+ : while (mtx_enter_try(mtx) == 0) { : #ifdef MP_LOCKDEBUG : if (--ticks == 0) { :@@ -73,7 +77,7 @@ mtx_enter_try(struct mutex *mtx) : { : struct cpu_info *owner, *ci = curcpu(); : int s; :- :+ : if (mtx->mtx_wantipl != IPL_NONE) : s = splraise(mtx->mtx_wantipl); : :@@ -102,6 +106,10 @@ void : mtx_leave(struct mutex *mtx) : { : int s; :+ :+ /* Avoid deadlocks after panic */ :+ if (panicstr) :+ return; : : MUTEX_ASSERT_LOCKED(mtx); : : -- In those days he was wiser than he is now -- he used to frequently take my advice. -- Winston Churchill