Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev take the kernel lock a few more places when doing de...
details: https://anonhg.NetBSD.org/src/rev/b37c014cd0ce
branches: trunk
changeset: 778006:b37c014cd0ce
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Mar 12 02:44:16 2012 +0000
description:
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/scsipi/scsiconf.c | 17 ++++++++++++++---
sys/dev/usb/uhub.c | 16 +++++++++++++---
2 files changed, 27 insertions(+), 6 deletions(-)
diffs (99 lines):
diff -r 63e4a507b9f6 -r b37c014cd0ce sys/dev/scsipi/scsiconf.c
--- a/sys/dev/scsipi/scsiconf.c Mon Mar 12 02:18:49 2012 +0000
+++ b/sys/dev/scsipi/scsiconf.c Mon Mar 12 02:44:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsiconf.c,v 1.263 2012/03/11 02:16:55 mrg Exp $ */
+/* $NetBSD: scsiconf.c,v 1.264 2012/03/12 02:44:16 mrg 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.263 2012/03/11 02:16:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.264 2012/03/12 02:44:16 mrg 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;
}
diff -r 63e4a507b9f6 -r b37c014cd0ce sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c Mon Mar 12 02:18:49 2012 +0000
+++ b/sys/dev/usb/uhub.c Mon Mar 12 02:44:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.116 2012/03/09 00:12:10 jakllsch Exp $ */
+/* $NetBSD: uhub.c,v 1.117 2012/03/12 02:44:17 mrg 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.116 2012/03/09 00:12:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.117 2012/03/12 02:44:17 mrg Exp $");
#include "opt_usb.h"
@@ -597,13 +597,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);
@@ -623,6 +630,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