qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, zhiyong.yang@intel.com,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	jasowang@redhat.com, Wei Wang <wei.w.wang@intel.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [RFC 0/2] virtio-vhost-user: add virtio-vhost-user device
Date: Fri, 19 Jan 2018 13:06:51 +0000	[thread overview]
Message-ID: <20180119130653.24044-1-stefanha@redhat.com> (raw)

These patches implement the virtio-vhost-user device design that I have
described here:
https://stefanha.github.io/virtio/vhost-user-slave.html#x1-2830007

The goal is to let the guest act as the vhost device backend for other guests.
This allows virtual networking and storage appliances to run inside guests.
This device is particularly interesting for poll mode drivers where exitless
VM-to-VM communication is possible, completely bypassing the hypervisor in the
data path.

The DPDK driver is here:
https://github.com/stefanha/dpdk/tree/virtio-vhost-user

For more information, see
https://wiki.qemu.org/Features/VirtioVhostUser.

virtio-vhost-user is inspired by Wei Wang and Zhiyong Yang's vhost-pci work.
It differs from vhost-pci in that it has:
1. Vhost-user protocol message tunneling, allowing existing vhost-user
   slave software to be reused inside the guest.
2. Support for all vhost device types.
3. Disconnected operation and reconnection support.
4. Asynchronous vhost-user socket implementation that avoids blocking.

I have written this code to demonstrate how the virtio-vhost-user approach
works and that it is more maintainable than vhost-pci because vhost-user slave
software can use both AF_UNIX and virtio-vhost-user without significant code
changes to the vhost device backends.

One of the main concerns about virtio-vhost-user was that the QEMU
virtio-vhost-user device implementation could be complex because it needs to
parse all messages.  I hope this patch series shows that it's actually very
simple because most messages are passed through.

After this patch series has been reviewed, we need to decide whether to follow
the original vhost-pci approach or to use this one.  Either way, both patch
series still require improvements before they can be merged.  Here are my todos
for this series:

 * Implement "Additional Device Resources over PCI" for shared memory,
   doorbells, and notifications instead of hardcoding a BAR with magic
   offsets into virtio-vhost-user:
   https://stefanha.github.io/virtio/vhost-user-slave.html#x1-2920007
 * Implement the VRING_KICK eventfd - currently vhost-user slaves must be poll
   mode drivers.
 * Optimize VRING_CALL doorbell with ioeventfd to avoid QEMU exit.
 * vhost-user log feature
 * UUID config field for stable device identification regardless of PCI
   bus addresses.
 * vhost-user IOMMU and SLAVE_REQ_FD feature
 * VhostUserMsg little-endian conversion for cross-endian support
 * Chardev disconnect using qemu_chr_fe_set_watch() since CHR_CLOSED is
   only emitted while a read callback is registered.  We don't keep a
   read callback registered all the time.
 * Drain txq on reconnection to discard stale messages.

Stefan Hajnoczi (1):
  virtio-vhost-user: add virtio-vhost-user device

Wei Wang (1):
  vhost-user: share the vhost-user protocol related structures

 configure                                   |   18 +
 hw/virtio/Makefile.objs                     |    1 +
 hw/virtio/virtio-pci.h                      |   21 +
 include/hw/pci/pci.h                        |    1 +
 include/hw/virtio/vhost-user.h              |  106 +++
 include/hw/virtio/virtio-vhost-user.h       |   88 +++
 include/standard-headers/linux/virtio_ids.h |    1 +
 hw/virtio/vhost-user.c                      |  100 +--
 hw/virtio/virtio-pci.c                      |   61 ++
 hw/virtio/virtio-vhost-user.c               | 1047 +++++++++++++++++++++++++++
 hw/virtio/trace-events                      |   22 +
 11 files changed, 1367 insertions(+), 99 deletions(-)
 create mode 100644 include/hw/virtio/vhost-user.h
 create mode 100644 include/hw/virtio/virtio-vhost-user.h
 create mode 100644 hw/virtio/virtio-vhost-user.c

-- 
2.14.3

             reply	other threads:[~2018-01-19 13:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 13:06 Stefan Hajnoczi [this message]
2018-01-19 13:06 ` [Qemu-devel] [RFC 1/2] vhost-user: share the vhost-user protocol related structures Stefan Hajnoczi
2018-01-19 13:06 ` [Qemu-devel] [RFC 2/2] virtio-vhost-user: add virtio-vhost-user device Stefan Hajnoczi
2018-01-19 13:55 ` [Qemu-devel] [RFC 0/2] " Stefan Hajnoczi
2018-01-22  3:33 ` Jason Wang
2018-01-22 12:17   ` Stefan Hajnoczi
2018-01-22 20:04     ` Michael S. Tsirkin
2018-01-23 10:01       ` Jason Wang
2018-01-23 16:07         ` Michael S. Tsirkin
2018-01-25 14:07           ` Paolo Bonzini
2018-01-25 14:48             ` Michael S. Tsirkin
2018-01-26  3:49               ` Jason Wang
2018-01-23 10:09       ` Stefan Hajnoczi
2018-01-23 10:46     ` Wei Wang
2018-01-22 11:09 ` Wei Wang
2018-01-23 11:12   ` Stefan Hajnoczi
2018-01-23 13:06     ` Wei Wang
2018-01-24 11:40       ` Stefan Hajnoczi
2018-01-25 10:19         ` Wei Wang
2018-01-26 14:44           ` Stefan Hajnoczi
2018-01-30 12:09             ` Wei Wang
2018-02-01 17:08               ` Michael S. Tsirkin
2018-02-02 13:08                 ` Wei Wang
2018-02-05 16:25                   ` Stefan Hajnoczi
2018-02-06  1:28                     ` Wang, Wei W
2018-02-06  9:31                       ` Stefan Hajnoczi
2018-02-06 12:42                         ` Wang, Wei W
2018-02-06 14:13                           ` Stefan Hajnoczi
2018-02-02 15:25               ` Stefan Hajnoczi
2018-02-05  9:57                 ` Wang, Wei W
2018-02-05 15:57                   ` Stefan Hajnoczi

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=20180119130653.24044-1-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.w.wang@intel.com \
    --cc=zhiyong.yang@intel.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;
as well as URLs for NNTP newsgroup(s).