Hello Tilo,
On 17/12/14(Wed) 09:27, Tilo Stritzky wrote:
> >Synopsis: Subject: Panic on removal of PCMCIA card 4 ports USB on HP
> >avilion ze4300
> >Category: system
> >Environment:
> System : OpenBSD 5.6
> Details : OpenBSD 5.6-current (GENERIC) #594: Sun Dec 14 19:58:51
> MST 2014
>
> [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
>
> Architecture: OpenBSD.i386
> Machine : i386
> >Description:
> System panics when a PCMCIA card (4 Port USB) is physically removed
> from machine. Card works fine otherwise.
>
> Panic is 100% reproducible.
> Dumps are available.
Thanks for the report, diff below fixes it for me, could you try it?
Index: ehci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.171
diff -u -p -r1.171 ehci.c
--- ehci.c 9 Dec 2014 07:05:06 -0000 1.171
+++ ehci.c 17 Dec 2014 12:25:00 -0000
@@ -542,8 +542,8 @@ ehci_intr1(struct ehci_softc *sc)
sc->sc_bus.intr_context++;
sc->sc_bus.no_intrs++;
if (eintrs & EHCI_STS_HSE) {
- printf("%s: unrecoverable error, controller halted\n",
- sc->sc_bus.bdev.dv_xname);
+ printf("%s: host controller halted\n",
+ sc->sc_bus.bdev.dv_xname);
sc->sc_bus.dying = 1;
sc->sc_bus.intr_context--;
return (1);
Index: uhci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/uhci.c,v
retrieving revision 1.133
diff -u -p -r1.133 uhci.c
--- uhci.c 9 Dec 2014 07:05:06 -0000 1.133
+++ uhci.c 17 Dec 2014 12:25:00 -0000
@@ -1052,6 +1052,13 @@ uhci_intr1(struct uhci_softc *sc)
printf("%s: resume detect\n", sc->sc_bus.bdev.dv_xname);
#endif
}
+ if (status & UHCI_STS_HCH) {
+ printf("%s: host controller halted\n",
+ sc->sc_bus.bdev.dv_xname);
+ sc->sc_bus.dying = 1;
+ sc->sc_bus.intr_context--;
+ return (1);
+ }
if (status & UHCI_STS_HSE) {
ack |= UHCI_STS_HSE;
printf("%s: host system error\n", sc->sc_bus.bdev.dv_xname);
@@ -1059,18 +1066,7 @@ uhci_intr1(struct uhci_softc *sc)
if (status & UHCI_STS_HCPE) {
ack |= UHCI_STS_HCPE;
printf("%s: host controller process error\n",
- sc->sc_bus.bdev.dv_xname);
- }
- if (status & UHCI_STS_HCH) {
- /* no acknowledge needed */
- if (!sc->sc_bus.dying) {
- printf("%s: host controller halted\n",
- sc->sc_bus.bdev.dv_xname);
-#ifdef UHCI_DEBUG
- uhci_dump_all(sc);
-#endif
- }
- sc->sc_bus.dying = 1;
+ sc->sc_bus.bdev.dv_xname);
}
if (!ack)
Index: usb.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/usb.c,v
retrieving revision 1.102
diff -u -p -r1.102 usb.c
--- usb.c 10 Aug 2014 11:18:57 -0000 1.102
+++ usb.c 17 Dec 2014 12:25:00 -0000
@@ -262,6 +262,13 @@ usb_detach_roothub(struct usb_softc *sc)
* it.
*/
sc->sc_bus->flags |= USB_BUS_DISCONNECTING;
+ /*
+ * Reset the dying flag in case it has been set by the interrupt
+ * handler when unplugging a HC card otherwise the task won't be
+ * scheduled. This is safe since a dead HC should not trigger
+ * new interrupt.
+ */
+ sc->sc_bus->dying = 0;
usb_needs_explore(sc->sc_bus->root_hub, 0);
usb_wait_task(sc->sc_bus->root_hub, &sc->sc_explore_task);
Index: xhci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/xhci.c,v
retrieving revision 1.46
diff -u -p -r1.46 xhci.c
--- xhci.c 15 Dec 2014 17:10:44 -0000 1.46
+++ xhci.c 17 Dec 2014 12:25:00 -0000
@@ -600,7 +600,7 @@ xhci_intr1(struct xhci_softc *sc)
sc->sc_bus.no_intrs++;
if (intrs & XHCI_STS_HSE) {
- printf("%s: host system error\n", DEVNAME(sc));
+ printf("%s: host controller halted\n", DEVNAME(sc));
sc->sc_bus.dying = 1;
sc->sc_bus.intr_context--;
return (1);