On 03/21/2014 11:35 AM, Mathias Nyman wrote:

+void xhci_handle_command_timeout(unsigned long data)
+{
+       struct xhci_hcd *xhci;
+       int ret;
+       unsigned long flags;
+       xhci = (struct xhci_hcd *) data;
+       /* mark this command to be cancelled */
+       spin_lock_irqsave(&xhci->lock, flags);
+       if (xhci->current_cmd)
+               xhci->current_cmd->status = COMP_CMD_ABORT;
+       spin_unlock_irqrestore(&xhci->lock, flags);
+
+       ret = xhci_abort_cmd_ring(xhci);
+
+       if (ret) {
+               xhci_err(xhci, "Abort command ring failed\n");
+               if (unlikely(ret == -ESHUTDOWN)) {
+                       xhci_cleanup_command_queue(xhci);
+                       usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
+                       xhci_dbg(xhci, "xHCI host controller is dead.\n");
+               }
+       }
+       return;
+}
+

After some more testing and fault injection it turns out that xhci_abort_cmd_ring() returns 0 if command ring is already stopped. In this case the command submitter will still be left hanging, and khubd wait forever.

So one more round to fix this is still needed.

-Mathias

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to