From: Michael Grzeschik <mgr@pengutronix.de>
To: Jayant Chowdhary <jchowdhary@google.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg KH <gregkh@linuxfoundation.org>,
"corbet@lwn.net" <corbet@lwn.net>,
"laurent.pinchart@ideasonboard.com"
<laurent.pinchart@ideasonboard.com>,
"dan.scally@ideasonboard.com" <dan.scally@ideasonboard.com>,
"kieran.bingham@ideasonboard.com"
<kieran.bingham@ideasonboard.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"etalvala@google.com" <etalvala@google.com>,
"arakesh@google.com" <arakesh@google.com>
Subject: Re: uvc gadget: Making upper bound of number of usb requests allocated configurable through configfs
Date: Thu, 26 Oct 2023 08:55:03 +0200 [thread overview]
Message-ID: <ZToNRynv4u6IbroC@pengutronix.de> (raw)
In-Reply-To: <45fe4c79-458a-4eaf-8de8-50682f7d8b52@google.com>
[-- Attachment #1: Type: text/plain, Size: 3439 bytes --]
On Wed, Oct 25, 2023 at 04:09:27PM -0700, Jayant Chowdhary wrote:
>On 10/24/23 05:33, Michael Grzeschik wrote:
>> On Mon, Oct 23, 2023 at 11:13:03AM -0700, Jayant Chowdhary wrote:
>>> On 10/20/23 16:30, Thinh Nguyen wrote:
>>>> Sorry for the delay response.
>>>>
>>>> On Sun, Oct 15, 2023, Jayant Chowdhary wrote:
>>>>> On 10/12/23 11:50, Thinh Nguyen wrote:
>>>>>> The frequency of the request submission should not depend on the
>>>>>> video_pump() work thread since it can vary. The frequency of request
>>>>>> submission should match with the request completion. We know that
>>>>>> request completion rate should be fixed (1 uframe/request + when you
>>>>>> don't set no_interrupt). Base on this you can do your calculation on how
>>>>>> often you should set no_interrupt and how many requests you must submit.
>>>>>> You don't have to wait for the video_pump() to submit 0-length requests.
>>>>>>
>>>>>> The only variable here is the completion handler delay or system
>>>>>> latency, which should not be much and should be within your calculation.
>>>>>
>>>>> Thanks for the suggestion. It indeed makes sense that we do not completely depend on
>>>>> video_pump() for sending 0 length requests. I was concerned about
>>>>> synchronization needed when we send requests to the dwc3 controller from
>>>>> different threads. I see that the dwc3 controller code does internally serialize
>>>>> queueing requests, can we expect this from other controllers as well ?
>>>> While it's not explicitly documented, when the gadget driver uses
>>>> usb_ep_queue(), the order in which the gadget recieves the request
>>>> should be maintained and serialized. Because the order the transfer go
>>>> out for the same endpoint can be critical, breaking this will cause
>>>> issue.
>>>>
>>> Thanks for clarifying this. Keeping this in mind - I made a slight modification to
>>> your test patch - I removed the uvc_video_pump() function call from uvc_v4l2_qbuf(). We just
>>> call it in uvcg_video_enable(). That should just queue 0 length requests till the first qbuf
>>> is called. There-after only the complete handler running uvcg_video_complete() calls video_pump(),
>>> which sends usb requests to the endpoint. While I do see that we hold the queue->irqlock while
>>> getting the uvc buffer to encode and sending it to the ep, I feel like its just logically safer
>>> for future changes if we can restrict the pumping of requests to one thread.
>>>
>>> Does that seem okay to you ? I can formalize it if it does.
>>
>> I tested this, and it looks good so far.
>>
>> Since your changes are minimal you could send this with me as the author
>> and add your Suggested-by Tag. You should also add your Tested-by Tag in
>> that case.
>>
>I sent out https://lore.kernel.org/linux-usb/99384044-0d14-4ebe-9109-8a5557e64449@google.com/T/#u
>
>with a Signed-off-by crediting you and suggested by with Avichal and me. It has a few changes related to
>
>bulk end-points as well, but they're relatively minor.
Sounds good to me, but you missed your own Signed-off-by in the patch.
Michael
--
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 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-10-26 6:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 22:03 uvc gadget: Making upper bound of number of usb requests allocated configurable through configfs Jayant Chowdhary
2023-10-08 5:45 ` Greg KH
2023-10-09 22:34 ` Jayant Chowdhary
2023-10-12 18:50 ` Thinh Nguyen
2023-10-16 4:33 ` Jayant Chowdhary
2023-10-18 13:28 ` Michael Grzeschik
2023-10-19 23:15 ` Michael Grzeschik
2023-10-20 5:52 ` Jayant Chowdhary
2023-10-20 12:49 ` Michael Grzeschik
2023-10-27 8:12 ` Laurent Pinchart
2023-10-20 23:30 ` Thinh Nguyen
2023-10-23 18:13 ` Jayant Chowdhary
2023-10-24 12:33 ` Michael Grzeschik
2023-10-25 23:09 ` Jayant Chowdhary
2023-10-26 6:55 ` Michael Grzeschik [this message]
2023-10-27 8:14 ` Laurent Pinchart
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=ZToNRynv4u6IbroC@pengutronix.de \
--to=mgr@pengutronix.de \
--cc=Thinh.Nguyen@synopsys.com \
--cc=arakesh@google.com \
--cc=corbet@lwn.net \
--cc=dan.scally@ideasonboard.com \
--cc=etalvala@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jchowdhary@google.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-doc@vger.kernel.org \
--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).