Linux USB
 help / color / mirror / Atom feed
From: Michael Grzeschik <mgr@pengutronix.de>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-media@vger.kernel.org,
	balbi@kernel.org, paul.elder@ideasonboard.com,
	kieran.bingham@ideasonboard.com, nicolas@ndufresne.ca,
	laurent.pinchart@ideasonboard.com, kernel@pengutronix.de
Subject: Re: [PATCH v3] usb: gadget: uvc: increase worker prio to WQ_HIGHPRI
Date: Wed, 7 Sep 2022 23:42:22 +0200	[thread overview]
Message-ID: <20220907214222.GA20956@pengutronix.de> (raw)
In-Reply-To: <Yv9K3GPsyw6ZAEMm@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

On Fri, Aug 19, 2022 at 10:33:32AM +0200, Greg KH wrote:
>On Wed, Jul 20, 2022 at 04:46:41PM +0200, Michael Grzeschik wrote:
>> Likewise to the uvcvideo hostside driver, this patch is changing the
>
>"Likewise" implies a previous patch being mentioned, which I do not see
>here :(

I am not referring another patch but the uvcvideo driver.

drivers/media/usb/uvc/uvc_driver.c:

206         /* Allocate a stream specific work queue for asynchronous tasks. */
207         stream->async_wq = alloc_workqueue("uvcvideo", WQ_UNBOUND | WQ_HIGHPRI,
208                                            0);

I will add a clear reference in the commit message.

>> simple workqueue to an async_wq with higher priority. This ensures that
>> the worker will not be scheduled away while the video stream is handled.
>
>How will this ensure that?  What happens if yet-another higher priority
>task comes in?  This feels like a race that will just never be won
>without fixing this properly.

There is no race between two functions calls. There is a race between userspace
filling the gadget isoc driver with data while the hardware is moving it
towards the kernel. To ensure no underrun, we increase the priority of the
buffer filling thread.

Okay. I will probably have to rephrase it to be clear.

Thanks,
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 --]

      reply	other threads:[~2022-09-07 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20 14:46 [PATCH v3] usb: gadget: uvc: increase worker prio to WQ_HIGHPRI Michael Grzeschik
2022-08-19  8:33 ` Greg KH
2022-09-07 21:42   ` Michael Grzeschik [this message]

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=20220907214222.GA20956@pengutronix.de \
    --to=mgr@pengutronix.de \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=paul.elder@ideasonboard.com \
    /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