On Thu, Dec 02, 2010 at 11:31:46PM +0000, Jacob Meuser wrote:
> On Sat, Nov 27, 2010 at 11:33:15AM +0100, MERIGHI Marcus wrote:

> > # unplug pcmcia uhub
> > uhci3: host system error
> > uhci3: host controller process error
> > uhci3: host controller halted
> > uhci4: host system error
> > uhci4: host controller process error
> > uhci4: host controller halted
> > ehci0: unrecoverable error, controller halted
> > ehci0: blocking intrs 0x10
> > uhub3 detached
> > usb3 detached
> > uhci3 detached
> > uhub4 detached
> > usb4 detached
> > uhci4 detached
> > uhub5 detached
> > uvm_fault(0xd0a1a040, 0x0, 0, 1) -> e
> > kernel: page fault trap, code=0
> > Stopped at      usbd_do_request_flags_pipe+0x18:        movl    
> > 0x258(%eax),%ec
> > x
> > ddb>
> 
> 1) it is impossible to ever fully close the race between when the device
> is physically detached and when the kernel will notice.
> 2) something odd is happening here.  why is it in uhub_explore() in the
> frst place?
> 
> I now have a cardbus card with the same chipset.  thanks to whoever sent
> that to me.  interestingly, it crashes one machine immediately when
> inserted (cardbus layer issues), attaches uhci/ehci but doesn't recognize
> USB devices and eventually freezes another machine (no crash, just totally
> unresponsive), and behaves exactly like what you see on another machine.
> so, at least now I can reproduce this to further investigate.

this stops the crash for me.

-- 
[email protected]
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: ehci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.113
diff -u -p ehci.c
--- ehci.c      23 Oct 2010 15:42:09 -0000      1.113
+++ ehci.c      3 Dec 2010 02:12:22 -0000
@@ -585,6 +585,13 @@ ehci_intr1(ehci_softc_t *sc)
        EOWRITE4(sc, EHCI_USBSTS, intrs); /* Acknowledge */
        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);
+               sc->sc_dying = 1;
+               sc->sc_bus.intr_context--;
+               return (1);
+       }
        if (eintrs & EHCI_STS_IAA) {
                DPRINTF(("ehci_intr1: door bell\n"));
                wakeup(&sc->sc_async_head);
@@ -597,11 +604,6 @@ ehci_intr1(ehci_softc_t *sc)
                usb_schedsoftintr(&sc->sc_bus);
                eintrs &= ~(EHCI_STS_INT | EHCI_STS_ERRINT);
        }
-       if (eintrs & EHCI_STS_HSE) {
-               printf("%s: unrecoverable error, controller halted\n",
-                      sc->sc_bus.bdev.dv_xname);
-               /* XXX what else */
-       }
        if (eintrs & EHCI_STS_PCD) {
                ehci_pcd(sc, sc->sc_intrxfer);
                eintrs &= ~EHCI_STS_PCD;
@@ -655,6 +657,9 @@ ehci_softintr(void *v)
        DPRINTFN(10,("%s: ehci_softintr (%d)\n", sc->sc_bus.bdev.dv_xname,
                     sc->sc_bus.intr_context));
 
+       if (sc->sc_dying)
+               return;
+
        sc->sc_bus.intr_context++;
 
        /*
@@ -3091,11 +3096,13 @@ void
 ehci_intrlist_timeout(void *arg)
 {
        ehci_softc_t *sc = arg;
-       int s = splusb();
 
+       if (sc->sc_dying)
+               return;
+
+       int s = splusb();
        DPRINTFN(1, ("ehci_intrlist_timeout\n"));
        usb_schedsoftintr(&sc->sc_bus);
-
        splx(s);
 }
 
Index: uhci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhci.c,v
retrieving revision 1.86
diff -u -p uhci.c
--- uhci.c      21 Nov 2010 01:29:07 -0000      1.86
+++ uhci.c      3 Dec 2010 02:12:21 -0000
@@ -605,6 +605,11 @@ uhci_detach(struct uhci_softc *sc, int flags)
        if (rv != 0)
                return (rv);
 
+       if (sc->sc_intr_xfer != NULL) {
+               timeout_del(&sc->sc_poll_handle);
+               sc->sc_intr_xfer = NULL;
+       }
+
        if (sc->sc_shutdownhook != NULL)
                shutdownhook_disestablish(sc->sc_shutdownhook);
 
@@ -924,6 +929,9 @@ uhci_poll_hub(void *addr)
 
        DPRINTFN(20, ("uhci_poll_hub\n"));
 
+       if (sc->sc_dying)
+               return;
+
        timeout_del(&sc->sc_poll_handle);
        timeout_set(&sc->sc_poll_handle, uhci_poll_hub, xfer);
        timeout_add(&sc->sc_poll_handle, sc->sc_ival);
@@ -1215,6 +1223,9 @@ uhci_softintr(void *v)
 
        DPRINTFN(10,("%s: uhci_softintr (%d)\n", sc->sc_bus.bdev.dv_xname,
                     sc->sc_bus.intr_context));
+
+       if (sc->sc_dying)
+               return;
 
        sc->sc_bus.intr_context++;

Reply via email to