Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6333481pxb; Mon, 14 Feb 2022 23:18:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJww5BynTqb13kLaY+NnKAC0eq8L6PMfhEmidDHPIqXsJFtBaGjnzev8Gu3+xwDdRTTQxHle X-Received: by 2002:a17:907:2d0e:: with SMTP id gs14mr1812636ejc.225.1644909527827; Mon, 14 Feb 2022 23:18:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644909527; cv=none; d=google.com; s=arc-20160816; b=bb0fcX4uroWv4wpAlF72aZ1/I0eimooiStzLvhuqE9L90G8uP72j+AvgfF/5D9K2up dnUCX9vPXSc/UY4batvq/Ex13Vz+CsJAxDTipIbzzBhfrUTzgD9aziy3JG7VwQDf1dpW mGqldaOKU6HKhFH7NF2BnnMy52H1qcDA58kcgrIWKr/7Usv9b5Lz55lAdBsBWNzY/RBC AvZdOjeBkUPSaLmNXxUZ33r448M66rpp2tIZs2Tkwg+GcvwPMGqBvpTA1XvsLy3cg4HX tvLhf4LgUQkI8yqQjNQbbHPqwTNyCkwKhZSQLY1kYC4x1UOSvTGFVnHEYFOKkEqp8PZF DQsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:user-agent :in-reply-to:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=uYuVoc8TLG5pnyaXF/S+/Ss83yCwqhKJwuUxsFkXcD4=; b=Ztbzf4LwjT/we34ks8ja94T6FLtt//JUPiyzAQG3yEXBHruVMBTYCLKGR+2lo1Uecx KtAjadMlsL9mizJKV2h4K09p78F+jq76RneJrDzQ9mdrXxepRK7Gpce0O1fXhz4LK4dr EfTQkrpW/QYKzlIM1/NCu1g0slnwjhST6P5FiAF270g4mTK1X5CD4MsOi11JMQJXF19Q MgH9HcY3/9mEUYLMM1Zw5o+8TlMLYxM0qfKR1oOqN2qc3OqjQ31xijbJQbsh0k9Ke/63 +VEAH2biIQN3ZY8tJCJmypNnlxJX/nuET5Padgf19il2C9Q3IGdGnws5xhhNWxtgbEID E+YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=OZOGjYPb; 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=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs7si17329186ejc.395.2022.02.14.23.18.01; Mon, 14 Feb 2022 23:18:47 -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=@samsung.com header.s=mail20170921 header.b=OZOGjYPb; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230504AbiBOGmA (ORCPT + 99 others); Tue, 15 Feb 2022 01:42:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234597AbiBOGl7 (ORCPT ); Tue, 15 Feb 2022 01:41:59 -0500 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66268C1172 for ; Mon, 14 Feb 2022 22:41:50 -0800 (PST) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220215064147epoutp031fb19538c68513839883927a2ac4bdf0~T4nsiV2ta2458624586epoutp03L for ; Tue, 15 Feb 2022 06:41:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220215064147epoutp031fb19538c68513839883927a2ac4bdf0~T4nsiV2ta2458624586epoutp03L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1644907307; bh=uYuVoc8TLG5pnyaXF/S+/Ss83yCwqhKJwuUxsFkXcD4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OZOGjYPbRrM1u60ro5V+x1GJI2VYxsqRqqk667N16j9+bLu1bLE39wuNW7kX2+4TM 5w+46K9FrCP4IjF5dU9LubU6A6nuNASsSKEKUlkdRyejXaoFj3/c6CSSC+twaSAZQX w+so1Q/0jbwhUuytDQijuqPFg5SZlAi+7/FA2di4= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20220215064147epcas2p2ad99f62b76f65789911defc7de98304a~T4nsKogGf2025620256epcas2p2Y; Tue, 15 Feb 2022 06:41:47 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.69]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4JyWhm1XXqz4x9Q3; Tue, 15 Feb 2022 06:41:44 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 1A.52.35137.16A4B026; Tue, 15 Feb 2022 15:38:25 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20220215064139epcas2p4669383cd1a2937ce5884335856be457d~T4nlaJU6z2843428434epcas2p4N; Tue, 15 Feb 2022 06:41:39 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220215064139epsmtrp20c7fd16c90eb1427795db762e37dc096~T4nlYtDWi1742317423epsmtrp2D; Tue, 15 Feb 2022 06:41:39 +0000 (GMT) X-AuditID: b6c32a46-da1ff70000018941-18-620b4a612069 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 80.53.08738.32B4B026; Tue, 15 Feb 2022 15:41:39 +0900 (KST) Received: from ubuntu (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220215064139epsmtip14d824f0e0cbc8c6cd20bd524ae674f66~T4nlPr6Di1847318473epsmtip1k; Tue, 15 Feb 2022 06:41:39 +0000 (GMT) Date: Tue, 15 Feb 2022 15:39:25 +0900 From: Jung Daehwan To: Thinh Nguyen Cc: Felipe Balbi , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , open list , "quic_wcheng@quicinc.com" , "quic_jackp@quicinc.com" Subject: Re: [PATCH v2 1/2] usb: dwc3: Not set DWC3_EP_END_TRANSFER_PENDING in ep cmd fails Message-ID: <20220215063925.GC144890@ubuntu> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOJsWRmVeSWpSXmKPExsWy7bCmmW6iF3eSwcE1JhbH2p6wWzQvXs9m cXnXHDaLRctamS12/VvEZLFpdx+rxaoFB9gd2D02repk89g/dw27x8Q9dR5b9n9m9Pi8SS6A NSrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwfoCiWF ssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpOgXmBXnFibnFpXrpeXmqJlaGBgZEpUGFC dsadCZ+YCuZJVPTsvsDWwHhTuIuRk0NCwETi3/mnTF2MXBxCAjsYJW7f3MEI4XxilPi/4xAb SJWQwGdGiWsXA2A6eqZfhCraxSjxfksjK4TzhFGi4fBOsA4WAVWJN1c/MYLYbAJaEvd+nGAG sUUEdCQOnDgPto9ZYDm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x+9Y4RISEosnXuDHcIWlrjfcoQVougRo8SxfavAEiwCqhJvrn4Ca2AT0JK49+MEM4gtIqAj ceDEeSaQBmaBlUwSU7vmsoIkhAViJS5sa2MDsXmBiia1TGCGmNrLJLH+1ERWiISgxMmZT1hA bGagqTf+vQSaxAFkS0ss/8cBEuYUcJCY0PuCGSQsKqAi8epg/QRGwVlImmchaZ6F0LyAkXkV o2RqQXFuem6xYYFRXmq5XnFibnFpXrpecn7uJkZwDGhp7WDcs+qD3iFGJg7GQ4wSHMxKIrxx ZzmThHhTEiurUovy44tKc1KLDzFKc7AoifNe6DoZLySQnliSmp2aWpBaBJNl4uCUamDKYLP9 Oql3YtYdKdOEW73hXAfVd8lNemW5vdBnJ4PJpzdN5f29Yq0r+z8qduzk1VZgtPoUuM5Lep78 Fkdjb9FrqtbNmxTmf91dUj7ft4iRcVYyixrr+pnPJGOlBP5+4Tqo5nXQWnST1TTXe0L/62Zf jNtneH3bruD1XE4/Ol6wab+sYeX1LDytbHCvW2bXujt7SqPD1wl3d6/L9DCJmPzV4uapQ9VL n+efWh4TPnft440dzzwZzLae1tdStd6yfc3DkxOX5S2SYrTQe8Qhyvn4XtLE49f5HBbsSLGr 2Ko77+JRC8PfTY5rn59MzvT4KLq5KKloZUxnd+fEwv6f3h23Fj79lKHx+/x6pVyxFR+VWIoz Eg21mIuKEwFJTdE08AIAAA== X-CMS-MailID: 20220215064139epcas2p4669383cd1a2937ce5884335856be457d X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----.rW42XXn7_Ji6OxwuAF4RAMbP.qed.OeqKlvEhSLhB3noATS=_e8880_" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220214111149epcas2p1a1faeda037991885fd6f2f026fa44ec5 References: <1644836933-141376-1-git-send-email-dh10.jung@samsung.com> <1644836933-141376-2-git-send-email-dh10.jung@samsung.com> X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 ------.rW42XXn7_Ji6OxwuAF4RAMbP.qed.OeqKlvEhSLhB3noATS=_e8880_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Hi Thinh, On Mon, Feb 14, 2022 at 06:44:33PM +0000, Thinh Nguyen wrote: > Hi, > > Daehwan Jung wrote: > > It always sets DWC3_EP_END_TRANSFER_PENDING in dwc3_stop_active_transfer > > even if dwc3_send_gadget_ep_cmd fails. It can cause some problems like > > How does it fail? Timed out? Yes, timed out. > > > skipping clear stall commmand or giveback from dequeue. We fix to set it > > only when ep cmd success. Additionally, We clear DWC3_EP_TRANSFER_STARTED > > for next trb to start transfer not update transfer. > > We shouldn't do this. Things will be out of sync. It may work for 1 > scenario, but it won't work for others. > > Please help me understand a few things: > > 1) What is the scenario that triggers this? Is it random? > ep cmd timeout occurs on dequeue request from user side. End Transfer command would be sent in dwc3_stop_active transfer. > 2) Are there other traffics pending while issuing the End Transfer > command? If so, what transfer type(s)? > I haven't checked it yet. > 3) Have you tried increasing the timeout? > No, I haven't. > BR, > Thinh > This issue occurs very rarely on customer. I only have restricted information. That's why I've been trying to reproduce it. Wesley may have run into same issue and you can see this issue in detail. https://protect2.fireeye.com/v1/url?k=9d423b69-fc3fd32e-9d43b026-74fe485fff30-77a099b52659410d&q=1&e=20b4d9f5-2599-4f57-8b6a-7c4ec167d228&u=https%3A%2F%2Flore.kernel.org%2Flinux-usb%2F20220203080017.27339-1-quic_wcheng%40quicinc.com%2F Best Regards, Jung Daehwan > > > > > Signed-off-by: Daehwan Jung > > --- > > drivers/usb/dwc3/gadget.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > > index 183b90923f51..3ad3bc5813ca 100644 > > --- a/drivers/usb/dwc3/gadget.c > > +++ b/drivers/usb/dwc3/gadget.c > > @@ -2044,6 +2044,12 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, > > dwc3_gadget_move_cancelled_request(r, > > DWC3_REQUEST_STATUS_DEQUEUED); > > > > + /* If ep cmd fails, then force to giveback cancelled requests here */ > > + if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) { > > + dep->flags &= ~DWC3_EP_TRANSFER_STARTED; > > + dwc3_gadget_ep_cleanup_cancelled_requests(dep); > > + } > > + > > dep->flags &= ~DWC3_EP_WAIT_TRANSFER_COMPLETE; > > > > goto out; > > @@ -3645,7 +3651,7 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, > > > > if (!interrupt) > > dep->flags &= ~DWC3_EP_TRANSFER_STARTED; > > - else > > + else if (!ret) > > dep->flags |= DWC3_EP_END_TRANSFER_PENDING; > > } > > > ------.rW42XXn7_Ji6OxwuAF4RAMbP.qed.OeqKlvEhSLhB3noATS=_e8880_ Content-Type: text/plain; charset="utf-8" ------.rW42XXn7_Ji6OxwuAF4RAMbP.qed.OeqKlvEhSLhB3noATS=_e8880_--