Re: [PATCH v5] usb:gadget:uvc Do not use worker thread to pump isoc usb requests

From: Jayant Chowdhary
Date: Thu Nov 09 2023 - 02:38:20 EST


On 11/8/23 21:29, Greg KH wrote:
> On Thu, Nov 09, 2023 at 02:12:50AM +0000, Jayant Chowdhary wrote:
>> When we use an async work queue to perform the function of pumping
>> usb requests to the usb controller, it is possible that amongst other
>> factors, thread scheduling affects at what cadence we're able to pump
>> requests. This could mean isoc usb requests miss their uframes - resulting
>> in video stream flickers on the host device.
>>
>> To avoid this, we make the async_wq thread only produce isoc usb_requests
>> with uvc buffers encoded into them. The process of queueing to the
>> endpoint is done by the uvc_video_complete() handler. In case no
>> usb_requests are ready with encoded information, we just queue a zero
>> length request to the endpoint from the complete handler.
>>
>> For bulk endpoints the async_wq thread still queues usb requests to the
>> endpoint.
>>
>> Change-Id: I8a33cbf83fb2f04376826185079f8b25404fe761
>> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
>> Signed-off-by: Jayant Chowdhary <jchowdhary@xxxxxxxxxx>
>> Suggested-by: Avichal Rakesh <arakesh@xxxxxxxxxx>
>> Suggested-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
>> ---
>> Based on top of
>> https://lore.kernel.org/linux-usb/20230930184821.310143-1-arakesh@xxxxxxxxxx/T/#t:
>> v1->v2: Added self Signed-Off-by and addressed review comments
>> v2->v3: Encode to usb requests in async_wq; queue to ep in complete handler
>> for isoc transfers.
>> v3->v4: Address review comments around code style.
>> v4->v5: Update comments. Remove 0 length request queueing from async_wq
>> thread since it is already done by the complete handler.
> You forgot to run checkpatch.pl :(

My apologies, I sent out v6 with checkpatch.pl fixed.

Thanks