public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: sarah.a.sharp@linux.intel.com, dan.j.williams@intel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC v4 4/4] xhci: rework command timeout and cancellation,
Date: Fri, 21 Mar 2014 17:48:50 +0200	[thread overview]
Message-ID: <532C5F62.2030709@linux.intel.com> (raw)
In-Reply-To: <1395394517-31451-5-git-send-email-mathias.nyman@linux.intel.com>




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


      reply	other threads:[~2014-03-21 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21  9:35 [RFC v4 0/4] xhci: re-work command queue management Mathias Nyman
2014-03-21  9:35 ` [RFC v4 1/4] xhci: Use command structures when queuing commands on the command ring Mathias Nyman
2014-03-21  9:35 ` [RFC v4 2/4] xhci: Add a global command queue Mathias Nyman
2014-03-21  9:35 ` [RFC v4 3/4] xhci: Use completion and status in " Mathias Nyman
2014-03-21  9:35 ` [RFC v4 4/4] xhci: rework command timeout and cancellation, Mathias Nyman
2014-03-21 15:48   ` Mathias Nyman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532C5F62.2030709@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox