Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jmcneill-usbmp]: src/sys/dev/usb replace the (diagnostic-only) intr_cont...
details: https://anonhg.NetBSD.org/src/rev/c55e67f829fb
branches: jmcneill-usbmp
changeset: 771817:c55e67f829fb
user: mrg <mrg%NetBSD.org@localhost>
date: Sat Feb 25 20:46:33 2012 +0000
description:
replace the (diagnostic-only) intr_context with checks against LP_INTR
and cpu_intr_p().
XXX: there's one check that changes behaviour
diffstat:
sys/dev/usb/ehci.c | 17 +++++------------
sys/dev/usb/ohci.c | 14 ++++----------
sys/dev/usb/uhci.c | 16 +++++-----------
sys/dev/usb/usbdi.c | 8 ++++----
sys/dev/usb/usbdivar.h | 6 +++---
5 files changed, 21 insertions(+), 40 deletions(-)
diffs (273 lines):
diff -r d079af944ac1 -r c55e67f829fb sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Sat Feb 25 13:17:16 2012 +0000
+++ b/sys/dev/usb/ehci.c Sat Feb 25 20:46:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.181.6.12 2012/02/25 10:26:23 mrg Exp $ */
+/* $NetBSD: ehci.c,v 1.181.6.13 2012/02/25 20:46:33 mrg Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.12 2012/02/25 10:26:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.13 2012/02/25 20:46:33 mrg Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -69,6 +69,7 @@
#include <sys/queue.h>
#include <sys/mutex.h>
#include <sys/bus.h>
+#include <sys/cpu.h>
#include <machine/endian.h>
@@ -648,7 +649,6 @@
return (0);
EOWRITE4(sc, EHCI_USBSTS, intrs); /* Acknowledge */
- sc->sc_bus.intr_context++;
sc->sc_bus.no_intrs++;
if (eintrs & EHCI_STS_IAA) {
DPRINTF(("ehci_intr1: door bell\n"));
@@ -676,8 +676,6 @@
eintrs &= ~EHCI_STS_PCD;
}
- sc->sc_bus.intr_context--;
-
if (eintrs != 0) {
/* Block unprocessed interrupts. */
sc->sc_eintrs &= ~eintrs;
@@ -745,10 +743,7 @@
KASSERT(sc->sc_bus.use_polling || mutex_owned(&sc->sc_lock));
- DPRINTFN(10,("%s: ehci_softintr (%d)\n", device_xname(sc->sc_dev),
- sc->sc_bus.intr_context));
-
- sc->sc_bus.intr_context++;
+ DPRINTFN(10,("%s: ehci_softintr\n", device_xname(sc->sc_dev)));
/*
* The only explanation I can think of for why EHCI is as brain dead
@@ -771,8 +766,6 @@
sc->sc_softwake = 0;
cv_broadcast(&sc->sc_softwake_cv);
}
-
- sc->sc_bus.intr_context--;
}
/* Check for an interrupt. */
@@ -3010,7 +3003,7 @@
return;
}
- if (xfer->device->bus->intr_context)
+ if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0)
panic("ehci_abort_xfer: not in process context");
/*
diff -r d079af944ac1 -r c55e67f829fb sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Sat Feb 25 13:17:16 2012 +0000
+++ b/sys/dev/usb/ohci.c Sat Feb 25 20:46:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.218.6.14 2012/02/25 12:53:34 mrg Exp $ */
+/* $NetBSD: ohci.c,v 1.218.6.15 2012/02/25 20:46:34 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
/*
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.14 2012/02/25 12:53:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.15 2012/02/25 20:46:34 mrg Exp $");
#include "opt_usb.h"
@@ -54,6 +54,7 @@
#include <sys/select.h>
#include <sys/proc.h>
#include <sys/queue.h>
+#include <sys/cpu.h>
#include <sys/bus.h>
#include <machine/endian.h>
@@ -1187,7 +1188,6 @@
return (0);
}
- sc->sc_bus.intr_context++;
sc->sc_bus.no_intrs++;
if (eintrs & OHCI_SO) {
sc->sc_overrun_cnt++;
@@ -1224,8 +1224,6 @@
softint_schedule(sc->sc_rhsc_si);
}
- sc->sc_bus.intr_context--;
-
if (eintrs != 0) {
/* Block unprocessed interrupts. */
OWRITE4(sc, OHCI_INTERRUPT_DISABLE, eintrs);
@@ -1287,8 +1285,6 @@
DPRINTFN(10,("ohci_softintr: enter\n"));
- sc->sc_bus.intr_context++;
-
usb_syncmem(&sc->sc_hccadma, offsetof(struct ohci_hcca, hcca_done_head),
sizeof(sc->sc_hcca->hcca_done_head),
BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
@@ -1486,8 +1482,6 @@
cv_broadcast(&sc->sc_softwake_cv);
}
- sc->sc_bus.intr_context--;
-
DPRINTFN(10,("ohci_softintr: done:\n"));
}
@@ -2323,7 +2317,7 @@
return;
}
- if (xfer->device->bus->intr_context)
+ if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0)
panic("ohci_abort_xfer: not in process context");
/*
diff -r d079af944ac1 -r c55e67f829fb sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Sat Feb 25 13:17:16 2012 +0000
+++ b/sys/dev/usb/uhci.c Sat Feb 25 20:46:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.240.6.13 2012/02/25 12:53:34 mrg Exp $ */
+/* $NetBSD: uhci.c,v 1.240.6.14 2012/02/25 20:46:33 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.13 2012/02/25 12:53:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.14 2012/02/25 20:46:33 mrg Exp $");
#include "opt_usb.h"
@@ -57,6 +57,7 @@
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/bus.h>
+#include <sys/cpu.h>
#include <machine/endian.h>
@@ -1033,9 +1034,7 @@
xfer->actlen = 1;
xfer->status = USBD_NORMAL_COMPLETION;
mutex_enter(&sc->sc_lock);
- xfer->device->bus->intr_context++;
usb_transfer_complete(xfer);
- xfer->device->bus->intr_context--;
mutex_exit(&sc->sc_lock);
}
@@ -1391,10 +1390,7 @@
KASSERT(sc->sc_bus.use_polling || mutex_owned(&sc->sc_lock));
- DPRINTFN(10,("%s: uhci_softintr (%d)\n", device_xname(sc->sc_dev),
- sc->sc_bus.intr_context));
-
- sc->sc_bus.intr_context++;
+ DPRINTFN(10,("%s: uhci_softintr\n", device_xname(sc->sc_dev)));
/*
* Interrupts on UHCI really suck. When the host controller
@@ -1416,8 +1412,6 @@
sc->sc_softwake = 0;
cv_broadcast(&sc->sc_softwake_cv);
}
-
- sc->sc_bus.intr_context--;
}
/* Check for an interrupt. */
@@ -2152,7 +2146,7 @@
return;
}
- if (xfer->device->bus->intr_context)
+ if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0)
panic("uhci_abort_xfer: not in process context");
/*
diff -r d079af944ac1 -r c55e67f829fb sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Sat Feb 25 13:17:16 2012 +0000
+++ b/sys/dev/usb/usbdi.c Sat Feb 25 20:46:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.134.2.12 2012/02/25 10:26:24 mrg Exp $ */
+/* $NetBSD: usbdi.c,v 1.134.2.13 2012/02/25 20:46:34 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.12 2012/02/25 10:26:24 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.13 2012/02/25 20:46:34 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usb.h"
@@ -43,8 +43,8 @@
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/proc.h>
-
#include <sys/bus.h>
+#include <sys/cpu.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -968,7 +968,7 @@
usbd_status err;
#ifdef DIAGNOSTIC
- if (dev->bus->intr_context) {
+ if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0) {
printf("usbd_do_request: not in process context\n");
return (USBD_INVAL);
}
diff -r d079af944ac1 -r c55e67f829fb sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Sat Feb 25 13:17:16 2012 +0000
+++ b/sys/dev/usb/usbdivar.h Sat Feb 25 20:46:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.93.8.9 2012/02/25 10:26:24 mrg Exp $ */
+/* $NetBSD: usbdivar.h,v 1.93.8.10 2012/02/25 20:46:34 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@@ -62,7 +62,8 @@
* cleartoggle -
* done x
*
- * The above semantics are likely to change.
+ * The above semantics are likely to change. Little performance
+ * evaluation has been done on this code and the locking strategy.
*
* USB functions known to expect the lock taken include (this list is
* probably not exhaustive):
@@ -152,7 +153,6 @@
char use_polling;
device_t usbctl;
struct usb_device_stats stats;
- int intr_context;
u_int no_intrs;
int usbrev; /* USB revision */
#define USBREV_UNKNOWN 0
Home |
Main Index |
Thread Index |
Old Index