Vhost and vhost-net support for userspace based backends
Get series with b4
b4 am 1387548640-7120-1-git-send-email-m.hamayun@virtualopensystems.comVersions newest first
- v4 Latest7 patches 1 replyIn review
Changes in v4 from the cover letter
- Convert -mem-path to QemuOpts with prealloc, share and unlink properties
- Set 1 sec timeout when read/write to the unix domain socket
- Fix file descriptor leak
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | Convert -mem-path to QemuOpts and add prealloc, share and unlink propertiesexec.c include/ qemu-options.hx +1 more | +91 | 0 replies | |
| 2/7 | Decouple vhost from kernel interfacehw/ hw/ hw/ +4 more | +147 | 0 replies | |
| 3/7 | Add vhost-user skeletonhw/ hw/ include/ +2 more | +91 | 0 replies | |
| 4/7 | Add domain socket communication for vhost-user backendhw/ | +161 | 1 reply | |
| 5/7 | Add vhost-user calls implementationhw/ | +134 | 0 replies | |
| 6/7 | Add new vhost-user netdev backendhmp-commands.hx hw/ hw/ +10 more | +227 | 0 replies | |
| 7/7 | Add vhost-user reconnectionhw/ hw/ include/ +2 more | +101 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [Qemu-devel] [PATCH v4 0/7] Vhost and vhost-net support for userspace based backends
From: "Mian M. Hamayun" <[email protected]>
In this patch series we would like to introduce our approach for putting a virtio-net backend in an external userspace process. Our eventual target is to run the network backend in the Snabbswitch ethernet switch, while receiving traffic from a guest inside QEMU/KVM which runs an unmodified virtio-net implementation.
For this, we are working into extending vhost to allow equivalent functionality for userspace. Vhost already passes control of the data plane of virtio-net to the host kernel; we want to realize a similar model, but for userspace.
In this patch series the concept of a vhost-backend is introduced.
We define two vhost backend types - vhost-kernel and vhost-user. The former is the interface to the current kernel module implementation. Its control plane is ioctl based. The data plane is the kernel directly accessing the QEMU allocated, guest memory.
In the new vhost-user backend, the control plane is based on communication between QEMU and another userspace process using a unix domain socket. This allows to implement a virtio backend for a guest running in QEMU, inside the other userspace process.
We change -mem-path to QemuOpts and add prealloc, share and unlink as properties to it. HugeTLBFS requirements of -mem-path are relaxed, so any valid path can be used now. The new properties allow more fine grained control over the guest RAM backing store.
The data path is realized by directly accessing the vrings and the buffer data off the guest's memory.
The current user of vhost-user is only vhost-net. We add new netdev backend that is intended to initialize vhost-net with vhost-user backend.
Example usage:
qemu -m 1024 -mem-path /hugetlbfs,prealloc=on,share=on \
-netdev type=vhost-user,id=net0,file=/path/to/sock \
-device virtio-net-pci,netdev=net0Changes from v3:
- Convert -mem-path to QemuOpts with prealloc, share and unlink properties
- Set 1 sec timeout when read/write to the unix domain socket
- Fix file descriptor leak
Changes from v2:
- Reconnect when the backend disappears
Changes from v1:
- Implementation of vhost-user netdev backend
- Code improvements
Antonios Motakis (7):
Convert -mem-path to QemuOpts and add prealloc,share and unlink
properties
Decouple vhost from kernel interface
Add vhost-user skeleton
Add domain socket communication for vhost-user backend Add vhost-user calls implementation
Add new vhost-user netdev backend
Add vhost-user reconnection
exec.c | 57 +++++- hmp-commands.hx | 4 +- hw/net/vhost_net.c | 144 ++++++++++---- hw/net/virtio-net.c | 42 ++-- hw/scsi/vhost-scsi.c | 13 +- hw/virtio/Makefile.objs | 2 +- hw/virtio/vhost-backend.c | 409 ++++++++++++++++++++++++++++++++++++++ hw/virtio/vhost.c | 46 +++-- include/exec/cpu-all.h | 3 - include/hw/virtio/vhost-backend.h | 40 ++++ include/hw/virtio/vhost.h | 4 +- include/net/vhost-user.h | 17 ++ include/net/vhost_net.h | 15 +- net/Makefile.objs | 2 +- net/clients.h | 3 + net/hub.c | 1 + net/net.c | 2 + net/tap.c | 16 +- net/vhost-user.c | 167 ++++++++++++++++ qapi-schema.json | 18 +- qemu-options.hx | 13 +- vl.c | 41 +++- 22 files changed, 935 insertions(+), 124 deletions(-) create mode 100644 hw/virtio/vhost-backend.c create mode 100644 include/hw/virtio/vhost-backend.h create mode 100644 include/net/vhost-user.h create mode 100644 net/vhost-user.c
Signature · 1 line
1.8.3.2