All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavan Kondeti <quic_pkondeti@quicinc.com>
To: Pavan Kondeti <quic_pkondeti@quicinc.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Jung Daehwan <dh10.jung@samsung.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<quic_ugoswami@quicinc.com>
Subject: Re: usb: host: Reduce xhci_handshake timeout in xhci_reset
Date: Fri, 11 Feb 2022 13:13:31 +0530	[thread overview]
Message-ID: <20220211074331.GA12625@hu-pkondeti-hyd.qualcomm.com> (raw)
In-Reply-To: <20220211064630.GA20567@hu-pkondeti-hyd.qualcomm.com>

Sorry for the spam. I have added an incorrect email address in my previous
email.

On Fri, Feb 11, 2022 at 12:16:30PM +0530, Pavan Kondeti wrote:
> On Mon, Jun 28, 2021 at 10:49:00AM +0300, Mathias Nyman wrote:
> > On 28.6.2021 9.55, Jung Daehwan wrote:
> > > On Mon, Jun 28, 2021 at 08:53:02AM +0200, Greg Kroah-Hartman wrote:
> > >> On Mon, Jun 28, 2021 at 11:25:48AM +0900, Jung Daehwan wrote:
> > >>> On Tue, Jun 22, 2021 at 09:56:20PM +0200, Greg Kroah-Hartman wrote:
> > >>>> On Tue, Jun 22, 2021 at 08:24:56PM +0900, Daehwan Jung wrote:
> > >>>>> It seems 10 secs timeout is too long in general case. A core would wait for
> > >>>>> 10 secs without doing other task and it can be happended on every device.
> > >>>>
> > >>>> Only if the handshake does not come back sooner, right?
> > >>>
> > >>> Yes, right.
> > >>>
> > >>>> What is causing your device to timeout here?
> > >>>
> > >>> Host Controller doesn't respond handshake. I don't know why and I ask HW team
> > >>> to debug it.
> > >>
> > >> Please work to fix your hardware, that feels like the root of the
> > >> problem here.  If you require the timeout for xhci_reset() to happen,
> > >> then how do you know that the hardware really did reset properly in the
> > >> reduced amount of time you just provided?
> > >>
> > > 
> > > I continue fixing this issue with hardware engineer, but currently just
> > > host controller can crash whole system and that's why I want to fix it.
> > > How about adding some error logs in this situation for recognizing this issue?
> > > We can add error log in xhci_stop as xhci_reset can returns error like below.
> > > 
> > > static void xhci_stop(struct usb_hcd *hcd)
> > > {
> > >         u32 temp;
> > >         struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> > > +       int ret;
> > > 
> > >         mutex_lock(&xhci->mutex);
> > > 
> > > @@ -733,6 +734,9 @@ static void xhci_stop(struct usb_hcd *hcd)
> > >         xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
> > >         xhci_halt(xhci);
> > >         xhci_reset(xhci);
> > > +       if (ret)
> > > +               xhci_err(xhci, "%s: Error while reset xhci Host controller - ret = %d\n"
> > > +                       , __func__, ret);
> > >         spin_unlock_irq(&xhci->lock);
> > > 
> > 
> > We can check the xhci_reset() return value here and print a message, makes sense.
> > 
> > The original reason for the 10 second timeout was because a host actually took 9 seconds:
> > 
> > commit 22ceac191211cf6688b1bf6ecd93c8b6bf80ed9b
> > 
> >     xhci: Increase reset timeout for Renesas 720201 host.
> >     
> >     The NEC/Renesas 720201 xHCI host controller does not complete its reset
> >     within 250 milliseconds.  In fact, it takes about 9 seconds to reset the
> >     host controller, and 1 second for the host to be ready for doorbell
> >     rings.  Extend the reset and CNR polling timeout to 10 seconds each.
> > 
> Agreed.
> 
> We also run into the similar issue (very very rarely reproduced) on
> our platforms like SM8450. The issue happens when host mode is de-activated
> (type-c cable disconnected). Since xhci_reset() is called with interrupts
> disabled, a timeout of 10 seconds is fatal to the system.
> 
> Thanks,
> Pavan

  reply	other threads:[~2022-02-11  7:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210622113915epcas2p284c61291fc9d83487f6dfebb65fd4e9b@epcas2p2.samsung.com>
2021-06-22 11:24 ` usb: host: Reduce xhci_handshake timeout in xhci_reset Daehwan Jung
2021-06-22 19:56   ` Greg Kroah-Hartman
2021-06-28  2:25     ` Jung Daehwan
2021-06-28  6:53       ` Greg Kroah-Hartman
2021-06-28  6:55         ` Jung Daehwan
2021-06-28  7:49           ` Mathias Nyman
2022-02-11  6:46             ` Pavan Kondeti
2022-02-11  7:43               ` Pavan Kondeti [this message]
2022-02-14  4:08                 ` Pavan Kondeti
2022-02-14  5:22                   ` Greg Kroah-Hartman
2022-02-14  5:52                     ` Pavan Kondeti

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=20220211074331.GA12625@hu-pkondeti-hyd.qualcomm.com \
    --to=quic_pkondeti@quicinc.com \
    --cc=dh10.jung@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=quic_ugoswami@quicinc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.