tech-kern archive

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

ncr53c9x fallout from asserting kernel lock in scsipi_base



Hi,

After the change in revision 1.156 of src/sys/dev/scsipi/scsipi_base.c to
assert that the kernel lock is held in scsipi_lookup_periph(), my SBus-based
sparc64 crashed with:

  panic: kernel diagnostic assertion "KERNEL_LOCKED_P()" failed: file 
"/usr/src/sys/dev/scsipi/scsipi_base.c", line 221

The backtrace is:

  kern_assert
  scsipi_lookup_periph
  scsipi_async_event
  ncr53c9x_update_xfer_mode
  ncr53c9x_init
  ncr53c9x_attach

The attached allows it to boot and run, but is it correct?

Thanks,

J

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/
Index: src/sys/dev/ic/ncr53c9x.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/ncr53c9x.c,v
retrieving revision 1.143
diff -u -r1.143 ncr53c9x.c
--- src/sys/dev/ic/ncr53c9x.c   31 Jul 2011 18:39:00 -0000      1.143
+++ src/sys/dev/ic/ncr53c9x.c   9 Mar 2012 14:41:02 -0000
@@ -546,7 +546,10 @@
                ti->offset = 0;
                ti->cfg3   = 0;
 
+               /* We need to have the kernel lock in scsipi_lookup_periph() */
+               KERNEL_LOCK(1, curlwp);
                ncr53c9x_update_xfer_mode(sc, r);
+               KERNEL_UNLOCK_ONE(curlwp);
        }
 
        if (doreset) {
@@ -558,7 +561,9 @@
        }
 
        /* Notify upper layer */
+       KERNEL_LOCK(1, curlwp);
        scsipi_async_event(&sc->sc_channel, ASYNC_EVENT_RESET, NULL);
+       KERNEL_UNLOCK_ONE(curlwp);
 }
 
 /*


Home | Main Index | Thread Index | Old Index