qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, mukawa@igel.co.jp,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Wei Wang <wei.w.wang@intel.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	n nikolaev <n.nikolaev@virtualopensystems.com>
Subject: Re: [Qemu-devel] vhost-user graceful connect/disconnect
Date: Thu, 4 Jan 2018 10:47:44 +0000	[thread overview]
Message-ID: <20180104104744.GC10106@stefanha-x1.localdomain> (raw)
In-Reply-To: <1512291492.2209478.1513854089861.JavaMail.zimbra@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3243 bytes --]

On Thu, Dec 21, 2017 at 06:01:29AM -0500, Marc-André Lureau wrote:
> Hi
> 
> ----- Original Message -----
> > Hi,
> > Vhost-user implementations assume the slave is already running before
> > the master starts.  The slave is required during virtio device
> > initialization (e.g. feature bit negotiation) and so it is simplest to
> > assume that the master is already available and will respond immediately
> > to the VHOST_USER_GET_FEATURES message.
> > 
> > I have thought about how to let master and slave start in any order.
> > Some approaches involve changes to the VIRTIO specification so that
> > guest drivers can wait until the vhost-user connection is established.
> > 
> > We can avoid spec changes using PCI hotplug:
> > 
> > 1. Introduce a new vhost-user object that manages a connection:
> > 
> >    -chardev ...
> >    -object vhost-user,id=vhost-user0,chardev=chr0
> > 
> >    Note this object is *not* a NetClient.  It's a resource for managing
> >    a vhost-user connection and can be used with any device type (net,
> >    scsi, blk, etc).
> > 
> >    This object tries to establish a connection.  When a connection is
> >    established it sends vhost-user protocol messages to fetch
> >    information needed for virtio device initialization (like the number
> >    of virtqueues supported, features bits, etc).  This information is
> >    stashed so that vhost_*() calls later on do not require synchronous
> >    communication with the vhost-user slave.
> 
> This share similarities with vhost-user-backend I proposed here: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg01014.html
> 
> (instead of spawning a slave, talk to a chardev - both could eventually co-exist)

Yes, it's similar.  Thanks for the link!

> > 
> > 2. When the vhost-user connection is established the object emits a QMP
> >    event so management software can hotplug the virtio device:
> > 
> >    VHOST_USER_CONNECTED source=vhost-user0
> > 
> > 3. The management software hotplugs the virtio device:
> > 
> >    (qmp) netdev_add vhost-user,id=netdev0,vhost-user=vhost-user0
> >    (qmp) device_add virtio-net-pci,netdev=netdev0
> > 
> > Advantages of this approach:
> > 
> >  * Does not require spec changes.
> >  * Can be implemented without vhost-user.c qemu_chr_fe_read/write_all()
> >    calls that hang QEMU until the slave sends data.
> >  * Allows slave to set the number of queues, feature bits, etc via the
> >    vhost-user socket.  It is not necessary to manually specify feature
> >    bitmasks and other slave-specific information on the QEMU
> >    command-line.
> > 
> > I haven't thought through disconnection but I imagine the vhost-user
> > object would emit a VHOST_USER_DISCONNECTED event so the management
> > software can hot unplug the device.
> > 
> > Thoughts?
> 
> I am sorry, I can't think through all the potential issues easily. But that sounds interesting enough to start a proof-of-concept.
> 
> And we need more tests for vhost-user (including fixing the existing tests!)...

I'm not going to prototype this yet, I'm working on virtio-vhost-user
first, but eventually I might get back to -object vhost-user(-backend).

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2018-01-04 10:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19 16:21 [Qemu-devel] vhost-user graceful connect/disconnect Stefan Hajnoczi
2017-12-20  6:45 ` Fam Zheng
2017-12-20 15:56   ` Stefan Hajnoczi
2017-12-21 11:01 ` Marc-André Lureau
2018-01-04 10:47   ` Stefan Hajnoczi [this message]
2018-01-04 11:15     ` Wei Wang
2018-01-05 15:49       ` Stefan Hajnoczi
2018-01-08 11:22         ` Wei Wang
2018-01-08 16:09           ` Stefan Hajnoczi
2018-01-12  6:53             ` Wei Wang
2018-01-12 10:45               ` Stefan Hajnoczi
2018-01-04 16:53 ` Michael S. Tsirkin
2018-01-05 16:14   ` 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=20180104104744.GC10106@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=mukawa@igel.co.jp \
    --cc=n.nikolaev@virtualopensystems.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.w.wang@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).