Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp289112imw; Tue, 12 Jul 2022 20:19:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uwZorwU8P1ekQu77peYojFWMLtM2F4M+6rGIT4BXZFqQcI0f+uyPLAqfH1l2wIPu+LU40d X-Received: by 2002:a17:906:8a70:b0:72b:132b:1720 with SMTP id hy16-20020a1709068a7000b0072b132b1720mr1329657ejc.41.1657682398121; Tue, 12 Jul 2022 20:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657682398; cv=none; d=google.com; s=arc-20160816; b=rh7BgzhgfAHwcRgQy4jRayKtXFm1cWJ7xoFi0GA9psHxphD5BURApy7o8A9nJVw2vQ Ruevy+/tlINkENCzrOA1QwvnkUMZVKXRw7bGSq6fXCgkzoIcxMj86gXWa/no2zE1R5kF Lz7XHzXxn4KF9LMRTz1tJS4rv+1FJfpr0fYrscEs7xglskk0s/D2pgvyfB+jkShppwNL zsx1JCcXIy0StE4Y+CYySiD7I7EFKg3uBcI/YDieCcVIDsN6W3okYC1l2uObWZd3eXGm I5HcOYUCbBDj+nobdmxi+7GqNDwW/Ll7CASaj0PgD2vE4vSOB3Hkp90XNg/cDQRUijlB FHiA== 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=j+pIU+Vim4PMSxlEaF3xva7X5PqjxMIjOw7jLEzSTsU=; b=CSA040KFQDgAU8SWfORqK7CZmMLRGks7SGVfW1dnaACzgyyr3WU3pqbwI05xnmdTgN JuxHKJ6tqLgO3GMUSXM1caASFb1G7GsU1H6IoSxSG7ArPLH5gH8518HOw0w6gEz7kseS bP5F5lnjdIJb/2XRZkA0iIoqB8yGO+OiU6T96MQyb+HGJODKTQ3dasYThiYwZPtkNCDe uQchExE2I7DNjCLTPB2QD0ZGqlCA50n5LQnQSmJl/UN5LF5QjUfsV7sqv+LcL0suG84J Mq34bYbMVetx4bplHczi5IcFDsr0dUeUafym9tXECNIoLCU0WwBfQJnrLFLXmFt+2pLi 9spw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=cmykBuR6; 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 g16-20020a50ec10000000b00437dc92e8basi14827383edr.368.2022.07.12.20.19.13; Tue, 12 Jul 2022 20:19:58 -0700 (PDT) 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=cmykBuR6; 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 S233538AbiGMC4v (ORCPT + 99 others); Tue, 12 Jul 2022 22:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233634AbiGMC4r (ORCPT ); Tue, 12 Jul 2022 22:56:47 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB12D64D7; Tue, 12 Jul 2022 19:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1657681006; x=1689217006; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=j+pIU+Vim4PMSxlEaF3xva7X5PqjxMIjOw7jLEzSTsU=; b=cmykBuR6rAfi1BkTf6UhoatwBC6RVRou7GeU4yYsI6zXQDpUxd2rg9H4 DRLKBv5YE6McwJafsmcD6B7VmWZuItwS7Tq6mR3fUa9u+bKnZ5g55N2Xz /1QrZNJUCb92ctvKBseFi3S92wTqZa6nbHgEhnaH9xSYSN1UxSSvflLo+ c=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-01.qualcomm.com with ESMTP; 12 Jul 2022 19:56:46 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2022 19:56:45 -0700 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.22; Tue, 12 Jul 2022 19:56:45 -0700 Received: from jackp-linux.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.986.22; Tue, 12 Jul 2022 19:56:44 -0700 Date: Tue, 12 Jul 2022 19:56:43 -0700 From: Jack Pham To: Wesley Cheng CC: , , , , Subject: Re: [PATCH v2 5/5] usb: dwc3: gadget: Increase DWC3 controller halt timeout Message-ID: <20220713025643.GC8200@jackp-linux.qualcomm.com> References: <20220713003523.29309-1-quic_wcheng@quicinc.com> <20220713003523.29309-6-quic_wcheng@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220713003523.29309-6-quic_wcheng@quicinc.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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 Wesley, On Tue, Jul 12, 2022 at 05:35:23PM -0700, Wesley Cheng wrote: > Since EP0 transactions need to be completed before the controller halt > sequence is finished, this may take some time depending on the host and the > enabled functions. Increase the controller halt timeout, so that we give > the controller sufficient time to handle EP0 transfers. > > Fixes: 861c010a2ee1 ("usb: dwc3: gadget: Refactor pullup()") > Suggested-by: Thinh Nguyen > Signed-off-by: Wesley Cheng > --- > Link: > https://lore.kernel.org/linux-usb/4988ed34-04a4-060a-ccef-f57790f76a2b@synopsys.com/ > > drivers/usb/dwc3/gadget.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index 41b7007358de..e32d7293c447 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -2476,6 +2476,7 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend) > dwc3_gadget_dctl_write_safe(dwc, reg); > > do { > + msleep(1); Be aware that this probably won't sleep for *just* 1ms. From Documentation/timers/timers-howto.rst: msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range). In many cases this is not the desired behavior. So with timeout==500 this loop could very well end up iterating for up to 10 seconds. Granted this shouldn't be called from any atomic context but just wanted to make sure that the effective increase in timeout as $SUBJECT intends is made clear here and that it's not overly generous. > reg = dwc3_readl(dwc->regs, DWC3_DSTS); > reg &= DWC3_DSTS_DEVCTRLHLT; > } while (--timeout && !(!is_on ^ !reg)); Jack