From: Dan Vacura <w36195@motorola.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
Daniel Scally <dan.scally@ideasonboard.com>,
Jeff Vanhoof <qjv001@motorola.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Felipe Balbi <balbi@kernel.org>,
Paul Elder <paul.elder@ideasonboard.com>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH v3 2/6] usb: dwc3: gadget: cancel requests instead of release after missed isoc
Date: Mon, 17 Oct 2022 21:10:49 -0500 [thread overview]
Message-ID: <Y04K/HoUigF5FYBA@p1g3> (raw)
In-Reply-To: <20221017213031.tqb575hdzli7jlbh@synopsys.com>
Hi Thinh,
On Mon, Oct 17, 2022 at 09:30:38PM +0000, Thinh Nguyen wrote:
> On Mon, Oct 17, 2022, Dan Vacura wrote:
> > From: Jeff Vanhoof <qjv001@motorola.com>
> >
> > arm-smmu related crashes seen after a Missed ISOC interrupt when
> > no_interrupt=1 is used. This can happen if the hardware is still using
> > the data associated with a TRB after the usb_request's ->complete call
> > has been made. Instead of immediately releasing a request when a Missed
> > 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.
>
> This doesn't sound right. How did you determine that the hardware is
> still using the data associated with the TRB? Did you check the TRB's
> HWO bit?
The problem we're seeing was mentioned in the summary of this patch
series, issue #1. Basically, with the following patch
https://patchwork.kernel.org/project/linux-usb/patch/20210628155311.16762-6-m.grzeschik@pengutronix.de/
integrated a smmu panic is occurring on our Android device with the 5.15
kernel which is:
<3>[ 718.314900][ T803] arm-smmu 15000000.apps-smmu: Unhandled arm-smmu context fault from a600000.dwc3!
The uvc gadget driver appears to be the first (and only) gadget that
uses the no_interrupt=1 logic, so this seems to be a new condition for
the dwc3 driver. In our configuration, we have up to 64 requests and the
no_interrupt=1 for up to 15 requests. The list size of dep->started_list
would get up to that amount when looping through to cleanup the
completed requests. From testing and debugging the smmu panic occurs
when a -EXDEV status shows up and right after
dwc3_gadget_ep_cleanup_completed_request() was visited. The conclusion
we had was the requests were getting returned to the gadget too early.
>
> The dwc3 driver would only give back the requests if the TRBs of the
> associated requests are completed or when the device is disconnected.
> If the TRB indicated missed isoc, that means that the TRB is completed
> and its status was updated.
Interesting, the device is not disconnected as we don't get the
-ESHUTDOWN status back and with this patch in place things continue
after a -EXDEV status is received.
>
> There's a special case which dwc3 may give back requests early is the
> case of the device disconnecting. The requests should be returned with
> -ESHUTDOWN, and the gadget driver shouldn't be re-using the requests on
> de-initialization anyway.
>
> We should not issue End Transfer command just because of missed isoc. We
> may want issue End Transfer if the gadget driver is too slow and unable
> to feed requests in time (causing underrun and missed isoc) to resync
> with the host, but we already handle that.
Hmm, isn't that what happens when we get into this
condition in dwc3_gadget_endpoint_trbs_complete():
if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
list_empty(&dep->started_list) &&
(list_empty(&dep->pending_list) || status == -EXDEV))
dwc3_stop_active_transfer(dep, true, true);
>
> I'm still not clear what's the problem you're seeing. Do you have the
> crash log? Tracepoints?
>
> BR,
> Thinh
Appreciate the support!
Dan
next prev parent reply other threads:[~2022-10-18 2:12 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 20:54 [PATCH v3 0/6] uvc gadget performance issues Dan Vacura
2022-10-17 20:54 ` [PATCH] usb: gadget: uvc: fix dropped frame after missed isoc Dan Vacura
2022-10-18 1:50 ` Bagas Sanjaya
2022-10-18 2:15 ` Dan Vacura
2022-10-18 5:13 ` Greg Kroah-Hartman
2022-10-17 20:54 ` [PATCH v3 2/6] usb: dwc3: gadget: cancel requests instead of release " Dan Vacura
2022-10-17 21:30 ` Thinh Nguyen
2022-10-18 2:10 ` Dan Vacura [this message]
2022-10-18 18:45 ` Thinh Nguyen
2022-10-18 19:13 ` Michael Grzeschik
2022-10-18 22:45 ` Thinh Nguyen
2022-10-19 6:46 ` Michael Grzeschik
2024-02-22 0:02 ` Michael Grzeschik
2024-02-22 1:20 ` Thinh Nguyen
2024-02-27 21:01 ` Michael Grzeschik
2024-03-07 1:57 ` Thinh Nguyen
2024-03-07 16:15 ` Michael Grzeschik
2024-03-08 2:47 ` Thinh Nguyen
2022-10-17 20:54 ` [PATCH v3 3/6] usb: gadget: uvc: fix sg handling in error case Dan Vacura
2022-10-17 20:54 ` [PATCH v3 4/6] usb: gadget: uvc: fix sg handling during video encode Dan Vacura
2022-10-17 20:54 ` [PATCH v3 5/6] usb: gadget: uvc: make interrupt skip logic configurable Dan Vacura
2022-10-17 20:54 ` [PATCH v3 6/6] usb: gadget: uvc: add configfs option for sg support Dan Vacura
2022-10-18 13:27 ` Dan Scally
2022-10-18 14:04 ` Michael Grzeschik
2022-10-18 14:09 ` Dan Scally
2022-10-18 14:10 ` Dan Scally
2022-10-18 15:00 ` Dan Vacura
2022-10-18 14:32 ` Alan Stern
2022-10-18 15:14 ` Dan Vacura
2022-10-18 15:23 ` Alan Stern
2022-10-18 15:28 ` Michael Grzeschik
-- strict thread matches above, loose matches on Subject: below --
2022-10-18 20:49 [PATCH v3 2/6] usb: dwc3: gadget: cancel requests instead of release after missed isoc Jeffrey Vanhoof
2022-10-18 22:35 ` Thinh Nguyen
2022-10-19 1:41 ` Jeff Vanhoof
2022-10-19 2:02 ` Thinh Nguyen
2022-10-19 7:40 ` Jeff Vanhoof
2022-10-19 19:08 ` Thinh Nguyen
2022-10-19 21:34 ` Jeff Vanhoof
2022-10-19 23:06 ` Thinh Nguyen
2022-10-20 16:47 ` Jeff Vanhoof
2022-10-20 20:53 ` Jeff Vanhoof
2022-10-20 22:47 ` Thinh Nguyen
2022-10-21 0:55 ` Thinh Nguyen
2022-10-21 9:39 ` Jeff Vanhoof
2022-10-21 16:43 ` Thinh Nguyen
2022-10-21 18:28 ` Jeff Vanhoof
2022-10-21 19:09 ` Thinh Nguyen
2022-10-21 19:27 ` Jeff Vanhoof
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=Y04K/HoUigF5FYBA@p1g3 \
--to=w36195@motorola.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=balbi@kernel.org \
--cc=corbet@lwn.net \
--cc=dan.scally@ideasonboard.com \
--cc=gregkh@linuxfoundation.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=paul.elder@ideasonboard.com \
--cc=qjv001@motorola.com \
--cc=stable@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).