Re: [RFC v4 4/4] xhci: rework command timeout and cancellation,

From: Mathias Nyman
Date: Fri Mar 21 2014 - 11:40:18 EST





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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/