Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic avoid "panic: LOCKDEBUG: Mutex error: rw_vector_e...



details:   https://anonhg.NetBSD.org/src/rev/cb6a59607bf5
branches:  trunk
changeset: 970925:cb6a59607bf5
user:      ryo <ryo%NetBSD.org@localhost>
date:      Tue Apr 07 07:25:41 2020 +0000

description:
avoid "panic: LOCKDEBUG: Mutex error: rw_vector_enter,309: spin lock held"

ok nonaka@. thanks

diffstat:

 sys/dev/ic/nvme.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 06b8f3531794 -r cb6a59607bf5 sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Tue Apr 07 07:25:09 2020 +0000
+++ b/sys/dev/ic/nvme.c Tue Apr 07 07:25:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme.c,v 1.47 2019/11/11 07:27:48 nonaka Exp $ */
+/*     $NetBSD: nvme.c,v 1.48 2020/04/07 07:25:41 ryo Exp $    */
 /*     $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.47 2019/11/11 07:27:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.48 2020/04/07 07:25:41 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1721,7 +1721,13 @@
        mutex_enter(&q->q_ccb_mtx);
        while ((ccb = SIMPLEQ_FIRST(&q->q_ccb_list)) != NULL) {
                SIMPLEQ_REMOVE_HEAD(&q->q_ccb_list, ccb_entry);
+               /* 
+                * bus_dmamap_destroy() may call vm_map_lock() and rw_enter()
+                * internally. don't hold spin mutex
+                */
+               mutex_exit(&q->q_ccb_mtx);
                bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmamap);
+               mutex_enter(&q->q_ccb_mtx);
        }
        mutex_exit(&q->q_ccb_mtx);
 



Home | Main Index | Thread Index | Old Index