public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@intel.com>
To: Rajesh Bhagat <rajesh.bhagat@nxp.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	Sriram Dash <sriram.dash@nxp.com>
Subject: Re: [PATCH] usb: xhci: Fix incomplete PM resume operation due to XHCI commmand timeout
Date: Mon, 21 Mar 2016 11:16:01 +0200	[thread overview]
Message-ID: <56EFBBD1.6080600@intel.com> (raw)
In-Reply-To: <HE1PR0401MB202857F4B183B84FCEDFBDA6E38F0@HE1PR0401MB2028.eurprd04.prod.outlook.com>

On 21.03.2016 06:18, Rajesh Bhagat wrote:
>
>
>>
>> Hi
>>
>> I think clearing the whole command ring is a bit too much in this case.
>> It may cause issues for all attached devices when one command times out.
>>
>
> Hi Mathias,
>
> I understand your point, But I want to understand how would completion handler be called
> if a command is timed out and xhci_abort_cmd_ring is successful. In this case all the code
> would be waiting on completion handler forever.
> 	
>
> 2. xhci_handle_command_timeout -> xhci_abort_cmd_ring(failure) -> xhci_cleanup_command_queue -> xhci_complete_del_and_free_cmd
>
> In our case command is timed out, Hence we hit the case #2 but xhci_abort_cmd_ring is success which
> does not calls complete.

xhci_abort_cmd_ring() will write CA bit (CMD_RING_ABORT) to CRCR register.
This will generate a command completion event with status "command aborted" for the pending command.
This event is then followed by a "command ring stopped" command completion event.

See xHCI specs 5.4.5 and 4.6.1.2

handle_cmd_completion() will check if cmd_comp_code == COMP_CMD_ABORT, goto event_handled, and call
xhci_complete_del_and_free_cmd(cmd, cmd_comp_code) for the aborted command.

If xHCI already processed the aborted command, we might only get a command ring stopped event, in this
case handle_cmd_completion() will call xhci_handle_stopped_cmd_ring(xhci, cmd), which will turn the
commands that were tagged for "abort" that still remain on the command ring to NO-OP commands.

The completion callback will be called for these NO-OP command later when we get a command completion event
for them.
  
>> What kernel version, and what xhci vendor was this triggered on?
>>
>
> We are using 4.1.8 kernel
>

Are you able to try a more recent version?

-Mathias

  reply	other threads:[~2016-03-21  9:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18  7:01 [PATCH] usb: xhci: Fix incomplete PM resume operation due to XHCI commmand timeout Rajesh Bhagat
2016-03-18 11:20 ` Mathias Nyman
2016-03-21  4:18   ` Rajesh Bhagat
2016-03-21  9:16     ` Mathias Nyman [this message]
2016-03-22  5:19       ` Rajesh Bhagat
2016-03-22 12:05         ` Mathias Nyman
2016-03-23  3:53           ` Rajesh Bhagat
2016-03-23 14:22             ` Mathias Nyman
2016-03-28  6:13               ` Rajesh Bhagat
2016-03-29 17:21                 ` Mathias Nyman
2016-03-31  3:51                   ` Rajesh Bhagat
2016-03-31 14:36                     ` Mathias Nyman
2016-04-01  3:55                       ` Rajesh Bhagat
2016-04-01 10:49                         ` Mathias Nyman
2016-04-11  3:46                           ` Rajesh Bhagat
2016-03-18 14:21 ` Alan Stern
2016-03-21  4:22   ` Rajesh Bhagat
2016-03-21 15:02     ` Alan Stern

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=56EFBBD1.6080600@intel.com \
    --to=mathias.nyman@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=rajesh.bhagat@nxp.com \
    --cc=sriram.dash@nxp.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