Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp850672lqd; Wed, 24 Apr 2024 20:56:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUXPs1vC2rAUNMvZW4S3AQpfwbvOp8e4rgwLG7hUVzjHKRHcS+Ur/K3f1ftLjIVm8jDARka6Lw+jzYDvkCzhEHIWI0GbV5VJWMxbZirHw== X-Google-Smtp-Source: AGHT+IHWNx0sG88PXBj1fUr7XKXkhEQoQ3BItZufWe0cGsAXK8pL6TkXsSW3BGJMyPNw3WC4kDr3 X-Received: by 2002:a67:fd97:0:b0:47b:cd96:6d3d with SMTP id k23-20020a67fd97000000b0047bcd966d3dmr4900909vsq.3.1714017361800; Wed, 24 Apr 2024 20:56:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714017361; cv=pass; d=google.com; s=arc-20160816; b=Y6VmI2OMe/CSDUsw/uyBAjRC1i6cNT2IDZhTZ7vEh9Bo9GLCrlONuhp4Yvwsw2TWYB lye2fZSajkckRdRhYrufDUs1axOxSHiHlZz62Xk5EGZ0qWEIdxIlMsglo+HyWaYOrKys mOAYFuMNF6dgjp+bQjAjNDjSN+HtNcd1rb3egDqSbPu9Aa3IZxnmF7GXnYpdOxdSH1pZ 2qcG3PhjAgz26bEB5TA8JLTeqsLnKc6pl6t+5l1WLIk9LhWvd0ajraGN42ug0HngN5e4 SRx+WNnQBdCsQOfHXxwjhzDbqQ+Uluh1IQvElG3LQiW4piDUQIYRhfv6kEY+6NNMdXEp sFUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=EjulsxaA/iLKcO8IMu1Nnol3u4Ujnd7ckOcRYxy8ve0=; fh=EVvTzg4zyAkF2KygYnggmyojvz9REXjNol3m9x9OM+s=; b=iLWW+aFBVQbZX9+VyOe1aoh0llDDjaSmOVJP+zMlZnOOaBUVMHvOmAiQFULThmfXHv F90bXyQk7c5CxJ0U2eY0rozmgNJV0tEusMCj7wuvUyagC9bo9WZkLsA7Rflx5acG4wMn mZJIa4BeXI75C3JUejwqY6esK+h/P+qMaLE5PksVDjLi06h47GKEoPu8LLHABInnvIbT 6tZsdNyXkJvIZY3VfQYsMcGm1XDGw/IxxbW36SsHfS3pHcIWoOu0Ui/sGD47M2Lc84ek CrdW1g9hPf/eVgvJqQevswds++9EiKABWWgqxfsrE+B1hMZQSF5vp1wHiPGlF3fpCJB9 QWzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MU+Gu4oM; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-157981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157981-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g6-20020ac85806000000b00439dec18835si6484124qtg.631.2024.04.24.20.56.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 20:56:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MU+Gu4oM; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-157981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157981-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 788BE1C210A1 for ; Thu, 25 Apr 2024 03:56:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85E952C697; Thu, 25 Apr 2024 03:55:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MU+Gu4oM" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 633658468; Thu, 25 Apr 2024 03:55:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714017352; cv=none; b=PG6g+5ll1pzRsPSzkltk6Go3lI+XCF+gTpUlHm13Td145nvzapH0aV8BSgTI6bgMNpl9g6s0y2fmALJ/12cV/tp8Oe1e+A5q9xf1S87BO+7anjFfwO13n0xkYz59m2mN0cXW6k/sTWSbmIcrf8jKvKGkP8yUWMBrLxuFvp1IqG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714017352; c=relaxed/simple; bh=hEBhp3aA+qmWAFzbPmNzxTz2dCevz5xEmpYM2xZURXk=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=E4uy+fbR3EA3SKSe70NHl8NFuZ79E5ADsWflFV8clrEVN7ffQszr2qMdZuUMf8VE4DQVVYY1bv4imueBZ7seBkbZCP678ot9C9amq79mSJsdC5DAyY9zF/jUts3TJuDMuAvgf2vWJfi2BGPq6Ht6j054jIkAFdE3Tj95MWij9EQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=MU+Gu4oM; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43P3I4xB013632; Thu, 25 Apr 2024 03:55:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=EjulsxaA/iLKcO8IMu1Nnol3u4Ujnd7ckOcRYxy8ve0=; b=MU +Gu4oMU+R6u3By2CqVhzkUmDPUVQac/qy+STeMqIgfc6JJi+GxyrK6gZUN1/MYCR C10trD5wIEpToOMc/i1m8x3tmwmTl3Sb5sjUQ5qlsVuoTKyA/aUMvlwcxXlokiPJ KWzClVek3FscLIBl7a5430f3wURg0ZxNdXII3pWuIBjM+3Ijb4DP7no2n/9iqhGV DvO4e6PNaYxrLpmhXEk7Haf3CCnoD81P8zrB5Ow4GQeB6HmO1j8rK30rC2IGfpC9 P3VOu9VMhHIDQit+wKLpvlExI+nqtTu3yCBifprZkFdkBJjCZhtAlXxRRQwZ0tB+ SUuF0jGa7oh7LCvrOnvw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xqenmr49w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 03:55:48 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43P3tlmI006147 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 03:55:47 GMT Received: from [10.218.35.239] (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.1544.9; Wed, 24 Apr 2024 20:55:45 -0700 Message-ID: Date: Thu, 25 Apr 2024 09:25:42 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [RFC PATCH] usb: dwc3: Poll CMDACT after issuing EndXfer command Content-Language: en-US To: Thinh Nguyen CC: Greg Kroah-Hartman , Wesley Cheng , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" References: <20240422090539.3986723-1-quic_prashk@quicinc.com> <20240424013342.5itkoewx7jdonyk4@synopsys.com> <168904cd-4806-0473-085d-43df45efba65@quicinc.com> <20240424223618.utauunrz7nud5wfi@synopsys.com> From: Prashanth K In-Reply-To: <20240424223618.utauunrz7nud5wfi@synopsys.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: KnAmfMbjZNeXBw9m5Ex7Ob8Nxoe50088 X-Proofpoint-ORIG-GUID: KnAmfMbjZNeXBw9m5Ex7Ob8Nxoe50088 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-25_02,2024-04-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 mlxlogscore=966 bulkscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404250026 On 25-04-24 04:06 am, Thinh Nguyen wrote: > > Thanks for the data. > > Ok, I remember now why we did what we did. I just notice the Fixes > commit you tag: b353eb6dc285 ("usb: dwc3: gadget: Skip waiting for > CMDACT cleared during endxfer") > > I forgot that at one point we skip CMDACT for End Transfer command. > Let's not poll for CMDACT for End Transfer command and unconditionally > wait 1ms. Otherwise we may run into the issue being stuck with CMDACT > again while SETUP packet is not DMA out again. 1ms should be plenty of > time for the End Transfer command to complete. > > It should look like this: > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index f94f68f1e7d2..dad30c6ab19d 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -1724,8 +1724,7 @@ static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool int > dep->resource_index = 0; > > if (!interrupt) { > - if (!DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC3, 310A)) > - mdelay(1); > + mdelay(1); > dep->flags &= ~DWC3_EP_TRANSFER_STARTED; > } else if (!ret) { > dep->flags |= DWC3_EP_END_TRANSFER_PENDING; > > Thanks, > Thinh > > Ps. also please Cc stable. Thanks for the suggestion, I had tried 1ms initially when encountering the issue and it was helping. Then I thought that CMDACT polling was better approach. But anyways I echo you, having common solution for all controller revisions is the cleaner way. I'll send V2 with mdelay(1). Thanks again, Prashanth K