Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5586002pxb; Mon, 14 Feb 2022 02:43:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKqXgJgHq41HE1zGo8mVghCTJk+vBvIuipSdEqWbpH1mT9hJMvJ6BZIXXlh0kjOHgHdmCM X-Received: by 2002:a17:902:e749:: with SMTP id p9mr2314856plf.46.1644835390360; Mon, 14 Feb 2022 02:43:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644835390; cv=none; d=google.com; s=arc-20160816; b=FgAJ/mRIRPFpGxZRNtZYTnA1dd5Xo5SVfo3lYnnPWhKSa7wB4w8ccrHWhxUijF0Nxn gVOv4bNohG2eCEb+jgT/EouoGffX2fo0DaDNUznuq+T7jH9FzMAOmw8JRh1tL3nTALIe JECizZL+UrYejhCXA3xyXyEXPRetG0d+jIrxRFIf62rfsutiaeqTdwfiVfMnU03Us/fY DtiEGup0iqBCMec5PuSp3Upj5M6Py2fwIwIt87qOGPxehfVFrxvt3p7gj0hof1RxjU1l MTye1Idxv0jwNgveXUEzKCS5IOjpQyQgFeak4NtCEBG24PaRAkK/CUpuTS1OBDyPiWQZ i8Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=u+W1tN9usZWjsj5/mAQPYbtm+xXSxWfMP0GXHrsmeik=; b=vCtOOXWpCsuCIpOkiqs+MZQXcCoq3YmIFe9mpnilp3LSDZa3LVHlGWz+Au1GP/nRuG LsKU/o2GLkyp3z7kpLzeH/vuvkAYwDMDJP8O9we0YEKHFEpOyNiY981zvJnp4DZ057MT nypq1i06ZMjBP1PMqTTkD4LH269IcBHqm3FUENF5E1H4KYeseXyh/PtE6MZFWvU0Q/8Z dVzo2cjQ13yyV6cihlZqYFjIsYz6D8TMAVF9LGdgXF01CKbWC43r1xvH5ci6VyflI597 SijYRnCJh1+YyLghlNni/5pBtebQ4x9+rdW3OqJnr0sI1yomdDy5NWW+DNejboG1MLAT GgIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=oomvviUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q124si28045496pgq.183.2022.02.14.02.42.56; Mon, 14 Feb 2022 02:43:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=oomvviUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240176AbiBNEIy (ORCPT + 99 others); Sun, 13 Feb 2022 23:08:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbiBNEIx (ORCPT ); Sun, 13 Feb 2022 23:08:53 -0500 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B004EA3F; Sun, 13 Feb 2022 20:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1644811726; x=1676347726; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=u+W1tN9usZWjsj5/mAQPYbtm+xXSxWfMP0GXHrsmeik=; b=oomvviUnZgpSLb/Px2S6ydX6siTh9GmAOGB+kb3HJdTHYelRywb/vm9F s4ZcwSCfDC4n0X2KXdj/zx/+qLb7gIfavLHSPc8vbS2V7W79Yh2SbT/7L SGElqIvZY+6qaytmfrWaS9KK1C4Tpzf6D18NZLWKYkBfXHUgNb1IM8A7i M=; Received: from ironmsg09-lv.qualcomm.com ([10.47.202.153]) by alexa-out.qualcomm.com with ESMTP; 13 Feb 2022 20:08:46 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg09-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2022 20:08:45 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Sun, 13 Feb 2022 20:08:45 -0800 Received: from hu-pkondeti-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Sun, 13 Feb 2022 20:08:42 -0800 Date: Mon, 14 Feb 2022 09:38:38 +0530 From: Pavan Kondeti To: Pavan Kondeti CC: Mathias Nyman , Jung Daehwan , Greg Kroah-Hartman , , , Subject: Re: usb: host: Reduce xhci_handshake timeout in xhci_reset Message-ID: <20220214040838.GA8039@hu-pkondeti-hyd.qualcomm.com> References: <1624361096-41282-1-git-send-email-dh10.jung@samsung.com> <20210628022548.GA69289@ubuntu> <20210628065553.GA83203@ubuntu> <496c9d86-70d7-1050-5bbb-9f841e4b464a@intel.com> <20220211064630.GA20567@hu-pkondeti-hyd.qualcomm.com> <20220211074331.GA12625@hu-pkondeti-hyd.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220211074331.GA12625@hu-pkondeti-hyd.qualcomm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On Fri, Feb 11, 2022 at 01:13:31PM +0530, Pavan Kondeti wrote: > 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. Can you please consider including this change? Let us know if you want this patch to be resent again with error message and Fixes tag included. Thanks, Pavan