[PATCH v3 0/4] Virtio shared dma-buf

Albert Esteve posted 4 patches 11 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230524091333.201767-1-aesteve@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Albert Esteve <aesteve@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
MAINTAINERS                               |   7 ++
docs/interop/vhost-user.rst               |  15 +++
hw/display/meson.build                    |   1 +
hw/display/virtio-dmabuf.c                |  90 +++++++++++++++++
hw/virtio/vhost-user.c                    |  90 ++++++++++++++---
include/hw/virtio/virtio-dmabuf.h         |  59 ++++++++++++
include/qemu/uuid.h                       |   2 +
subprojects/libvhost-user/libvhost-user.c |  88 +++++++++++++++++
subprojects/libvhost-user/libvhost-user.h |  56 +++++++++++
tests/unit/meson.build                    |   1 +
tests/unit/test-uuid.c                    |  27 ++++++
tests/unit/test-virtio-dmabuf.c           | 112 ++++++++++++++++++++++
util/uuid.c                               |  14 +++
13 files changed, 549 insertions(+), 13 deletions(-)
create mode 100644 hw/display/virtio-dmabuf.c
create mode 100644 include/hw/virtio/virtio-dmabuf.h
create mode 100644 tests/unit/test-virtio-dmabuf.c
[PATCH v3 0/4] Virtio shared dma-buf
Posted by Albert Esteve 11 months, 2 weeks ago
v1 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg00598.html
v2 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg04530.html
v2 -> v3:
    - Change UUID hash function strategy to djb
    - Add qemu_uuid_is_equal wrapper

This patch covers the required steps to add support for virtio cross-device resource sharing[1],
which support is already available in the kernel.

The main usecase will be sharing dma buffers from virtio-gpu devices (as the exporter
-see VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID in [2]), to virtio-video (under discussion)
devices (as the buffer-user or importer). Therefore, even though virtio specs talk about
resources or objects[3], this patch adds the infrastructure with dma-bufs in mind.
Note that virtio specs let the devices themselves define what a vitio object is.

These are the main parts that are covered in the patch:

- Add hash_func and key_equal_func to uuid
- Shared resources table, to hold all resources that can be shared in the host and their assigned UUID
- Internal shared table API for virtio devices to add, lookup and remove resources
- Unit test to verify the API.
- New message to the vhost-user protocol to allow backend to interact with the shared
  table API through the control socket

Applies cleanly to 1c12355

[1] - https://lwn.net/Articles/828988/
[2] - https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-3730006
[3] - https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-10500011

Albert Esteve (4):
  uuid: add hash_func and equal_func
  virtio-dmabuf: introduce virtio-dmabuf
  vhost-user: add shared_object msg
  vhost-user: refactor send_resp code

 MAINTAINERS                               |   7 ++
 docs/interop/vhost-user.rst               |  15 +++
 hw/display/meson.build                    |   1 +
 hw/display/virtio-dmabuf.c                |  90 +++++++++++++++++
 hw/virtio/vhost-user.c                    |  90 ++++++++++++++---
 include/hw/virtio/virtio-dmabuf.h         |  59 ++++++++++++
 include/qemu/uuid.h                       |   2 +
 subprojects/libvhost-user/libvhost-user.c |  88 +++++++++++++++++
 subprojects/libvhost-user/libvhost-user.h |  56 +++++++++++
 tests/unit/meson.build                    |   1 +
 tests/unit/test-uuid.c                    |  27 ++++++
 tests/unit/test-virtio-dmabuf.c           | 112 ++++++++++++++++++++++
 util/uuid.c                               |  14 +++
 13 files changed, 549 insertions(+), 13 deletions(-)
 create mode 100644 hw/display/virtio-dmabuf.c
 create mode 100644 include/hw/virtio/virtio-dmabuf.h
 create mode 100644 tests/unit/test-virtio-dmabuf.c

-- 
2.40.0
Re: [PATCH v3 0/4] Virtio shared dma-buf
Posted by Michael S. Tsirkin 10 months, 2 weeks ago
On Wed, May 24, 2023 at 11:13:29AM +0200, Albert Esteve wrote:
> v1 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg00598.html
> v2 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg04530.html
> v2 -> v3:
>     - Change UUID hash function strategy to djb
>     - Add qemu_uuid_is_equal wrapper

Posted some minor comments. Pls address and I'll merge.


> This patch covers the required steps to add support for virtio cross-device resource sharing[1],
> which support is already available in the kernel.
> 
> The main usecase will be sharing dma buffers from virtio-gpu devices (as the exporter
> -see VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID in [2]), to virtio-video (under discussion)
> devices (as the buffer-user or importer). Therefore, even though virtio specs talk about
> resources or objects[3], this patch adds the infrastructure with dma-bufs in mind.
> Note that virtio specs let the devices themselves define what a vitio object is.
> 
> These are the main parts that are covered in the patch:
> 
> - Add hash_func and key_equal_func to uuid
> - Shared resources table, to hold all resources that can be shared in the host and their assigned UUID
> - Internal shared table API for virtio devices to add, lookup and remove resources
> - Unit test to verify the API.
> - New message to the vhost-user protocol to allow backend to interact with the shared
>   table API through the control socket
> 
> Applies cleanly to 1c12355
> 
> [1] - https://lwn.net/Articles/828988/
> [2] - https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-3730006
> [3] - https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-10500011
> 
> Albert Esteve (4):
>   uuid: add hash_func and equal_func
>   virtio-dmabuf: introduce virtio-dmabuf
>   vhost-user: add shared_object msg
>   vhost-user: refactor send_resp code
> 
>  MAINTAINERS                               |   7 ++
>  docs/interop/vhost-user.rst               |  15 +++
>  hw/display/meson.build                    |   1 +
>  hw/display/virtio-dmabuf.c                |  90 +++++++++++++++++
>  hw/virtio/vhost-user.c                    |  90 ++++++++++++++---
>  include/hw/virtio/virtio-dmabuf.h         |  59 ++++++++++++
>  include/qemu/uuid.h                       |   2 +
>  subprojects/libvhost-user/libvhost-user.c |  88 +++++++++++++++++
>  subprojects/libvhost-user/libvhost-user.h |  56 +++++++++++
>  tests/unit/meson.build                    |   1 +
>  tests/unit/test-uuid.c                    |  27 ++++++
>  tests/unit/test-virtio-dmabuf.c           | 112 ++++++++++++++++++++++
>  util/uuid.c                               |  14 +++
>  13 files changed, 549 insertions(+), 13 deletions(-)
>  create mode 100644 hw/display/virtio-dmabuf.c
>  create mode 100644 include/hw/virtio/virtio-dmabuf.h
>  create mode 100644 tests/unit/test-virtio-dmabuf.c
> 
> -- 
> 2.40.0
Re: [PATCH v3 0/4] Virtio shared dma-buf
Posted by Albert Esteve 10 months, 2 weeks ago
Hi!

It has been a month since I sent this patch, so I'll give it a bump to get
some attention back.

@mst and @Fam any comments? What would be the next steps to take to move
this forward?

BR,
Albert


On Wed, May 24, 2023 at 11:13 AM Albert Esteve <aesteve@redhat.com> wrote:

> v1 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg00598.html
> v2 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg04530.html
> v2 -> v3:
>     - Change UUID hash function strategy to djb
>     - Add qemu_uuid_is_equal wrapper
>
> This patch covers the required steps to add support for virtio
> cross-device resource sharing[1],
> which support is already available in the kernel.
>
> The main usecase will be sharing dma buffers from virtio-gpu devices (as
> the exporter
> -see VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID in [2]), to virtio-video (under
> discussion)
> devices (as the buffer-user or importer). Therefore, even though virtio
> specs talk about
> resources or objects[3], this patch adds the infrastructure with dma-bufs
> in mind.
> Note that virtio specs let the devices themselves define what a vitio
> object is.
>
> These are the main parts that are covered in the patch:
>
> - Add hash_func and key_equal_func to uuid
> - Shared resources table, to hold all resources that can be shared in the
> host and their assigned UUID
> - Internal shared table API for virtio devices to add, lookup and remove
> resources
> - Unit test to verify the API.
> - New message to the vhost-user protocol to allow backend to interact with
> the shared
>   table API through the control socket
>
> Applies cleanly to 1c12355
>
> [1] - https://lwn.net/Articles/828988/
> [2] -
> https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-3730006
> [3] -
> https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-10500011
>
> Albert Esteve (4):
>   uuid: add hash_func and equal_func
>   virtio-dmabuf: introduce virtio-dmabuf
>   vhost-user: add shared_object msg
>   vhost-user: refactor send_resp code
>
>  MAINTAINERS                               |   7 ++
>  docs/interop/vhost-user.rst               |  15 +++
>  hw/display/meson.build                    |   1 +
>  hw/display/virtio-dmabuf.c                |  90 +++++++++++++++++
>  hw/virtio/vhost-user.c                    |  90 ++++++++++++++---
>  include/hw/virtio/virtio-dmabuf.h         |  59 ++++++++++++
>  include/qemu/uuid.h                       |   2 +
>  subprojects/libvhost-user/libvhost-user.c |  88 +++++++++++++++++
>  subprojects/libvhost-user/libvhost-user.h |  56 +++++++++++
>  tests/unit/meson.build                    |   1 +
>  tests/unit/test-uuid.c                    |  27 ++++++
>  tests/unit/test-virtio-dmabuf.c           | 112 ++++++++++++++++++++++
>  util/uuid.c                               |  14 +++
>  13 files changed, 549 insertions(+), 13 deletions(-)
>  create mode 100644 hw/display/virtio-dmabuf.c
>  create mode 100644 include/hw/virtio/virtio-dmabuf.h
>  create mode 100644 tests/unit/test-virtio-dmabuf.c
>
> --
> 2.40.0
>
>
Re: [PATCH v3 0/4] Virtio shared dma-buf
Posted by Michael S. Tsirkin 10 months, 2 weeks ago
On Wed, Jun 21, 2023 at 10:20:25AM +0200, Albert Esteve wrote:
> Hi!
> 
> It has been a month since I sent this patch, so I'll give it a bump to get some
> attention back.
> 
> @mst and @Fam any comments? What would be the next steps to take to move this
> forward?
> 
> BR,
> Albert

No one seems to be worried by this patchset so I queued it.

-- 
MST
Re: [PATCH v3 0/4] Virtio shared dma-buf
Posted by Michael S. Tsirkin 10 months, 2 weeks ago
On Wed, Jun 21, 2023 at 10:20:25AM +0200, Albert Esteve wrote:
> Hi!
> 
> It has been a month since I sent this patch, so I'll give it a bump to get some
> attention back.
> 
> @mst and @Fam any comments? What would be the next steps to take to move this
> forward?
> 
> BR,
> Albert
> 
> 

I'd really want help from Gerd here. Don't know enough about dmabuf.
Gerd any comments or I'll just merge?


-- 
MST