Thread (55 messages) 55 messages, 4 authors, 2021-01-10

Re: Re: [RFC v2 06/13] vduse: Introduce VDUSE - vDPA Device in Userspace

From: Yongji Xie <hidden>
Date: 2021-01-10 10:05:04
Also in: kvm, linux-fsdevel, linux-mm

On Fri, Jan 8, 2021 at 9:32 PM Bob Liu [off-list ref] wrote:
On 12/22/20 10:52 PM, Xie Yongji wrote:
quoted
This VDUSE driver enables implementing vDPA devices in userspace.
Both control path and data path of vDPA devices will be able to
be handled in userspace.

In the control path, the VDUSE driver will make use of message
mechnism to forward the config operation from vdpa bus driver
to userspace. Userspace can use read()/write() to receive/reply
those control messages.

In the data path, the VDUSE driver implements a MMU-based on-chip
IOMMU driver which supports mapping the kernel dma buffer to a
userspace iova region dynamically. Userspace can access those
iova region via mmap(). Besides, the eventfd mechanism is used to
trigger interrupt callbacks and receive virtqueue kicks in userspace

Now we only support virtio-vdpa bus driver with this patch applied.

Signed-off-by: Xie Yongji <redacted>
---
 Documentation/driver-api/vduse.rst                 |   74 ++
 Documentation/userspace-api/ioctl/ioctl-number.rst |    1 +
 drivers/vdpa/Kconfig                               |    8 +
 drivers/vdpa/Makefile                              |    1 +
 drivers/vdpa/vdpa_user/Makefile                    |    5 +
 drivers/vdpa/vdpa_user/eventfd.c                   |  221 ++++
 drivers/vdpa/vdpa_user/eventfd.h                   |   48 +
 drivers/vdpa/vdpa_user/iova_domain.c               |  442 ++++++++
 drivers/vdpa/vdpa_user/iova_domain.h               |   93 ++
 drivers/vdpa/vdpa_user/vduse.h                     |   59 ++
 drivers/vdpa/vdpa_user/vduse_dev.c                 | 1121 ++++++++++++++++++++
 include/uapi/linux/vdpa.h                          |    1 +
 include/uapi/linux/vduse.h                         |   99 ++
 13 files changed, 2173 insertions(+)
 create mode 100644 Documentation/driver-api/vduse.rst
 create mode 100644 drivers/vdpa/vdpa_user/Makefile
 create mode 100644 drivers/vdpa/vdpa_user/eventfd.c
 create mode 100644 drivers/vdpa/vdpa_user/eventfd.h
 create mode 100644 drivers/vdpa/vdpa_user/iova_domain.c
 create mode 100644 drivers/vdpa/vdpa_user/iova_domain.h
 create mode 100644 drivers/vdpa/vdpa_user/vduse.h
 create mode 100644 drivers/vdpa/vdpa_user/vduse_dev.c
 create mode 100644 include/uapi/linux/vduse.h
diff --git a/Documentation/driver-api/vduse.rst b/Documentation/driver-api/vduse.rst
new file mode 100644
index 000000000000..da9b3040f20a
--- /dev/null
+++ b/Documentation/driver-api/vduse.rst
@@ -0,0 +1,74 @@
+==================================
+VDUSE - "vDPA Device in Userspace"
+==================================
+
+vDPA (virtio data path acceleration) device is a device that uses a
+datapath which complies with the virtio specifications with vendor
+specific control path. vDPA devices can be both physically located on
+the hardware or emulated by software. VDUSE is a framework that makes it
+possible to implement software-emulated vDPA devices in userspace.
+
Could you explain a bit more why need a VDUSE framework?
This can be used to implement a userspace I/O (such as storage,
network and so on) solution (virtio-based) for both container and VM.
Software emulated vDPA devices is more likely used by debugging only when
don't have real hardware.
I think software emulated vDPA devices should be also useful in other
cases, just like FUSE does.
Do you think do the emulation in kernel space is not enough?
Doing the emulation in userspace should be more flexible.

Thanks,
Yongji
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help