Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp517761rdb; Tue, 19 Sep 2023 02:19:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFV9OPm0YZvb6baxXJwrBV4+pDpP+AjfcrHuWNNsp5glnmRRDXeOmzyq/qPGlrRynkR1Gic X-Received: by 2002:a17:90a:17cb:b0:271:ae4f:dd12 with SMTP id q69-20020a17090a17cb00b00271ae4fdd12mr9262971pja.26.1695115195958; Tue, 19 Sep 2023 02:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695115195; cv=none; d=google.com; s=arc-20160816; b=NLUljk65Hw8oNr/UNFfdAvvMdQ+bL3bPOCJUA8ijV2lbTbvqlD2F50QwNJdXMvxs2E TTOrpF7K1AA3F5p55pR6Fhc55+D6R75AJYousAi53XOwGDxqO3dk9n7PngXP8GGeskTK zNaIDLKPjkg+SMnxH3biv9io/JVWLtiUbTENup3RHPFbF11O9YCZjp8RXxyufUp0otPx iDbdjTP9Kwlb+RQulNKCI5SRQ59JjEc4MV1ftWXe+9VvW0F0EsOV0l3Khf4mAensnrQp Nw6e01K/MtdNIl+eywERcvUM+RZh0tdD2LjgpJK70+Xm7IgOZCiVOJs8m85dwBdJkUYD JEig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:in-reply-to:content-disposition :mime-version:references:message-id:cc:to:from:date; bh=bz/E0qckE2BPYPZdzraOHnkUoJyiJvr/6TR6Ng0QD+E=; fh=G5NYypDhPkywtC5h2fy2ozMIu7dszFDpryASaMSTCaQ=; b=hnnzFHtjaT6VacRTPHBmJQctz7xgkiXi+VrHpP0Jn56qN+SFIA7g+hNJg5Oj9gRxLx cMe8SQl5zaejoJehptmxhDWUocvKjAPEGfmf9aIJJEN8/kAuChsNrbF7KkhxvYLeShJ/ 9tJ3aPoHi8AJ2k4ooMd7cMN1LnKfVpeFqs2Bdq/W5kN6AraFiUAVHzVC02UYZ/Ra6cqQ bLZixOc7/SRIDFDnbg1ECwvnKOQimmmsuv255Gk67T27+liYXjDNsBzfKFpQX+HR5BZL 3WSGmFkAlDox3PMNg3z8eWTczeu++NYDJJXURM/bxoxKmHrQWFJumx3IHvIzrpkzki4N 2N5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ng8-20020a17090b1a8800b0025eeb3cc4b2si10049538pjb.9.2023.09.19.02.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 02:19:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id DDA87833965A; Tue, 19 Sep 2023 02:18:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231273AbjISJSd (ORCPT + 99 others); Tue, 19 Sep 2023 05:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbjISJS1 (ORCPT ); Tue, 19 Sep 2023 05:18:27 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6BEA100 for ; Tue, 19 Sep 2023 02:18:20 -0700 (PDT) Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qiWrw-0008AB-7P; Tue, 19 Sep 2023 11:18:08 +0200 Received: from mgr by pty.whiteo.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiWru-009c0Q-E5; Tue, 19 Sep 2023 11:18:06 +0200 Date: Tue, 19 Sep 2023 11:18:06 +0200 From: Michael Grzeschik To: Thinh Nguyen Cc: Jeff Vanhoof , Greg Kroah-Hartman , Dan Vacura , "linux-usb@vger.kernel.org" , Daniel Scally , Jeff Vanhoof , "stable@vger.kernel.org" , Jonathan Corbet , Laurent Pinchart , Felipe Balbi , Paul Elder , "linux-kernel@vger.kernel.org" , "linux-doc@vger.kernel.org" Message-ID: References: <20221018215044.765044-1-w36195@motorola.com> <20221018215044.765044-3-w36195@motorola.com> <20221022133541.GA26431@qjv001-XeonWs> <20221024224748.3aao6cox5y4ptmob@synopsys.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sr2zawqPPoJoClMC" Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:2:b01:1d::c5 X-SA-Exim-Mail-From: mgr@pengutronix.de X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Subject: Re: [PATCH v4 2/6] usb: dwc3: gadget: cancel requests instead of release after missed isoc X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 19 Sep 2023 02:18:42 -0700 (PDT) --sr2zawqPPoJoClMC Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 19, 2023 at 11:10:55AM +0200, Michael Grzeschik wrote: >On Mon, Oct 24, 2022 at 10:47:53PM +0000, Thinh Nguyen wrote: >>On Sat, Oct 22, 2022, Jeff Vanhoof wrote: >>>Hi Greg, >>> >>>On Sat, Oct 22, 2022 at 01:31:24PM +0200, Greg Kroah-Hartman wrote: >>>> On Tue, Oct 18, 2022 at 04:50:38PM -0500, Dan Vacura wrote: >>>> > From: Jeff Vanhoof >>>> > >>>> > arm-smmu related crashes seen after a Missed ISOC interrupt when >>>> > no_interrupt=3D1 is used. This can happen if the hardware is still u= sing >>>> > the data associated with a TRB after the usb_request's ->complete ca= ll >>>> > has been made. Instead of immediately releasing a request when a Mi= ssed >>>> > ISOC interrupt has occurred, this change will add logic to cancel the >>>> > request instead where it will eventually be released when the >>>> > END_TRANSFER command has completed. This logic is similar to some of= the >>>> > cleanup done in dwc3_gadget_ep_dequeue. >>>> > >>>> > Fixes: 6d8a019614f3 ("usb: dwc3: gadget: check for Missed Isoc from = event status") >>>> > Cc: >>>> > Signed-off-by: Jeff Vanhoof >>>> > Co-developed-by: Dan Vacura >>>> > Signed-off-by: Dan Vacura >>>> > --- >>>> > V1 -> V3: >>>> > - no change, new patch in series >>>> > V3 -> V4: >>>> > - no change >>>> >>>> I need an ack from the dwc3 maintainer before I can take this one. >>>> >>>> thanks, >>>> >>>> greg k-h >>> >>>Thinh has rejected this version of the patch. He has provided an alterna= tive >>>implementation which has been testing well for us so far. Either Thinh o= r Dan >>>will formalize this patch within the next few days. >>>The latest proposed changes are: >>> >>>diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >>>index dfaf9ac24c4f..50287437d6de 100644 >>>--- a/drivers/usb/dwc3/gadget.c >>>+++ b/drivers/usb/dwc3/gadget.c >>>@@ -3195,6 +3195,9 @@ static int dwc3_gadget_ep_reclaim_completed_trb(st= ruct dwc3_ep *dep, >>> if (event->status & DEPEVT_STATUS_SHORT && !chain) >>> return 1; >>> >>>+ if (DWC3_TRB_SIZE_TRBSTS(trb->size) =3D=3D DWC3_TRBSTS_MISSED_IS= OC && !chain) >>>+ return 1; >>>+ >>> if ((trb->ctrl & DWC3_TRB_CTRL_IOC) || >>> (trb->ctrl & DWC3_TRB_CTRL_LST)) >>> return 1; >>>@@ -3211,6 +3214,7 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dw= c3_ep *dep, >>> struct scatterlist *s; >>> unsigned int num_queued =3D req->num_queued_sgs; >>> unsigned int i; >>>+ bool missed_isoc =3D false; >>> int ret =3D 0; >>> >>> for_each_sg(sg, s, num_queued, i) { >>>@@ -3219,12 +3223,18 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct = dwc3_ep *dep, >>> req->sg =3D sg_next(s); >>> req->num_queued_sgs--; >>> >>>+ if (DWC3_TRB_SIZE_TRBSTS(trb->size) =3D=3D DWC3_TRBSTS_M= ISSED_ISOC) >>>+ missed_isoc =3D true; >>>+ >>> ret =3D dwc3_gadget_ep_reclaim_completed_trb(dep, req, >>> trb, event, status, true); >>> if (ret) >>> break; >>> } >>> >>>+ if (missed_isoc) >>>+ ret =3D 1; >>>+ >>> return ret; >>> } >>> >>> >> >>That's just a debug patch. I'll send out proper fix patches. > >Ping! > >While digging out this thread, I did not find any followup patch >for this suggestion. Did it hit the mailinglist anywhere? > >If not, will you send one? Nevermind, I think I found the hunk in a variated version in this series. https://lore.kernel.org/linux-usb/cover.1666735451.git.Thinh.Nguyen@synopsy= s.com/ Michael --=20 Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --sr2zawqPPoJoClMC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEElXvEUs6VPX6mDPT8C+njFXoeLGQFAmUJZ0gACgkQC+njFXoe LGSIIBAAhZlRUqMeCB683Wh9mhpH9TldcDgLVwYvLrbgjA369sDRvnp0Bq/UHunS Y6GxMg6NU2hZCF21Fo5KT7KOJcaBzU5oKmMsuaEGIpPEKekdglBmhtzNzWwZ6b3w kC+D+AaG3dF1QZDc1Wr2FK7uV2y4qHRqecTXFfKNJYAl/hRNSzz/lsNsbiW3Rcu/ 8j5C7FnlW8AB1SB6MNrQkYhMlJpS54pcnvJGSTj66Unotet1Qjc5VALiDnJlvBlw M0BdZy+vhOXyjpNshOe+vwujXKwIYz3gLcg8F4SyCY2p22BoiWGMrq/b5oviBuwT CwfjO0R/W0V5A11TEHeqd480M/3EUHhiwPVzepxHCBeplCSL8xMAmvPc/aaWdlov F3YbEeEe7m1WRGbiyiFvJyZQJrsLHwJEdcGwNrbjCgYBQlAlIpG8rH0VLgxavDg+ 8/8vOgCxbU1wFXy8z5gL3j1bilnuYH80DrBC/x8+/Or5NpmjiRCLGl1OpRtlS04l sgb9HJBn1poXrhrT7/gheQba7NszcUVlZlhMolo5KJ6xdceAYESsGw0rUo8r2DfG UxId9xPb9FlPbsV9e78Rukiri3Zzj5n27okY24RmcLOLR5m2a+Ha0D0qH7sbcbrR tqqH3uRag5Z02JPbNzOUTqPQpt/5ezXdygoAZi49IrZSajPQUA4= =bEGO -----END PGP SIGNATURE----- --sr2zawqPPoJoClMC--