Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1738631ybb; Sun, 29 Mar 2020 12:07:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu0TvpWpOjR4Plymf11Vgh3MV8Gj59wIafHlEgblDckpNYTwk0dnuZK9rKu1eSdsOP0UrXe X-Received: by 2002:a9d:6e02:: with SMTP id e2mr6785729otr.317.1585508863747; Sun, 29 Mar 2020 12:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585508863; cv=none; d=google.com; s=arc-20160816; b=pROdFCAgfJjSBh40bUvyrXcnGuwNdjA6vlX7Jkk5UENz5Wvci3xDTUtqXZCAx2URh/ fe1GRL/2RPAOmCi5iqkwSzHE+Wb4jxL41tk0R/ZpBAnGq34+X/P2H8D+TBR57h+sMK5I L2GKIjPD6V+LAovf8AKIqfW6/qeKTj3GqLMqEtz/UbI6ONM6pIX7H0cuwCNr6gLzq+om H5q8ZFtoxTTavle6aTkso2Kb94qm3Hy2EwDNPT+7dyrvKJXkGgQ8GuLSS+ZacmSobrtl Ai1J3JHZieOaAi+bhxfvGh71eZ/8Cufx0Md48LY8LjFpM1jRjicXbFWO2b5QjYfzWylJ nMsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=M0wrX46S7X15DH3emfoazWlJKWSI0j6/8fLpmcdXv84=; b=tG4ei8hS5Wsms5AYOSSGeVUza+7Ui5JXo2n7s7qd56BIf6fZxMuddSORAjFgu78gou SzKdSLB1lXOVMQY9Tc2dDEnLpo77bE3CeDEM/06UVAXpQBruapohQ5p3uY5bNpjGAkxr xVwG8mBATLcSK9xpbQhDVlnJj4BMFs2uckVRNUhWQ5pxADnw9N50tNzpyER+OruqWBb9 agnd2gs7B74NV8yWjYY1KV1FBblBhffiGrTNpbhhx12rRYUEUJ/4PubmPirPmrMdAF7l rbpuZ9VNymCNNPbylYAEC3o8O+UmcX4AtSCIaA4hd/niDasCNmHJ4ZVof3qQ3uChRCbh BqCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j192si4843843oih.233.2020.03.29.12.07.31; Sun, 29 Mar 2020 12:07:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbgC2TCz (ORCPT + 99 others); Sun, 29 Mar 2020 15:02:55 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:60165 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728316AbgC2TCz (ORCPT ); Sun, 29 Mar 2020 15:02:55 -0400 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIdCr-00046Z-5E; Sun, 29 Mar 2020 21:02:49 +0200 Received: from mgr by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1jIdCm-0006jm-AW; Sun, 29 Mar 2020 21:02:44 +0200 Date: Sun, 29 Mar 2020 21:02:44 +0200 From: Michael Grzeschik To: Felipe Balbi Cc: lars@metafoo.de, alexandru.Ardelean@analog.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, bigeasy@linutronix.de, m.olbrich@pengutronix.de, kernel@pengutronix.de Subject: Re: [PATCH] usb: dwc3: gadget: don't dequeue requests on already disabled endpoints Message-ID: <20200329190244.GK27849@pengutronix.de> References: <20200327084302.606-1-m.grzeschik@pengutronix.de> <875zeokhoa.fsf@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mhjHhnbe5PrRcwjY" Content-Disposition: inline In-Reply-To: <875zeokhoa.fsf@kernel.org> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 20:52:30 up 39 days, 2:22, 58 users, load average: 0.13, 0.15, 0.11 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mgr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --mhjHhnbe5PrRcwjY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 28, 2020 at 10:27:49AM +0200, Felipe Balbi wrote: >=20 > Hi, >=20 > Michael Grzeschik writes: > > dwc3_gadget_ep_disable gets called before the last request gets > > dequeued. > > > > In __dwc3_gadget_ep_disable all started, pending and cancelled > > lists for this endpoint will call dwc3_gadget_giveback in > > dwc3_remove_requests. > > > > After that no list containing the afterwards dequed request, > > therefor it is not necessary to run the dequeue routine. > > > > Signed-off-by: Michael Grzeschik > > --- > > @Lars-Peter Clausen: > > > > This patch addresses the case that not queued requests get dequeued. > > The only case that this happens seems on disabling the gadget. > > > > drivers/usb/dwc3/gadget.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > > index 9a6f741d1db0dc..5d4fa8d6c93e49 100644 > > --- a/drivers/usb/dwc3/gadget.c > > +++ b/drivers/usb/dwc3/gadget.c > > @@ -1609,6 +1609,9 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *= ep, > > =20 > > trace_dwc3_ep_dequeue(req); > > =20 > > + if (!(dep->flags & DWC3_EP_ENABLED)) > > + return 0; >=20 > which driver is trying to call dequeue after the endpoint is disabled? > Got some tracepoints of the problem happening? I see the case when using uvc-gadget. Look into uvc_v4l2_release in uvc_v4l2.c: uvc_function_disconnect composite_disconnect reset_config uvc_function_disable->usb_ep_disable uvcg_video_enable usb_ep_dequeue dwc3_gadget_ep_dequeue 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 | --mhjHhnbe5PrRcwjY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEElXvEUs6VPX6mDPT8C+njFXoeLGQFAl6A8NEACgkQC+njFXoe LGQ0Fw/+L4PbKGZHpzrxaBgwG1dm6EU0lA3n6u3ux58FXsiXsYDXbwuzWBCgPpwJ xYN743ySqpShHXwsdt0z1wVYOqYy9BEtMWaUO6Ln62gwgSsHDKVZPdX182YcA2dv WBtgJaGdUNbIC+4Ea5QVuPBhw0LCBxoZNQ1Mm+QdjIcDWv5O8mt5ljjJEetu4M2o kc3Ejo2j9qlow9NLkPtrSYCim2Muopwtsh50mUOgZlrn28a3C8gW4ojFVlEqAPLU ru28cD7xiiyqWAaYa7Y4hsw06pd/PndtqJt9YEbv7QLIvxFpxmMDiJagEH2UWjY4 ZjjyhWn1Ou8FztMuCvj6Jkqh7gxgVjhKmAo3/n4jnEW+MKDqrqbAcDjE7PnV/dqf WmRMaQCFDmvczaVlTtIP82Wo9jzc068KLfyexun0X9qb2Up+ewXVezEFeKAwSHtv z+PimwJcW5YLryJlvwiQEXew3ymLInsQbTCE4JU3mJjq2z4vVGTH/x1iQcXD4YXP 7PWDVKUokGFAGeLTPc7ZrlnhuIOBd5Uv7EMk6mwMoohITPqatZ0Zwdyq5YNcgz3f pLt6XKvU/Xl8yp/nu5YDRHmse/cEMApp2RYSfBakb7+vKQVDp8Hh/PAa7qrenPqm xZmIkQHQkNdc3AfE7i5vjhgxbaYIrolJH9GTVEkWeyahgC8o2dw= =FcUx -----END PGP SIGNATURE----- --mhjHhnbe5PrRcwjY--