linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Grzeschik <mgr@pengutronix.de>
To: Dan Vacura <w36195@motorola.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-usb@vger.kernel.org, balbi@kernel.org,
	paul.elder@ideasonboard.com, kernel@pengutronix.de,
	nicolas@ndufresne.ca, kieran.bingham@ideasonboard.com
Subject: Re: [PATCH 3/5] usb: gadget: uvc: increase worker prio to WQ_HIGHPRI
Date: Fri, 29 Apr 2022 22:01:37 +0200	[thread overview]
Message-ID: <20220429200137.GE7671@pengutronix.de> (raw)
In-Reply-To: <YmwzxIV5/a+ZNLXI@p1g3>

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

Hi Dan,
Hi Laurent,

On Fri, Apr 29, 2022 at 01:51:48PM -0500, Dan Vacura wrote:
>Thanks for this change it improves the performance with the DWC3
>controller on QCOM chips in an Android 5.10 kernel. I haven't tested the
>scatter/gather path, so memcpy was used here via
>uvc_video_encode_isoc(). I was able to get around 30% improvement (fps
>on host side). I did modify the alloc to only set the WQ_HIGHPRI flag.
>
>On Tue, Apr 19, 2022 at 11:46:57PM +0300, Laurent Pinchart wrote:
>> Thank you for the patch.
>>
>> On Sun, Apr 03, 2022 at 01:39:12AM +0200, Michael Grzeschik wrote:
>> > Likewise to the uvcvideo hostside driver, this patch is changing the
>> > 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.
>> >
>> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
>> > +	video->async_wq = alloc_workqueue("uvcvideo", WQ_UNBOUND | WQ_HIGHPRI, 0);
>>
>> Unless I'm mistaken, an unbound work queue means that multiple CPUs will
>> handle tasks in parallel. Is that safe ?
>
>I found that with the WQ_UNBOUND flag I didn't see any performance
>improvement to the baseline, perhaps related to cpu caching or
>scheduling delays. I didn't notice any stability problems or concurrent
>execution. Do you see any benefit to keeping the WQ_UNBOUND flag?

I actually copied this from drivers/media/usb/uvc/uvc_driver.c ,
which is also allocating the workqueue with WQ_UNBOUND.

Look into drivers/media/usb/uvc/uvc_driver.c + 486

	stream->async_wq = alloc_workqueue("uvcvideo", WQ_UNBOUND | WQ_HIGHPRI,

In my tests, continous streaming did not trigger any errors. In fact if
this would be unsafe, the issue would probably trigger early, numerous
and obvious on multicore cpus.

However, some users seem to have seen recent issues on unplugging the
cable while streaming. I have to check if this could be related.

>> > +	if (!video->async_wq)
>> > +		return -EINVAL;
>>
>> --
>> Regards,
>>
>> Laurent Pinchart
>
>Thanks,
>
>Dan
>

-- 
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-04-29 20:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-02 23:39 [PATCH 0/5] usb: gadget: uvc: fixes and improvements Michael Grzeschik
2022-04-02 23:39 ` [PATCH 1/5] usb: gadget: uvc: reset bytesused on queue cancel Michael Grzeschik
2022-04-05  8:43   ` Sergey Shtylyov
2022-04-05 15:01     ` Dan Vacura
2022-04-06  8:26       ` Michael Grzeschik
2022-04-02 23:39 ` [PATCH 2/5] usb: gadget: uvc: calculate the number of request depending on framesize Michael Grzeschik
2022-04-19 20:46   ` Laurent Pinchart
2022-05-08 22:48     ` Michael Grzeschik
2022-04-02 23:39 ` [PATCH 3/5] usb: gadget: uvc: increase worker prio to WQ_HIGHPRI Michael Grzeschik
2022-04-19 20:46   ` Laurent Pinchart
2022-04-29 18:51     ` Dan Vacura
2022-04-29 20:01       ` Michael Grzeschik [this message]
2022-05-02  9:00         ` Michael Grzeschik
2022-05-06 21:49           ` Dan Vacura
2022-09-28 20:12         ` Laurent Pinchart
2022-04-02 23:39 ` [PATCH 4/5] usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info Michael Grzeschik
2022-04-19 20:47   ` Laurent Pinchart
2022-04-02 23:39 ` [PATCH 5/5] usb: gadget: uvc: stop the pump on more conditions Michael Grzeschik
2022-04-04 11:30   ` kernel test robot
2022-04-04 13:07   ` Michael Grzeschik
2022-04-19 14:21     ` Greg KH

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=20220429200137.GE7671@pengutronix.de \
    --to=mgr@pengutronix.de \
    --cc=balbi@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=paul.elder@ideasonboard.com \
    --cc=w36195@motorola.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;
as well as URLs for NNTP newsgroup(s).