linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Dan Scally <dan.scally@ideasonboard.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	linux-usb@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: dwc3 38100000.usb: No resource for ep1in
Date: Sun, 11 Dec 2022 17:36:36 +0200	[thread overview]
Message-ID: <87edt63qbf.fsf@balbi.sh> (raw)
In-Reply-To: <f7196abb-d92e-ab47-6c7e-bea686f402c4@ideasonboard.com>


Hi,

Dan Scally <dan.scally@ideasonboard.com> writes:
> Good morning
>
> On 08/12/2022 06:11, Felipe Balbi wrote:
>> Hi,
>>
>> Dan Scally <dan.scally@ideasonboard.com> writes:
>>> I'm having an issue with DWC3 which I'm hoping you might be able to shed
>>> light on. I'm using the UVC gadget function to stream video from an
>>> imx8mp platform, which works just fine. Once I have stopped streaming
>>> however and after some time has passed (the exact duration seems to vary
>>> quite a lot from 1-2 minutes to 15+ mins) I get a kernel warning like so:
>> As Greg mentioned, please add Thinh, the new maintainer, to the loop.
>
>
> Apologies to both of you; for some reason I thought you had taken over 
> from Thinh rather than the other way around. Thanks for the heads up Greg.

no worries, it happens.

>> [1] https://kernel.org/doc/html/latest/driver-api/usb/dwc3.html#reporting-bugs
>
>
> Both the trace and regdump should be in the attached .tar.gz

Can you confirm which kernel version you're using?

It looks like there's a missing End Transfer on ep1in:

>   uvc-gadget-696 [000] .....  2646.761444: dwc3_gadget_ep_cmd: ep1in: cmd 'Set Endpoint Transfer Resource' [402] params 00000001 00000000 00000000 --> status: Successful
> irq/208-dwc3-689 [000] D..3.  2647.237436: dwc3_gadget_ep_cmd: ep1in: cmd 'Set Endpoint Configuration' [401] params 00020086 06070200 00000000 --> status: Successful
> irq/208-dwc3-689 [000] D..3.  2647.237457: dwc3_gadget_ep_cmd: ep1in: cmd 'Start Transfer' [406] params 00000000 45751000 00000000 --> status: Successful
> irq/208-dwc3-689 [000] D..3.  2647.237467: dwc3_gadget_ep_enable: ep1in: mps 16/1024 streams 16 burst 0 ring 0/0 flags E:swBp:<
>   uvc-gadget-696 [003] d..1.  2648.484042: dwc3_gadget_ep_cmd: ep1in: cmd 'End Transfer' [30c08] params 00000000 00000000 00000000 --> status: Successful
>   uvc-gadget-696 [003] d..3.  2648.490356: dwc3_gadget_ep_disable: ep1in: mps 16/1024 streams 16 burst 0 ring 0/0 flags E:swbp:<
>   uvc-gadget-698 [001] .....  2650.645667: dwc3_gadget_ep_cmd: ep1in: cmd 'Set Endpoint Transfer Resource' [402] params 00000001 00000000 00000000 --> status: Successful
> irq/208-dwc3-689 [000] D..3.  2651.141040: dwc3_gadget_ep_cmd: ep1in: cmd 'Set Endpoint Configuration' [401] params 00020086 06070200 00000000 --> status: Successful
> irq/208-dwc3-689 [000] D..3.  2651.141061: dwc3_gadget_ep_cmd: ep1in: cmd 'Start Transfer' [406] params 00000000 45751000 00000000 --> status: Successful
> irq/208-dwc3-689 [000] D..3.  2651.141070: dwc3_gadget_ep_enable: ep1in: mps 16/1024 streams 16 burst 0 ring 0/0 flags E:swBp:<
> irq/208-dwc3-689 [000] D..3.  3201.415410: dwc3_gadget_ep_disable: ep1in: mps 16/1024 streams 16 burst 0 ring 0/0 flags E:swBp:<

Right here we don't know if DWC3_EP_DELAY_STOP flag is set. In fact,
there are many flags which are not decoded to the trace points, which
makes this trace point "pointless" as it's not helping with debug
activities anymore.

In any case, I suspect DELAY_STOP is set at this point, which is causing
dwc3_stop_active_transfer() to bail out without issuing the End Transfer
command, see lines 3725 - 3728 in gadget.c (quoted below):

	if (!(dep->flags & DWC3_EP_TRANSFER_STARTED) ||
	    (dep->flags & DWC3_EP_DELAY_STOP) ||
	    (dep->flags & DWC3_EP_END_TRANSFER_PENDING))
		return;

This, in turn, will cause a subsequent ep_enable to fail with No
Resource, as the resource is still occupied by the same endpoint due to
lack of End Transfer.

@Thinh, looks like something you should patch up. Also, you should
probably go through the trace points and make sure all relevant
information is being printed to trace points. We don't want to have to
guess what's going on :-)

> irq/208-dwc3-689 [000] D..3.  3201.584476: dwc3_gadget_ep_cmd: ep1in: cmd 'Set Endpoint Configuration' [401] params 00020086 06070200 00000000 --> status: Successful
> irq/208-dwc3-689 [000] D..3.  3201.584506: dwc3_send_gadget_ep_cmd: No resource for ep1in
> irq/208-dwc3-689 [000] D..3.  3201.814837: dwc3_gadget_ep_cmd: ep1in: cmd 'Start Transfer' [406] params 00000000 45751000 00000000 --> status: No Resource

-- 
balbi

  parent reply	other threads:[~2022-12-11 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 14:27 dwc3 38100000.usb: No resource for ep1in Dan Scally
2022-12-07 16:15 ` Greg KH
2022-12-08  6:11 ` Felipe Balbi
2022-12-08  7:46   ` Dan Scally
2022-12-08 23:18     ` Thinh Nguyen
2022-12-11 15:36     ` Felipe Balbi [this message]
2022-12-12 17:51       ` Thinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edt63qbf.fsf@balbi.sh \
    --to=balbi@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).