On 30/11/15(Mon) 18:28, Björn Ketelaars wrote:
> Hello,
>
> I repeatedly hit the kernel panic below. Easy to reproduce as it happens over
> and over again within 60 minutes after rebooting. Root cause is not known.
>
> I'm running snapshot on an USB stick. I tried different USB ports with the
> same
> result. Next step will be an attempt with a different USB stick.
>
> I think this issue has been mentioned before:
>
> https://marc.info/?t=14184059141&r=1&w=3
> http://openbsd-archive.7691.n7.nabble.com/panic-ehci-device-clear-toggle-queue-active-td231729.html
> http://article.gmane.org/gmane.os.openbsd.bugs/19812/
>
> Any ideas on how to tackle this issue?
You can try the diff below and tell me if it helps.
Index: ehci.c
===
RCS file: /cvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.187
diff -u -p -r1.187 ehci.c
--- ehci.c 26 Jun 2015 11:17:34 - 1.187
+++ ehci.c 14 Oct 2015 14:24:19 -
@@ -188,12 +188,11 @@ int ehci_alloc_sitd_chain(struct ehci_s
void ehci_abort_isoc_xfer(struct usbd_xfer *xfer,
usbd_status status);
-usbd_statusehci_device_setintr(struct ehci_softc *, struct ehci_soft_qh *,
- int ival);
+struct ehci_soft_qh * ehci_intr_get_sqh(struct usbd_pipe *);
-void ehci_add_qh(struct ehci_soft_qh *, struct ehci_soft_qh *);
-void ehci_rem_qh(struct ehci_softc *, struct ehci_soft_qh *);
-void ehci_set_qh_qtd(struct ehci_soft_qh *, struct ehci_soft_qtd *);
+void ehci_add_qh(struct usbd_pipe *, struct ehci_soft_qh *,
+ struct ehci_soft_qtd *);
+void ehci_rem_qh(struct ehci_softc *, struct usbd_pipe *);
void ehci_sync_hc(struct ehci_softc *);
void ehci_close_pipe(struct usbd_pipe *);
@@ -413,7 +412,6 @@ ehci_init(struct ehci_softc *sc)
sqh->qh.qh_qtd.qtd_next = htole32(EHCI_LINK_TERMINATE);
sqh->qh.qh_qtd.qtd_altnext = htole32(EHCI_LINK_TERMINATE);
sqh->qh.qh_qtd.qtd_status = htole32(EHCI_QTD_HALTED);
- sqh->sqtd = NULL;
usb_syncmem(&sqh->dma, sqh->offs, sizeof(sqh->qh),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
}
@@ -444,7 +442,6 @@ ehci_init(struct ehci_softc *sc)
sqh->qh.qh_qtd.qtd_next = htole32(EHCI_LINK_TERMINATE);
sqh->qh.qh_qtd.qtd_altnext = htole32(EHCI_LINK_TERMINATE);
sqh->qh.qh_qtd.qtd_status = htole32(EHCI_QTD_HALTED);
- sqh->sqtd = NULL;
usb_syncmem(&sqh->dma, sqh->offs, sizeof(sqh->qh),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
@@ -729,6 +726,7 @@ ehci_check_qh_intr(struct ehci_softc *sc
return;
}
done:
+ ehci_rem_qh(sc, xfer->pipe);
TAILQ_REMOVE(&sc->sc_intrhead, ex, inext);
timeout_del(&xfer->timeout_handle);
usb_rem_task(xfer->pipe->device, &xfer->abort_task);
@@ -861,7 +859,7 @@ ehci_idone(struct usbd_xfer *xfer)
{
struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
struct ehci_soft_qtd *sqtd;
- u_int32_t status = 0, nstatus = 0;
+ uint32_t status = 0, nstatus = 0;
int actlen, cerr;
#ifdef DIAGNOSTIC
@@ -1171,13 +1169,7 @@ ehci_freex(struct usbd_bus *bus, struct
void
ehci_device_clear_toggle(struct usbd_pipe *pipe)
{
- struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;
-
-#ifdef DIAGNOSTIC
- if ((epipe->sqh->qh.qh_qtd.qtd_status & htole32(EHCI_QTD_ACTIVE)) != 0)
- panic("ehci_device_clear_toggle: queue active");
-#endif
- epipe->sqh->qh.qh_qtd.qtd_status &= htole32(~EHCI_QTD_TOGGLE_MASK);
+ pipe->endpoint->savedtoggle = 0;
}
#ifdef EHCI_DEBUG
@@ -1374,29 +1366,17 @@ ehci_open(struct usbd_pipe *pipe)
struct usbd_device *dev = pipe->device;
struct ehci_softc *sc = (struct ehci_softc *)dev->bus;
usb_endpoint_descriptor_t *ed = pipe->endpoint->edesc;
- u_int8_t addr = dev->address;
u_int8_t xfertype = ed->bmAttributes & UE_XFERTYPE;
struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;
struct ehci_soft_qh *sqh;
usbd_status err;
- int s;
- int ival, speed, naks;
- int hshubaddr, hshubport;
- DPRINTFN(1, ("ehci_open: pipe=%p, addr=%d, endpt=%d\n",
+ DPRINTFN(1, ("%s: pipe=%p, addr=%d, endpt=%d\n", __func__,
pipe, addr, ed->bEndpointAddress));
if (sc->sc_bus.dying)
return (USBD_IOERROR);
- if (dev->myhsport) {
- hshubaddr = dev->myhsport->parent->address;
- hshubport = dev->myhsport->portno;
- } else {
- hshubaddr = 0;
- hshubport = 0;
- }
-
/* Root Hub */
if (pipe->device->depth == 0) {
switch (ed->bEndpointAddress) {
@@ -1412,55 +1392,11 @@ ehci_open(struct usbd_pipe *pipe)
retur