From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Pavan Kondeti <quic_pkondeti@quicinc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathias Nyman <mathias.nyman@intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
quic_ugoswami@quicinc.com, Jung Daehwan <dh10.jung@samsung.com>,
Sergey Shtylyov <s.shtylyov@omp.ru>
Subject: Re: [PATCH v2] xhci: reduce xhci_handshake timeout in xhci_reset
Date: Wed, 16 Feb 2022 17:58:15 +0200 [thread overview]
Message-ID: <70ebdb8c-1ea5-1a3e-046e-5e457f54726d@linux.intel.com> (raw)
In-Reply-To: <20220215170718.GF31021@hu-pkondeti-hyd.qualcomm.com>
On 15.2.2022 19.07, Pavan Kondeti wrote:
>>>>
>>>> The crash reports I have seen are pointing to
>>>>
>>>> usb_remove_hcd()->xhci_stop()->xhci_reset()
>>>
>>> Ok, so xhci_stop() and xhci_shutdown() both may call xhci_reset() with interrupts
>>> disabled and spinlock held. In both these cases we're not that interested in the
>>> outcome of xhci_reset().
>>>
>>> But during probe we call xhci_reset() with interrupts enabled without spinlock,
>>> and here we really care about it succeeding.
>>> I'm also guessing reset could take a longer time during probe due to possible recent
>>> BIOS handover, or firmware loading etc.
>>>
>>> So how about passing a timeout value to xhci_reset()?
>>> Give it 10 seconds during probe, and 250ms in the other cases.
>>>
>>
>> Thanks for this suggestion.
>>
>> This sounds better compared to the quirks approach. xhci_resume() also seems
>> to be calling xhci_reset() in the hibernation path, I believe we should treat
>> this like probe()/startup case and give larger timeout.
>>
> I will test the below patch as per Mathias suggestion.
>
> Thanks,
> Pavan
>
> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
> index df3522d..031fe90 100644
> --- a/drivers/usb/host/xhci-hub.c
> +++ b/drivers/usb/host/xhci-hub.c
> @@ -762,7 +762,7 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci)
> }
> pm_runtime_allow(xhci_to_hcd(xhci)->self.controller);
> xhci->test_mode = 0;
> - return xhci_reset(xhci);
> + return xhci_reset(xhci, false);
Maybe just pass the timeout value directly to xhci_reset().
Looks like readl_poll_timeout_atomic() uses u64 for timeout_us,
makes sense to use the same.
Sergey also pointed out xhci_handshake() incorrectly uses a signed integer for timeouts.
This could be changed to u64 as well.
I'll write a patch that does all above
-Mathias
next prev parent reply other threads:[~2022-02-16 16:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 11:04 [PATCH] xhci: reduce xhci_handshake timeout in xhci_reset Pavankumar Kondeti
2022-02-14 11:36 ` Greg Kroah-Hartman
2022-02-14 12:17 ` Pavan Kondeti
2022-02-14 12:20 ` [PATCH v2] " Pavankumar Kondeti
2022-02-14 12:29 ` Greg Kroah-Hartman
2022-02-14 13:19 ` Pavan Kondeti
2022-02-14 12:51 ` Mathias Nyman
2022-02-14 13:53 ` Pavan Kondeti
2022-02-15 8:51 ` Jung Daehwan
2022-02-15 9:43 ` Oliver Neukum
2022-02-15 10:16 ` Mathias Nyman
2022-02-15 10:49 ` Pavan Kondeti
2022-02-15 17:07 ` Pavan Kondeti
2022-02-16 15:58 ` Mathias Nyman [this message]
2022-02-16 16:44 ` Sergey Shtylyov
2022-02-17 3:03 ` Pavan Kondeti
2022-02-14 15:45 ` [PATCH] " Sergei Shtylyov
2022-02-15 3:38 ` 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=70ebdb8c-1ea5-1a3e-046e-5e457f54726d@linux.intel.com \
--to=mathias.nyman@linux.intel.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_pkondeti@quicinc.com \
--cc=quic_ugoswami@quicinc.com \
--cc=s.shtylyov@omp.ru \
/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