Received: by 2002:ac2:5a04:0:0:0:0:0 with SMTP id q4csp109741lfn; Wed, 16 Feb 2022 19:51:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMb2o5Q0c6q0/hx3r6iLbkXzny/jv1K1qbc63lmIxkvRx7BHX5X6RNSNPBVsH8VOulpBqg X-Received: by 2002:a17:902:6808:b0:14f:14e7:f3ad with SMTP id h8-20020a170902680800b0014f14e7f3admr1031393plk.73.1645069885236; Wed, 16 Feb 2022 19:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645069885; cv=none; d=google.com; s=arc-20160816; b=nw5u7285M2sIwiEQWMrli6lDiB6jwpMJz6T1Xn1Gbf/UezTxnp8FPtw75AARSR69aA pwwfdiIFfSxjz+JJr124cOZrPVoCGvmD/n+sSg4+OM0ATcQuUPQGIUCTN7s3jzjU4fhl 8kaV9Q3YFy0A/yy/wjgudTvec2wv6FfcObcdVFyMXsMmJf5fzR9w5Pdguc/XcX0lOP6r GpkZnkQGzW8Tj4mtS98FCUe1RUmBaWcAIwSbsv6wOlx43O8O2GzT+OXi0vcSDtXpUYf1 UFzaio7ccQpQ4c+pCgKU9whIqiZgB+Bn36ONkrtot2hj1a79OzwTMml3ApolGPrNEKN4 PwBA== 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=RhyL2jS7+HJqsAu/LNZglEPwWlKDeA0PnF0rf3RKWIE=; b=ZCXkIWmxHhe7WH8dz5iYvHeMlSDnUOSEpD/Nbfc6qzVgemNbIvoRsE1BVilBPrmKo0 6gpelI5W4TblgHWSkvn13Pur8QaGOSwlqpqbTsd9diLphz5F7Adsl0hxm5p7odOxEhSv 6q2w6I6ugXuD4HXGujRV0kIuK1alzE/BalX5zrNmWDjZ2uTaJhPG3bFUyMSh1dLegJYh aWAEtjmQsmC22eOP/w2DqGYA9zCqV2KEGD5NFvUrRBcti3YsV7HpLMu3z43CzyebY+SN TKpyPsB9U8EBOtHgQiCJ2pw+J27Jcxj7THVUh74/GT6TM0KzUhieCugwjI8tEAEIaPvj 1wCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=LBdqe75H; 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 z8si14906220plg.614.2022.02.16.19.51.08; Wed, 16 Feb 2022 19:51:25 -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=LBdqe75H; 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 S232320AbiBQDEF (ORCPT + 99 others); Wed, 16 Feb 2022 22:04:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbiBQDEE (ORCPT ); Wed, 16 Feb 2022 22:04:04 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA9523BF2B; Wed, 16 Feb 2022 19:03:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1645067031; x=1676603031; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=RhyL2jS7+HJqsAu/LNZglEPwWlKDeA0PnF0rf3RKWIE=; b=LBdqe75HzcKWXh88Tf03GMmhEx1yoOZUVua/ymKWjdh2u3f6gNg7uvzx lfQQOlA9D7yrp01Uad7EQgzAQtOeWHtotUwQ3cZ/UMFC8QE3ERhh7JwyM bPoMCz7/bpCOkfDE9OY0hbALJeMrnsaSShZkpdmNCqBCDnd5xSpMEU2P6 4=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 16 Feb 2022 19:03:51 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 19:03:51 -0800 Received: from nalasex01b.na.qualcomm.com (10.47.209.197) 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; Wed, 16 Feb 2022 19:03:50 -0800 Received: from hu-pkondeti-hyd.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Wed, 16 Feb 2022 19:03:47 -0800 Date: Thu, 17 Feb 2022 08:33:43 +0530 From: Pavan Kondeti To: Mathias Nyman CC: Pavan Kondeti , Greg Kroah-Hartman , Mathias Nyman , , , , Jung Daehwan , "Sergey Shtylyov" Subject: Re: [PATCH v2] xhci: reduce xhci_handshake timeout in xhci_reset Message-ID: <20220217030343.GA32039@hu-pkondeti-hyd.qualcomm.com> References: <1644836663-29220-1-git-send-email-quic_pkondeti@quicinc.com> <1644841216-1468-1-git-send-email-quic_pkondeti@quicinc.com> <20220214135310.GC31021@hu-pkondeti-hyd.qualcomm.com> <1b9e7641-2ae9-0f81-2ad9-18340d5e148f@linux.intel.com> <20220215104920.GE31021@hu-pkondeti-hyd.qualcomm.com> <20220215170718.GF31021@hu-pkondeti-hyd.qualcomm.com> <70ebdb8c-1ea5-1a3e-046e-5e457f54726d@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <70ebdb8c-1ea5-1a3e-046e-5e457f54726d@linux.intel.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 nalasex01b.na.qualcomm.com (10.47.209.197) 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 Mathias, On Wed, Feb 16, 2022 at 05:58:15PM +0200, Mathias Nyman wrote: > 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 > Thank you. I will look forward to your patch and provide the test results with it. Thanks, Pavan