Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/dev Pull up following revision(s) (requested by mrg i...



details:   https://anonhg.NetBSD.org/src/rev/a6fc5c329dc7
branches:  netbsd-6
changeset: 773940:a6fc5c329dc7
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Mar 19 23:13:59 2012 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #125):
        sys/dev/scsipi/scsiconf.c: revision 1.263
        sys/dev/scsipi/scsiconf.c: revision 1.264
        sys/dev/ic/ncr53c9x.c: revision 1.144
        sys/dev/ic/ninjascsi32.c: revision 1.22
        sys/dev/usb/uhub.c: revision 1.117
take the kernel lock in functions called from attach*().
scsidevdetached ioctl path enters scsipi code without kernel lock
and this upsets the newer kasserts.  take kernel lock here.
take the kernel lock a few more places when doing detach, to avoid
triggering KERNEL_LOCK_P() asserts in both scsi and usb code.
with this and other recent fixes i can now "drvctl -d ehci0".

diffstat:

 sys/dev/ic/ncr53c9x.c     |  10 ++++++++--
 sys/dev/ic/ninjascsi32.c  |   8 ++++++--
 sys/dev/scsipi/scsiconf.c |  23 ++++++++++++++++++++---
 sys/dev/usb/uhub.c        |  16 +++++++++++++---
 4 files changed, 47 insertions(+), 10 deletions(-)

diffs (187 lines):

diff -r ec1e0967b13e -r a6fc5c329dc7 sys/dev/ic/ncr53c9x.c
--- a/sys/dev/ic/ncr53c9x.c     Sat Mar 17 19:52:08 2012 +0000
+++ b/sys/dev/ic/ncr53c9x.c     Mon Mar 19 23:13:59 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr53c9x.c,v 1.143 2011/07/31 18:39:00 jakllsch Exp $  */
+/*     $NetBSD: ncr53c9x.c,v 1.143.8.1 2012/03/19 23:13:59 riz Exp $   */
 
 /*-
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.143 2011/07/31 18:39:00 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.143.8.1 2012/03/19 23:13:59 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -530,6 +530,9 @@
        sc->sc_msgpriq = sc->sc_msgout = sc->sc_msgoutq = 0;
        sc->sc_phase = sc->sc_prevphase = INVALID_PHASE;
 
+       /* XXXSMP scsipi */
+       KERNEL_LOCK(1, curlwp);
+
        for (r = 0; r < sc->sc_ntarg; r++) {
                struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[r];
 /* XXX - config flags per target: low bits: no reselect; high bits: no synch */
@@ -559,6 +562,9 @@
 
        /* Notify upper layer */
        scsipi_async_event(&sc->sc_channel, ASYNC_EVENT_RESET, NULL);
+
+       /* XXXSMP scsipi */
+       KERNEL_UNLOCK_ONE(curlwp);
 }
 
 /*
diff -r ec1e0967b13e -r a6fc5c329dc7 sys/dev/ic/ninjascsi32.c
--- a/sys/dev/ic/ninjascsi32.c  Sat Mar 17 19:52:08 2012 +0000
+++ b/sys/dev/ic/ninjascsi32.c  Mon Mar 19 23:13:59 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ninjascsi32.c,v 1.21 2010/11/13 13:52:01 uebayasi Exp $        */
+/*     $NetBSD: ninjascsi32.c,v 1.21.14.1 2012/03/19 23:13:59 riz Exp $        */
 
 /*-
  * Copyright (c) 2004, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ninjascsi32.c,v 1.21 2010/11/13 13:52:01 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ninjascsi32.c,v 1.21.14.1 2012/03/19 23:13:59 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1399,9 +1399,13 @@
        /* initialize target structure */
        njsc32_init_targets(sc);
 
+       /* XXXSMP scsipi */
+       KERNEL_LOCK(1, curlwp);
        s = splbio();
        scsipi_async_event(&sc->sc_channel, ASYNC_EVENT_RESET, NULL);
        splx(s);
+       /* XXXSMP scsipi */
+       KERNEL_UNLOCK_ONE(curlwp);
 
        /* release SCSI bus reset */
        njsc32_write_1(sc, NJSC32_REG_SCSI_BUS_CONTROL, 0);
diff -r ec1e0967b13e -r a6fc5c329dc7 sys/dev/scsipi/scsiconf.c
--- a/sys/dev/scsipi/scsiconf.c Sat Mar 17 19:52:08 2012 +0000
+++ b/sys/dev/scsipi/scsiconf.c Mon Mar 19 23:13:59 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken Exp $   */
+/*     $NetBSD: scsiconf.c,v 1.262.10.1 2012/03/19 23:13:59 riz Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.262.10.1 2012/03/19 23:13:59 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -256,11 +256,18 @@
        struct scsipi_xfer *xs;
        int error;
 
+       /* XXXSMP scsipi */
+       KERNEL_LOCK(1, curlwp);
+
        /*
         * Detach all of the periphs.
         */
-       if ((error = scsipi_target_detach(chan, -1, -1, flags)) != 0)
+       if ((error = scsipi_target_detach(chan, -1, -1, flags)) != 0) {
+               /* XXXSMP scsipi */
+               KERNEL_UNLOCK_ONE(curlwp);
+
                return error;
+       }
 
        pmf_device_deregister(self);
 
@@ -290,6 +297,10 @@
         * Now shut down the channel.
         */
        scsipi_channel_shutdown(chan);
+
+       /* XXXSMP scsipi */
+       KERNEL_UNLOCK_ONE(curlwp);
+
        return 0;
 }
 
@@ -378,11 +389,17 @@
        target = device_locator(child, SCSIBUSCF_TARGET);
        lun = device_locator(child, SCSIBUSCF_LUN);
 
+       /* XXXSMP scsipi */
+       KERNEL_LOCK(1, curlwp);
+
        periph = scsipi_lookup_periph(chan, target, lun);
        KASSERT(periph->periph_dev == child);
 
        scsipi_remove_periph(chan, periph);
        free(periph, M_DEVBUF);
+
+       /* XXXSMP scsipi */
+       KERNEL_UNLOCK_ONE(curlwp);
 }
 
 /*
diff -r ec1e0967b13e -r a6fc5c329dc7 sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c        Sat Mar 17 19:52:08 2012 +0000
+++ b/sys/dev/usb/uhub.c        Mon Mar 19 23:13:59 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhub.c,v 1.114 2011/06/09 19:08:32 matt Exp $  */
+/*     $NetBSD: uhub.c,v 1.114.10.1 2012/03/19 23:13:59 riz Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $       */
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.114 2011/06/09 19:08:32 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.114.10.1 2012/03/19 23:13:59 riz Exp $");
 
 #include "opt_usb.h"
 
@@ -593,13 +593,20 @@
        if (hub == NULL)                /* Must be partially working */
                return (0);
 
+       /* XXXSMP usb */
+       KERNEL_LOCK(1, curlwp);
+
        nports = hub->hubdesc.bNbrPorts;
        for(port = 0; port < nports; port++) {
                rup = &hub->ports[port];
                if (rup->device == NULL)
                        continue;
-               if ((rc = usb_disconnect_port(rup, self, flags)) != 0)
+               if ((rc = usb_disconnect_port(rup, self, flags)) != 0) {
+                       /* XXXSMP usb */
+                       KERNEL_UNLOCK_ONE(curlwp);
+
                        return rc;
+               }
        }
 
        pmf_device_deregister(self);
@@ -619,6 +626,9 @@
        if (sc->sc_statusbuf)
                free(sc->sc_statusbuf, M_USBDEV);
 
+       /* XXXSMP usb */
+       KERNEL_UNLOCK_ONE(curlwp);
+
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index