From: Albert Esteve <aesteve@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: "Huang Rui" <ray.huang@amd.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Anthony PERARD" <anthony.perard@citrix.com>,
"Antonio Caggiano" <antonio.caggiano@collabora.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
"Robert Beckett" <bob.beckett@collabora.com>,
"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Gurchetan Singh" <gurchetansingh@chromium.org>,
"ernunes@redhat.com" <ernunes@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Alyssa Ross" <hi@alyssa.is>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>,
"Ragiadakou, Xenia" <Xenia.Ragiadakou@amd.com>,
"Pelloux-Prayer,
Pierre-Eric" <Pierre-eric.Pelloux-prayer@amd.com>,
"Huang, Honglei1" <Honglei1.Huang@amd.com>,
"Zhang, Julia" <Julia.Zhang@amd.com>,
"Chen, Jiqian" <Jiqian.Chen@amd.com>
Subject: Re: [QEMU PATCH v4 10/13] virtio-gpu: Resource UUID
Date: Thu, 14 Sep 2023 10:29:51 +0200 [thread overview]
Message-ID: <CADSE00Kyid+=FkkopSGDAyeJ_MY2exDdxoPf18pzthKy70kkKg@mail.gmail.com> (raw)
In-Reply-To: <0adaf816-e050-43c3-8284-fc41627543ef@daynix.com>
[-- Attachment #1: Type: text/plain, Size: 10992 bytes --]
On Thu, Sep 14, 2023 at 9:17 AM Akihiko Odaki <akihiko.odaki@daynix.com>
wrote:
> On 2023/09/13 23:18, Albert Esteve wrote:
> >
> >
> > On Wed, Sep 13, 2023 at 3:43 PM Akihiko Odaki <akihiko.odaki@daynix.com
> > <mailto:akihiko.odaki@daynix.com>> wrote:
> >
> > On 2023/09/13 21:58, Albert Esteve wrote:
> > >
> > >
> > > On Wed, Sep 13, 2023 at 2:22 PM Akihiko Odaki
> > <akihiko.odaki@daynix.com <mailto:akihiko.odaki@daynix.com>
> > > <mailto:akihiko.odaki@daynix.com
> > <mailto:akihiko.odaki@daynix.com>>> wrote:
> > >
> > > On 2023/09/13 20:34, Albert Esteve wrote:
> > > >
> > > >
> > > > On Wed, Sep 13, 2023 at 12:34 PM Akihiko Odaki
> > > <akihiko.odaki@daynix.com <mailto:akihiko.odaki@daynix.com>
> > <mailto:akihiko.odaki@daynix.com <mailto:akihiko.odaki@daynix.com>>
> > > > <mailto:akihiko.odaki@daynix.com
> > <mailto:akihiko.odaki@daynix.com>
> > > <mailto:akihiko.odaki@daynix.com
> > <mailto:akihiko.odaki@daynix.com>>>> wrote:
> > > >
> > > > On 2023/09/13 16:55, Albert Esteve wrote:
> > > > > Hi Antonio,
> > > > >
> > > > > If I'm not mistaken, this patch is related with:
> > > > >
> > > >
> > >
> > https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html
> > <https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html
> >
> > >
> > <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html>>
> > > >
> > >
> > <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html> <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html>>>
> > > > >
> > > >
> > >
> > <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html> <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html>>
> > > >
> > >
> > <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html> <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html <
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01853.html>>>>
> > > > > IMHO, ideally, virtio-gpu and vhost-user-gpu both,
> > would
> > > use the
> > > > > infrastructure from the patch I linked to store the
> > > > > virtio objects, so that they can be later shared
> with
> > > other devices.
> > > >
> > > > I don't think such sharing is possible because the
> > resources are
> > > > identified by IDs that are local to the device. That
> also
> > > complicates
> > > > migration.
> > > >
> > > > Regards,
> > > > Akihiko Odaki
> > > >
> > > > Hi Akihiko,
> > > >
> > > > As far as I understand, the feature to export
> > dma-bufs from the
> > > > virtgpu was introduced as part of the virtio cross-device
> > sharing
> > > > proposal [1]. Thus, it shall be posible. When
> > virtgpu ASSING_UUID,
> > > > it exports and identifies the dmabuf resource, so that
> > when the
> > > dmabuf gets
> > > > shared inside the guest (e.g., with virtio-video), we can
> > use the
> > > assigned
> > > > UUID to find the dmabuf in the host (using the patch that I
> > > linked above),
> > > > and import it.
> > > >
> > > > [1] - https://lwn.net/Articles/828988/
> > <https://lwn.net/Articles/828988/>
> > > <https://lwn.net/Articles/828988/
> > <https://lwn.net/Articles/828988/>>
> > <https://lwn.net/Articles/828988/ <https://lwn.net/Articles/828988/>
> > > <https://lwn.net/Articles/828988/
> > <https://lwn.net/Articles/828988/>>>
> > >
> > > The problem is that virtio-gpu can have other kind of
> > resources like
> > > pixman and OpenGL textures and manage them and DMA-BUFs with
> > unified
> > > resource ID.
> > >
> > >
> > > I see.
> > >
> > >
> > > So you cannot change:
> > > g_hash_table_insert(g->resource_uuids,
> > > GUINT_TO_POINTER(assign.resource_id), uuid);
> > > by:
> > > virtio_add_dmabuf(uuid, assign.resource_id);
> > >
> > > assign.resource_id is not DMA-BUF file descriptor, and the
> > underlying
> > > resource my not be DMA-BUF at first place.
> > >
> > >
> > > I didn't really look into the patch in-depth, so the code was
> > intended
> > > to give an idea of how the implementation would look like with
> > > the cross-device patch API. Indeed, it is not the resource_id,
> > > (I just took a brief look at the virtio specificacion 1.2), but
> the
> > > underlying
> > > resource what we want to use here.
> > >
> > >
> > > Also, since this lives in the common code that is not used
> > only by
> > > virtio-gpu-gl but also virtio-gpu, which supports migration,
> > we also
> > > need to take care of that. It is not a problem for DMA-BUF as
> > > DMA-BUF is
> > > not migratable anyway, but the situation is different in this
> > case.
> > >
> > > Implementing cross-device sharing is certainly a possibility,
> > but that
> > > requires more than dealing with DMA-BUFs.
> > >
> > >
> > > So, if I understood correctly, dmabufs are just a subset of the
> > resources
> > > that the gpu manages, or can assign UUIDs to. I am not sure why
> > > the virt gpu driver would want to send a ASSIGN_UUID for anything
> > > that is not a dmabuf (are we sure it does?), but I am not super
> > familiarized
> > > with virtgpu to begin with.
> >
> > In my understanding, an resource will be first created as OpenGL or
> > Vulkan textures and then exported as a DMA-BUF file descriptor. For
> > these resource types exporting/importing code is mandatory.
> >
> > For pixman buffers (i.e., non-virgl device), I don't see a compelling
> > reason to have cross-device sharing. It is possible to omit resource
> > UUID feature from non-virgl device to avoid implementing complicated
> > migration.
> >
> >
> > I see, thanks for the clarification.
> > I would assume you could avoid the UUID feature for those resources, but
> > I will need to check the driver implementation. It is worth checking
> > though, if
> > that would simplify the implementation.
> >
> >
> > > But I see that internally, the GPU specs relate a UUID with a
> > resource_id,
> > > so we still need both tables:
> > > - one to relate UUID with resource_id to be able to locate the
> > > underlying resource
> > > - the table that holds the dmabuf with the UUID for cross-device
> > sharing
> > >
> > > With that in mind, sounds to me that the support for cross-device
> > > sharing could
> > > be added on top of this patch, once
> > >
> > https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01850.html
> > <https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01850.html
> >
> > >
> > <https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01850.html
> > <https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01850.html
> >>
> > > lands.
> >
> > That is possible, but I think it's better to implement cross-device
> > sharing at the same time introducing virtio-dmabuf.
> >
> > The current design of virtio-dmabuf looks somewhat inconsistent; it's
> > named "dmabuf", but internally the UUIDs are stored into something
> > named
> > "resource_uuids" and it has SharedObjectType so it's more like a
> > generic
> > resource sharing mechanism. If you actually have an implementation of
> > cross-device sharing using virtio-dmabuf, it will be clear what kind
> of
> > feature is truly necessary.
> >
> >
> > Yeah, the file was named as virtio-dmabuf following the kernel
> > implementation. Also, because for the moment it only aims to share
> > dmabufs. However, virtio specs leave the virtio object defintion vague
> [1]
> > (I guess purposely). It is up to the specific devices to define what an
> > object
> > means for them. So the implementation tries to follow that, and
> > leave the contents of the table generic. The table can hold any kind of
> > object,
> > and the API exposes type-specific functions (for dmabufs, or others).
> In the guest kernel, the name "virtio_dma_buf" represents the interface
> between the *guest* kernel and *guest* user-space. It makes sense since
> the cross-device resource sharing is managed by the userspace and
> DMA-BUF is the only interface between them for this purpose.
>
> The situation is different for QEMU; QEMU interacts with backends using
> backend-specific interfaces (OpenGL/pixman) and virgl is capable to
> export textures as DMA-BUF. DMA-BUF is not universal in this sense. As
> such, we cannot just borrow the kernel-side naming but invent one.
>
> It is not a gpu-specific feature. It is a generic cross-device sharing
mechanism for virtio objects. In this case, virtio objects happen to be
dmabufs in this first iteration. Hence, the name.
virtio-gpu (and vhost-user-gpu) will use this feature only with virgl, that
is
fine, and transversal to the object-sharing mechanism. It allows
to share dmabufs in the host following how they are shared in the guest.
The virtgpu driver may call ASSIGN_UUID for other types of resources (not
sure,
but could be), but they will never be shared with other virtio devices.
So they are not too relevant. Also, the shared objects table could
potentially
be accessed from any virtio device, not only virtio-gpu or virtio-video.
What I am trying to say, is that the name focuses solely in its current
usage,
i.e., sharing dmabufs between virtio-gpu (as exporter), and virtio-video
(as importer).
If it grows to something more, imo it can be renamed later.
Regards,
Albert
[-- Attachment #2: Type: text/html, Size: 17849 bytes --]
next prev parent reply other threads:[~2023-09-14 8:30 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 9:32 [QEMU PATCH v4 00/13] Support blob memory and venus on qemu Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 01/13] virtio: Add shared memory capability Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 02/13] virtio-gpu: CONTEXT_INIT feature Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 03/13] virtio-gpu: hostmem Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 04/13] virtio-gpu: blob prep Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 05/13] virtio-gpu: Support context init feature with virglrenderer Huang Rui
2023-08-31 9:41 ` Philippe Mathieu-Daudé
2023-08-31 9:32 ` [QEMU PATCH v4 06/13] virtio-gpu: Configure context init for virglrenderer Huang Rui
2023-08-31 9:39 ` Philippe Mathieu-Daudé
2023-09-04 6:45 ` Huang Rui via
2023-08-31 9:32 ` [QEMU PATCH v4 07/13] softmmu/memory: enable automatic deallocation of memory regions Huang Rui
2023-08-31 10:10 ` Akihiko Odaki
2023-09-05 9:07 ` Huang Rui
2023-09-05 9:17 ` Akihiko Odaki
2023-09-05 13:29 ` Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 08/13] virtio-gpu: Don't require udmabuf when blobs and virgl are enabled Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 09/13] virtio-gpu: Handle resource blob commands Huang Rui
2023-08-31 10:24 ` Akihiko Odaki
2023-09-05 9:08 ` Huang Rui
2023-09-05 9:20 ` Akihiko Odaki
2023-09-06 3:09 ` Huang Rui
2023-09-06 3:39 ` Akihiko Odaki
2023-09-06 7:56 ` Huang Rui
2023-09-06 14:16 ` Akihiko Odaki
2023-08-31 9:32 ` [QEMU PATCH v4 10/13] virtio-gpu: Resource UUID Huang Rui
2023-08-31 10:36 ` Akihiko Odaki
2023-09-09 9:09 ` Huang Rui
2023-09-10 4:21 ` Akihiko Odaki
2023-09-13 7:55 ` Albert Esteve
2023-09-13 10:34 ` Akihiko Odaki
2023-09-13 11:34 ` Albert Esteve
2023-09-13 12:22 ` Akihiko Odaki
2023-09-13 12:58 ` Albert Esteve
2023-09-13 13:43 ` Akihiko Odaki
2023-09-13 14:18 ` Albert Esteve
2023-09-13 14:27 ` Albert Esteve
2023-09-14 7:17 ` Akihiko Odaki
2023-09-14 8:29 ` Albert Esteve [this message]
2023-09-14 16:55 ` Akihiko Odaki
2023-09-15 9:56 ` Albert Esteve
2023-08-31 9:32 ` [QEMU PATCH v4 11/13] virtio-gpu: Support Venus capset Huang Rui
2023-08-31 10:43 ` Akihiko Odaki
2023-09-09 9:29 ` Huang Rui
2023-09-10 4:32 ` Akihiko Odaki
2023-08-31 9:32 ` [QEMU PATCH v4 12/13] virtio-gpu: Initialize Venus Huang Rui
2023-08-31 10:40 ` Antonio Caggiano
2023-08-31 15:51 ` Dmitry Osipenko
2023-09-09 10:53 ` Huang Rui via
2023-09-12 13:44 ` Dmitry Osipenko
2023-09-09 10:52 ` Huang Rui
2023-08-31 9:32 ` [QEMU PATCH v4 13/13] virtio-gpu: Enable virglrenderer render server flag for venus Huang Rui
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='CADSE00Kyid+=FkkopSGDAyeJ_MY2exDdxoPf18pzthKy70kkKg@mail.gmail.com' \
--to=aesteve@redhat.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Honglei1.Huang@amd.com \
--cc=Jiqian.Chen@amd.com \
--cc=Julia.Zhang@amd.com \
--cc=Pierre-eric.Pelloux-prayer@amd.com \
--cc=Xenia.Ragiadakou@amd.com \
--cc=akihiko.odaki@daynix.com \
--cc=alex.bennee@linaro.org \
--cc=anthony.perard@citrix.com \
--cc=antonio.caggiano@collabora.com \
--cc=bob.beckett@collabora.com \
--cc=dgilbert@redhat.com \
--cc=dmitry.osipenko@collabora.com \
--cc=ernunes@redhat.com \
--cc=gurchetansingh@chromium.org \
--cc=hi@alyssa.is \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=ray.huang@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).