Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp515262rdb; Tue, 19 Sep 2023 02:14:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAzWZd281GYlNppNyfcWWoPziVc7lgtkLsiUE56QR3hWhJQ9Mk+osnf98YYOra1avmCIUS X-Received: by 2002:a05:6358:428e:b0:134:c682:213f with SMTP id s14-20020a056358428e00b00134c682213fmr13183875rwc.31.1695114841239; Tue, 19 Sep 2023 02:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695114841; cv=none; d=google.com; s=arc-20160816; b=q7GCLseJprCVpsjUN6Mu/Gdi0+S7Qu6H+YRqv8De8+s3BF6NaNVWvo6lDUTpS/tTmU VX80BaGoBFJW9EGDcwc/gW2mmKd2dE+KgTX/zkNv3qDYq1o6BNgHS7Rkxunyh3xCnKXw oANSOmK/sQqpRDEIFdj8tX43XV2fmdb6y+ivCAyFWHOuLGt+QyqGBqy88Zxnl2IU3oUI Oq9n6JvvthoAysFagxAyuojUhW/iDJ6QzedNexXMpTPJ0eoAGYvXDU/NwC7/DpBL7woF Su1A2FzMHGxcMLh7nB/oTVNlDZjBzVoOLRODIrJP9PsbVmnLLgCsZ37vbKpxIYPP21JJ najg== 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=LR6ScKghf9T3/qsJ6CFe6J/jMk093RLyQ6+O0PD8UIQ=; fh=G5NYypDhPkywtC5h2fy2ozMIu7dszFDpryASaMSTCaQ=; b=tS6VnzXPleq0vOITphkkJZTCJd9eIXcx1leXdP03O7bc1H9HkxtsZL+cyASz3i8iMo UKOTMKHwV1SWP6f+Eq+0GnZeAbqHFPLGVUbIVel87rPAsIMQm4zuY7mc9MK0g3t8Tmyn 787nuwD/Lt/06akbeFJnsgAv4v5tzGYCt4H5Ar3ATIgqALAdYtm8PQnJmBXj3SFChm3q +q6uZDtbe9Qh0EaveJnUcZmlB+pBgGkh5g5+526shk9uL+WJP4Oes6WFx8RubVWuhksz t/pIxVwewflo4FrIjZG/HG7lJJA26dg0+1lfSuCD87YlEScSI3JrWL31TDfkSFou4gRM 8h2A== 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 x18-20020a63b212000000b0057795cb4f16si9467421pge.684.2023.09.19.02.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 02:14:01 -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 26EEF8083AEB; Tue, 19 Sep 2023 02:11:24 -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 S230145AbjISJLZ (ORCPT + 99 others); Tue, 19 Sep 2023 05:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbjISJLY (ORCPT ); Tue, 19 Sep 2023 05:11:24 -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 D255ABA for ; Tue, 19 Sep 2023 02:11:17 -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 1qiWkz-0005cz-Do; Tue, 19 Sep 2023 11:10:58 +0200 Received: from mgr by pty.whiteo.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiWkx-009bvA-FK; Tue, 19 Sep 2023 11:10:55 +0200 Date: Tue, 19 Sep 2023 11:10:55 +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="bRXcAQdk//FytMnP" Content-Disposition: inline In-Reply-To: <20221024224748.3aao6cox5y4ptmob@synopsys.com> 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:11:24 -0700 (PDT) --bRXcAQdk//FytMnP Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Thinh, 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? Regards, 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 | --bRXcAQdk//FytMnP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEElXvEUs6VPX6mDPT8C+njFXoeLGQFAmUJZZwACgkQC+njFXoe LGQ7Ig/9GozjAnT6NFjzYyTGvlTT7H0jEst0JphQh/9L5PKmA7UAUOdEGeV3WIss YtiyMhLdz/StZzXnLzhwk2DfO5pSMCoY+l5X8LnMj4zI7X+QHj/yxxdv+2sJ+tPV SJhHU2TRb+JI0tQ1Ec0rPOTIr+Ci41guOirc5xVnVYds26xsUJ8sHHw6fY4i5kNZ GRAI7yj4a/Fj8qWxVHOsAtlbTp3Zz+AW27qTbaupwVoLjEM59Mmi6JdxOjrIJEoL KyzlbsDgK99Lm3ghV/GebrCwv7U/qxVLVp5nxzQDzGv4g49u4VfXKUDG0deFG1bk H81vx2Z0KHbbwRX1lFb/xXDX/42mqmUOE25gZnZYfIzr7kPq4+pRiMi9DlL9fwBi zle2mfLbfEeCs2yofWeZKMPxaJMmBL2ylMXtGoODRf06IVTprM8uXNdadgJ/ahQA 7Vecv4L73p+ghQF5vWwY0hubGfijy7zrarheR7FLvxKDxdXUjTtaEfVF+vBgm+Zx SEUh9x2O9a5fTo2bQ4RFopMYV/DWfddlzIaup8OA6jsyyvZHEQ2YDCEPJOXvoTir 6/bpEaAnia5D+QPYiU5uBjsyZ0jFSfdr0qxhTtOxXge1/81ECsBT8LNaRVaHdtCv Ay8EQ+gjPMoaqESuRQXqY53wQ3RwApUdS8fF1PgpPtwTM4SpuGk= =PJ/C -----END PGP SIGNATURE----- --bRXcAQdk//FytMnP--