public inbox for virtio-dev@lists.linux.dev
 help / color / mirror / Atom feed
From: Alexander Gordeev <alexander.gordeev@opensynergy.com>
To: "Bartłomiej Grzesik" <bgrzesik@google.com>
Cc: "Bartłomiej Grzesik" <bag@semihalf.com>,
	"Alexandre Courbot" <acourbot@chromium.org>,
	"Cornelia Huck" <cohuck@redhat.com>,
	virtio-dev@lists.oasis-open.org,
	"Keiichi Watanabe" <keiichiw@chromium.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Marcin Wojtas" <mwojtas@google.com>,
	"Matti Möll" <Matti.Moell@opensynergy.com>,
	"Andrew Gazizov" <andrew.gazizov@opensynergy.com>,
	"Enrico Granata" <egranata@google.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.com>,
	"Peter Griffin" <peter.griffin@linaro.org>,
	"Tomasz Figa" <tfiga@chromium.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Enric Balletbo i Serra" <eballetb@redhat.com>,
	"Albert Esteve" <aesteve@redhat.com>,
	"srosek@google.com" <srosek@google.com>,
	"zyta@google.com" <zyta@google.com>,
	hmazur@google.com, mikrawczyk@google.com
Subject: Re: [virtio-dev] Re: [RFC PATCH v6] virtio-video: Add virtio video device specification
Date: Thu, 27 Apr 2023 16:34:56 +0200	[thread overview]
Message-ID: <a4bf7c00-4249-cd67-c183-31cd7c019a40@opensynergy.com> (raw)
In-Reply-To: <CAKxn3ec7nDy9B0nyHUg3GfXt_oktrC91kB3QWXM-sGh8ectE5A@mail.gmail.com>

On 27.04.23 12:13, Bartłomiej Grzesik wrote:
> Hi Alexander
>
> On Wed, Apr 26, 2023 at 6:00 PM Alexander Gordeev
> <alexander.gordeev@opensynergy.com> wrote:
>>
>> Hi Bartłomiej,
>>
>> On 21.04.23 13:49, Bartłomiej Grzesik wrote:
>>> +CC chromeos-arc-video-eng team that also works on virtio-video
>>>
>>> Hi everyone!
>>>
>>>   From the experience of working on virtio-video I can definitely agree
>>> with Alex Courbot, that moving to virtio-v4l2 will be a great move.
>>> This move will not only simply things a lot but also allow us things like
>>> vhost-net like implementation for some devices (however this is
>>> thinking way ahead and linux only).
>>>
>>> One added benefit of this move that I'd like to point out now, that
>>> probably
>>> haven't been mentioned before, is moving to asynchronous resource queue
>>> call. Previously `VIRTIO_VIDEO_CMD_RESOURCE_QUEUE` have been
>>> synchronous and caused one hard to debug bug caused by this flawed
>>> design. During the command execution the virtio queue descriptors are
>>> blocked, potentially leading to dead locking the device. The implementation
>>> of virtio-v4l2 (even as is - btw nice work Alex!) eliminates this issue
>>> by moving to asynchronous response of the resource queue (VIDIOC_QBUF).
>>
>> Thanks for your valuable feedback! Could you please share some details
>> about the bug? That would be very helpful. I'm working on the next
>> version of the virtio-video draft, so I can change it there. I like the
>> idea to use V4L2 as a reference, so we should probably do it like it is
>> done there, only simpler. Still it would be interesting to know the
>> details, because we didn't have issues with the current design.
>
> In this bug, an app preallocated and enqueued all output buffers (to
> CAPTURE queue). This is inline with V4L2 and in case of virtualized video
> stack helps with latency. Those enqueued buffers are holding virtqueue
> descriptors until filled with a decoded frame. While for one stream it is not an
> issue, but for more simultaneous streams, it quickly becomes a serious
> problem. In our case all descriptors from the virtqueue were consumed
> by enqueued output buffers and no other command could be issued
> to hypervisor. This dead locked the entire driver, by starving the driver with
> descriptors - even STREAM_DESTROY command could not be issued and
> only solution was to reboot the guest.
>
> While it is easily solvable by adjusting the size of the virtqueue, it
> is a flaw to
> this design. The number would always have to a function of maximum number
> of supported streams - raising rather quickly.
>
> I remember having a few thoughts on how it could be solved and I think that
> removing the need to block those descriptors is the best approach in my opinion.
> One would argue that preallocating descriptors for this purpose or splitting
> the command queue to input, output and control might be a viable solution
> or per stream. However it would only delay the issue in time or could
> cause other streams to "starve".

Thank you for the detailed description. This makes total sense to me
indeed. I thought about this problem some time and discussed it with my
colleagues. Indeed looks like it would be best to stop blocking these
descriptors. We can add more queues, but this doesn't look scalable
indeed. There are several ways to unblock the descriptors, I think.
First, we can do the same thing as in V4L2: add a separate (blocking?)
DEQUEUE command. But then we theoretically can have the same problem
with DRAIN, because it also blocks. So why not just use the event queue
to receive the completion events for both QUEUE and DRAIN commands
asynchronously? One could argue, that the errors should maybe come out
of band. But at the same time we already use event queue to deliver
dynamic resolution change events, that clearly should be delivered with
the flow of buffers.

> Porting asynchronous dequeueing of resources would bring the virtio-video
> extremely close to virtio-v4l2 and therefore I support Alexandre idea to use
> v4l2 as a protocol.


--
Alexander Gordeev
Senior Software Engineer

OpenSynergy GmbH
Rotherstr. 20, 10245 Berlin

Phone: +49 30 60 98 54 0 - 88
Fax: +49 (30) 60 98 54 0 - 99
EMail: alexander.gordeev@opensynergy.com

www.opensynergy.com

Handelsregister/Commercial Registry: Amtsgericht Charlottenburg, HRB 108616B
Geschäftsführer/Managing Director: Régis Adjamah

Please mind our privacy notice<https://www.opensynergy.com/datenschutzerklaerung/privacy-notice-for-business-partners-pursuant-to-article-13-of-the-general-data-protection-regulation-gdpr/> pursuant to Art. 13 GDPR. // Unsere Hinweise zum Datenschutz gem. Art. 13 DSGVO finden Sie hier.<https://www.opensynergy.com/de/datenschutzerklaerung/datenschutzhinweise-fuer-geschaeftspartner-gem-art-13-dsgvo/>

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


  reply	other threads:[~2023-04-27 14:35 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  7:23 [virtio-dev] [RFC PATCH v6] virtio-video: Add virtio video device specification Alexandre Courbot
2022-12-08 15:00 ` Cornelia Huck
2022-12-27  5:38   ` Alexandre Courbot
2023-01-11  8:45     ` Cornelia Huck
2023-01-12  6:32       ` Alexandre Courbot
2023-01-12 15:23         ` Cornelia Huck
2022-12-19 16:59 ` [virtio-dev] " Alexander Gordeev
2022-12-20  9:51   ` Cornelia Huck
2022-12-20 10:35     ` Alexander Gordeev
2022-12-20 17:39       ` Cornelia Huck
2022-12-21 14:56         ` Alexander Gordeev
2022-12-27  7:31   ` Alexandre Courbot
2023-01-11 18:42     ` Alexander Gordeev
2023-01-11 20:13       ` Alex Bennée
2023-01-12  6:40         ` Alexandre Courbot
2023-01-12  6:39       ` Alexandre Courbot
2023-01-18 23:06         ` Alexander Gordeev
2023-02-06 14:12           ` Cornelia Huck
2023-02-07  6:16             ` Alexandre Courbot
2023-02-07 13:59               ` Cornelia Huck
2023-03-10 10:50                 ` Cornelia Huck
2023-03-10 13:19                   ` Alexandre Courbot
2023-03-10 14:20                     ` Cornelia Huck
2023-03-14  5:06                       ` Alexandre Courbot
2023-03-16 10:12                         ` Alexander Gordeev
2023-03-17  7:24                           ` Alexandre Courbot
2023-04-17 12:51                             ` Alexander Gordeev
2023-04-17 14:43                               ` Cornelia Huck
2023-04-19  7:39                                 ` Alexander Gordeev
2023-04-19 21:34                                   ` Enrico Granata
2023-04-21 14:48                                     ` Alexander Gordeev
2023-04-21  4:02                                   ` Alexandre Courbot
2023-04-21 16:01                                     ` Alexander Gordeev
2023-04-24  7:52                                       ` Alexander Gordeev
2023-04-25 16:04                                         ` Cornelia Huck
2023-04-26  6:29                                           ` Alexandre Courbot
2023-04-27 14:10                                           ` Alexander Gordeev
2023-04-28  4:02                                             ` Alexandre Courbot
2023-04-28  8:54                                               ` Alexander Gordeev
2023-05-02  1:07                                                 ` Alexandre Courbot
2023-05-02 11:12                                                   ` Alexander Gordeev
2023-04-26  5:52                                         ` Alexandre Courbot
2023-04-27 14:20                                           ` Alexander Gordeev
2023-04-28  3:22                                             ` Alexandre Courbot
2023-04-28  8:22                                               ` Alexander Gordeev
2023-04-26 15:52                                     ` Alexander Gordeev
2023-04-27 13:23                                       ` Alexandre Courbot
2023-04-27 15:12                                         ` Alexander Gordeev
2023-04-28  3:24                                           ` Alexandre Courbot
2023-04-28  8:31                                             ` Alexander Gordeev
     [not found]                                     ` <CALgKJBqKWng508cB_F_uD2fy9EAvQ36rYR3fRb57sFd3ihpUFw@mail.gmail.com>
2023-04-26 16:00                                       ` Alexander Gordeev
2023-04-27 10:13                                         ` Bartłomiej Grzesik
2023-04-27 14:34                                           ` Alexander Gordeev [this message]
2023-04-28  3:22                                             ` Alexandre Courbot
2023-04-28  7:57                                               ` Alexander Gordeev
2023-04-21  4:02                               ` Alexandre Courbot
2023-04-26 15:11                                 ` Alexander Gordeev
2023-04-27 13:16                                   ` Alexandre Courbot
2023-04-28  7:47                                     ` Alexander Gordeev
2023-05-03 14:04                                       ` Cornelia Huck
2023-05-03 15:11                                         ` Alex Bennée
2023-05-03 15:53                                           ` Cornelia Huck
2023-05-05  9:57                                             ` Alexander Gordeev
     [not found]                                               ` <168329085253.1880445.14002473591422425775@Monstersaurus>
2023-05-05 15:55                                                 ` Alex Bennée
2023-05-16 12:57                                                   ` Alexander Gordeev
     [not found]                                                   ` <20230506081229.GA8114@pendragon.ideasonboard.com>
     [not found]                                                     ` <20230506081633.GB8114@pendragon.ideasonboard.com>
2023-05-08  8:00                                                       ` [virtio-dev] Re: [libcamera-devel] " Alexandre Courbot
2023-05-16 13:50                                                       ` Alexander Gordeev
2023-05-17  3:58                                                     ` Tomasz Figa
2023-05-05 12:28                                           ` Alexander Gordeev
2023-05-05 11:54                                         ` Alexander Gordeev
2023-05-08  4:55                                           ` Alexandre Courbot
2023-05-11  8:50                                             ` Alexander Gordeev
2023-05-11  9:00                                               ` Alexander Gordeev
2023-05-12  4:15                                                 ` Alexandre Courbot
2023-05-17  7:35                                                   ` Alexander Gordeev
2023-05-12  4:09                                               ` Alexandre Courbot
2023-05-16 14:53                                                 ` Alexander Gordeev
2023-05-17 16:28                                                   ` Cornelia Huck
2023-05-18  6:29                                                     ` Alexander Gordeev
2023-05-18 19:35                                                     ` Michael S. Tsirkin
2023-05-17 11:04                                                 ` Alexander Gordeev
2023-03-27 13:00                         ` Albert Esteve
2023-04-15  5:58                           ` Alexandre Courbot
2023-04-17 12:56                             ` Cornelia Huck
2023-04-17 13:13                               ` Alexander Gordeev
2023-04-17 13:22                                 ` Cornelia Huck
2023-02-07 11:11             ` Alexander Gordeev
2023-02-07  6:51           ` Alexandre Courbot
2023-02-07 10:57             ` Alexander Gordeev
2023-01-11 17:04 ` Alexander Gordeev
2023-01-12  6:32   ` Alexandre Courbot
2023-01-12 22:24     ` Alexander Gordeev
2023-01-11 18:45 ` Alexander Gordeev

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=a4bf7c00-4249-cd67-c183-31cd7c019a40@opensynergy.com \
    --to=alexander.gordeev@opensynergy.com \
    --cc=Matti.Moell@opensynergy.com \
    --cc=acourbot@chromium.org \
    --cc=aesteve@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=andrew.gazizov@opensynergy.com \
    --cc=bag@semihalf.com \
    --cc=bgrzesik@google.com \
    --cc=cohuck@redhat.com \
    --cc=daniel.almeida@collabora.com \
    --cc=eballetb@redhat.com \
    --cc=egranata@google.com \
    --cc=gustavo.padovan@collabora.com \
    --cc=hmazur@google.com \
    --cc=keiichiw@chromium.org \
    --cc=mikrawczyk@google.com \
    --cc=mwojtas@google.com \
    --cc=peter.griffin@linaro.org \
    --cc=srosek@google.com \
    --cc=tfiga@chromium.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=zyta@google.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