From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Michael Grzeschik <mgr@pengutronix.de>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"kernel@pengutronix.de" <kernel@pengutronix.de>
Subject: Re: DWC3-Gadget: Flickering with ISOC Streaming (UVC) while multiplier set on Superspeed
Date: Tue, 31 Oct 2023 23:18:50 +0000 [thread overview]
Message-ID: <20231031231841.dbhtrgqounu2rvgn@synopsys.com> (raw)
In-Reply-To: <ZT+fCXtsa3s4CoGC@pengutronix.de>
Hi,
On Mon, Oct 30, 2023, Michael Grzeschik wrote:
> Hi Thinh,
>
> On Thu, Sep 07, 2023 at 11:33:26PM +0000, Thinh Nguyen wrote:
> > On Thu, Sep 07, 2023, Michael Grzeschik wrote:
> > > On Wed, Sep 06, 2023 at 11:09:03PM +0000, Thinh Nguyen wrote:
> > > > On Wed, Sep 06, 2023, Thinh Nguyen wrote:
> > > > > On Wed, Sep 06, 2023, Michael Grzeschik wrote:
> > > > > >
> > > > > > > 2) Burst setting
> > > > > > > I think this is self-explainatory. Large data request needs
> > > > > > > higher burst.
> > > > > >
> > > > > > I will have to find out if the burst setting can be changed on the
> > > > > > rk3568 somehow. This sounds very likely.
> > > > > >
> > > > >
> > > > > The dwc3 driver checks the endpoint descriptor from the UVC function
> > > > > driver to setup the burst. So just setup the max 16 bursts (or 15 in the
> > > > > descriptor). The dwc3 controller supports that. Whether the host would
> > > > > do 16 bursts is another thing. Note that there's no "mult" setting for
> > > > > SuperSpeed.
> > > >
> > > > Clarification: no mult setting for the dwc3 controller when operate in
> > > > SuperSpeed.
> > >
> > > I was somehow mistaken by the wording "burst setting" and thought of the
> > > axi-bus burst setting to the controller instead of the usb3 maxburst
> > > setting as you ment actually.
> >
> > I see. You were referring to the axi-bus burst. If your platform takes a
> > long time to DMA out the data, it will impact the performance also. You
> > can play around with GSBUSCFG0 to enable/restrict certain burst sizes to
> > see any improvement. However, I would expect the default
> > coreConfiguration values should be optimal for your platform design.
>
> I was not lucky with that parameters. Under heavy memory load the
> system still runs into fifo underruns.
>
> > > However. This is usefull input anyway. I never thought of maximizing the
> > > burst and packagesize and let the host side make the decision.
> > > But we will probably will eat up a lot of usb bandwidth by doing so.
> > >
> > > Before your note I was somehow mistaken that the maxpacket and maxburst
> > > size had to correlate with the actually transfered data we queue into
> > > the hardware per request.
> >
> > Right. The maxpacket, maxburst, and mult limit the max request data
> > length you can send.
>
> > > > > I recall that UVC tries to pack a lot of data in a single request. All
> > > > > the while some intervals it would send 0-length data because of idle
> > > > > time. I would spread to more requests with a little less data to give
> > > > > the host a little more breathing room and bandwidth.
> > >
> > > The higher load per request is due to the fact that the uvc gadget is
> > > using the multiplier, maxpacket and maxburst parameters for the size
> > > calculation of the request.
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/gadget/function/uvc_video.c#n331
> > >
> > > Since it is clear now that those parameters are not necessary coupled
> > > it makes total sense to split the requests into smaller chunks.
> > >
> >
> > Ok.
>
> So changing the req_size to smaller chunks indeed did increase the
> stability. The main misunderstanding here was that the that not every
> request corresponds with the timeslot of one interval.
>
> After reading this thread once again, it is clear that this is not the
> case and we still find all possible bandwidth by decreasing the size of
> each request.
That's right.
>
> The main takeway was that with the hardware will cache several
> trbs into the queue. So when there are not enough trbs available
> because they are just to big, the fifo runs into underruns.
>
> In our case with the high memory bandwidth usage, the trbs could
> probably not even read out that few trbs in time and did trigger
> the case earlier.
>
> So with smaller requests the fifo will be filled with more smaller
> trbs and does not run out that fast, since more trbs are cached to
> begin with.
>
> One more question: Does the caching amount of the fifo directly
> correlate with the endpoint setting in DWC3_DEPCFG_BURST_SIZE then?
>
No. The cache I was referring to is the cache for TRBs, and the caching
of TRBs is not related to DWC3_DEPCFG_BURST_SIZE.
BR,
Thinh
next prev parent reply other threads:[~2023-10-31 23:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 22:12 DWC3-Gadget: Flickering with ISOC Streaming (UVC) while multiplier set on Superspeed Michael Grzeschik
2023-09-01 1:35 ` Thinh Nguyen
2023-09-03 22:41 ` Michael Grzeschik
2023-09-04 0:42 ` Michael Grzeschik
2023-09-06 0:44 ` Thinh Nguyen
2023-09-06 6:40 ` Michael Grzeschik
2023-09-06 0:41 ` Thinh Nguyen
2023-09-06 7:18 ` Michael Grzeschik
2023-09-06 23:05 ` Thinh Nguyen
2023-09-06 23:09 ` Thinh Nguyen
2023-09-07 21:00 ` Michael Grzeschik
2023-09-07 23:33 ` Thinh Nguyen
2023-10-30 12:18 ` Michael Grzeschik
2023-10-31 23:18 ` Thinh Nguyen [this message]
2023-11-09 23:33 ` [PATCH] usb: gadget: uvc: reduce the request size to increase the throughput Michael Grzeschik
2023-11-10 2:16 ` Thinh Nguyen
2023-11-10 22:42 ` Thinh Nguyen
2023-11-13 8:43 ` Michael Grzeschik
2023-11-17 2:39 ` 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=20231031231841.dbhtrgqounu2rvgn@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=kernel@pengutronix.de \
--cc=linux-usb@vger.kernel.org \
--cc=mgr@pengutronix.de \
/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