qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>,
	QEMU <qemu-devel@nongnu.org>,
	Ilya Maximets <i.maximets@samsung.com>,
	jonshin@cisco.com, Tetsuya Mukawa <mukawa@igel.co.jp>,
	"Xie, Huawei" <huawei.xie@intel.com>
Subject: Re: [Qemu-devel] [PATCH 11/18] vhost-user: add shutdown support
Date: Wed, 4 May 2016 22:13:49 +0300	[thread overview]
Message-ID: <20160504220549-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <CAJ+F1CK0ib34Swuudj=QE8aePn=_usMMFV+8SGrKFouMEhu3mQ@mail.gmail.com>

On Wed, May 04, 2016 at 03:16:44PM +0200, Marc-André Lureau wrote:
> Hi
> 
> On Mon, May 2, 2016 at 2:04 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Mon, May 02, 2016 at 01:29:18PM +0200, Marc-André Lureau wrote:
> >> Hi
> >>
> >> On Mon, May 2, 2016 at 12:45 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> >> > 1. Graceful disconnect
> >> > - One should be able to do vmstop, disconnect, connect then vm start
> >> >   This looks like a nice intermediate step.
> >> > - Why would we always assume it's always remote initiating the disconnect?
> >> >   Monitor commands for disconnecting seem called for.
> >>
> >> Those two solutions involve VM management. This looks more complex to
> >> communicate/synchronize vhost-user backend & vm management & qemu. The
> >> use case I cover is request from the backend to shutdown,
> >
> > Right, but flushing buffers + closing the socket looks like
> > a cleaner interface than a ton of messages going back and forth.
> 
> What do you mean by "a ton of messages"? It adds
> VHOST_USER_SET_SLAVE_FD (generic), and VHOST_USER_SLAVE_SHUTDOWN. The
> amount of work to flush and close is the same regardless. I figured
> later that if we refactor vhost-user socket handling, we may be able
> to accept request from the main channel socket, without extra "slave
> channel".
> 
> >
> >> because
> >> that's what the users wanted (and it is already possible to stop the
> >> backend and disconnect it from qemu, we would only need to know when,
> >> with a new command..)
> >
> > You assume the backend has a monitor interface to disconnect though.
> > That's not a given.
> 
> What do you mean? The backend must have a way to request to close/quit
> indeed. That's outside of scope how the backend get this information
> (via signals or other means). It's external, having this information
> from VM management layer is the same (someone has to trigger this
> somehow).

Correct. So for symmetry if nothing else, besides handling
slave close request, we should be able to initiate close
from qemu with a new command, and get event when not connected.

Afterwards client can be killed with -9 as it's no longer
connected to qemu.


> >> > 3. Running while disconnected
> >> > - At the moment, we wait on vm start for remote to connect,
> >> >   if we support disconnecting backend without stopping
> >> >   we probably should also support starting it without waiting
> >> >   for connection
> >>
> >> That's what Tetsuya proposed in its initial series, but handling the
> >> flags was quite tedious.
> >
> > That would be up to management. E.g. let backend export the list
> > of flags it supports in some file, and apply to QEMU.
> 
> That makes me worry that such unfriendly connections details have to
> spread outside of vhost-user to VM management layer, making usage &
> maintenance harder for no clear benefit. It's a similar concern you
> have with "the backend has a monitor interface", here "the backend
> must have an introspection interface" or at least export vhost-user
> details somehow.

How can we start VM before backend connects otherwise?
Have better ideas?


> >
> >> I think this can be considered easily a
> >> seperate enhancement. What I proposed is to keep waiting for the
> >> initial connect, and check the flags remains compatible on reconnect.
> >
> > Seems asymmetrical unless we stop the vm.
> 
> That's the point, there will be time with and without the backend if
> we keep the VM running.
> 
> >> > - Guests expect tx buffers to be used in a timely manner, thus:
> >> > - If vm is running we must use them in qemu, maybe discarding packets
> >> >   in the process.
> >> >   There already are commands for link down, I'm not sure there's value
> >> >   in doing this automatically in qemu.
> >>
> >> Testing doesn't show such buffer issues when the link is down (this
> >> can be tested with vubr example above)
> >
> > Not enough testing then - it's a race condition: buffers can be sent
> > before link down.
> 
> Ok, I'll do more testing. In all cases, looks reasonable to discard.

Discard has some issues - for example processing ring in qemu
sometimes exposes us to more security risks.

> >
> >> > - Alternatively, we should also have an option to stop vm automatically (like we do on
> >> >   disk errors) to reduce number of dropped packets.
> >>
> >> Why not, we would need to know if this is actually useful.
> >>
> >> >
> >> > 4. Reconnecting
> >> > - When acting as a server, we might want an option to go back to
> >> >   listening state, but it should not be the only option,
> >> >   there should be a monitor command for moving it back to
> >> >   listening state.
> >> > - When acting as a client, auto-reconnect might be handy sometimes, but should not be the only
> >> >   option, there should be a way to manually request connect, possibly to
> >> >   a different target, so a monitor command for re-connecting seems called for.
> >> > - We'll also need monitor events for disconnects so management knows it
> >> >   must re-connect/restart listening.
> >> > - If we stopped VM, there could be an option to restart on reconnect.
> >>
> >> That's all involving a third party, adding complexity but the benefit
> >> isn't so clear.
> >
> > It's rather clear to me. Let's assume you want to restart bridge,
> > so you trigger disconnect.
> > If qemu auto-reconnects there's a race as it might re-connect
> > to the old bridge.
> 
> I would say that race can trivially be avoided, so it's a backend bug.

How do you avoid it?

> > Management is required to make this robust, auto-reconnect
> > is handy for people bypassing management.
> 
> tbh, I don't like autoreconnect. My previous series didn't include
> this and assumed the feature would be supported only when qemu is
> configured to be the server. I added reconnect upon request by users.

I don't have better solutions so OK I guess.

> -- 
> Marc-André Lureau

  reply	other threads:[~2016-05-04 19:14 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 11:16 [Qemu-devel] [PATCH 00/18] RFCv2: vhost-user: shutdown and reconnection marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 01/18] tests: append i386 tests marcandre.lureau
2016-04-01 20:30   ` [Qemu-devel] [PATCH 01/18 for-2.6] " Eric Blake
2016-04-01 11:16 ` [Qemu-devel] [PATCH 02/18] char: lower reconnect error to trace event marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 03/18] char: use a trace for when the char is waiting marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 04/18] char: add wait support for reconnect marcandre.lureau
2016-04-28  4:33   ` Yuanhan Liu
2016-04-01 11:16 ` [Qemu-devel] [PATCH 05/18] vhost-user: check reconnect comes with wait marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 06/18] vhost-user: add ability to know vhost-user backend disconnection marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 07/18] vhost: add vhost_dev stop callback marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 08/18] vhost-user: add vhost_user to hold the chr marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 09/18] qemu-char: add qemu_chr_disconnect to close a fd accepted by listen fd marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 10/18] vhost-user: add slave-fd support marcandre.lureau
2016-04-01 20:33   ` Eric Blake
2016-04-01 11:16 ` [Qemu-devel] [PATCH 11/18] vhost-user: add shutdown support marcandre.lureau
2016-04-13  2:49   ` Yuanhan Liu
2016-04-13  9:51     ` Marc-André Lureau
2016-04-13 17:32       ` Yuanhan Liu
2016-04-13 21:43         ` Marc-André Lureau
2016-04-13 21:57           ` Yuanhan Liu
2016-04-28  5:23   ` Yuanhan Liu
2016-04-29 10:40     ` Marc-André Lureau
2016-04-29 17:48       ` Yuanhan Liu
2016-05-01 11:37         ` Michael S. Tsirkin
2016-05-01 21:04           ` Yuanhan Liu
2016-05-02 10:45             ` Michael S. Tsirkin
2016-05-02 11:29               ` Marc-André Lureau
2016-05-02 12:04                 ` Michael S. Tsirkin
2016-05-02 17:50                   ` Yuanhan Liu
2016-05-04 13:16                   ` Marc-André Lureau
2016-05-04 19:13                     ` Michael S. Tsirkin [this message]
2016-05-05  3:44                       ` Yuanhan Liu
2016-05-05 13:42                         ` Michael S. Tsirkin
2016-05-02 17:37               ` Yuanhan Liu
2016-04-01 11:16 ` [Qemu-devel] [PATCH 12/18] vhost-user: disconnect on start failure marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 13/18] vhost-net: do not crash if backend is not present marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 14/18] vhost-net: save & restore vhost-user acked features marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 15/18] vhost-net: save & restore vring enable state marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 16/18] test: vubr check " marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 17/18] test: start vhost-user reconnect test marcandre.lureau
2016-04-01 11:16 ` [Qemu-devel] [PATCH 18/18] test: add shutdown support vubr test marcandre.lureau
2016-04-13  2:52   ` Yuanhan Liu

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=20160504220549-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=huawei.xie@intel.com \
    --cc=i.maximets@samsung.com \
    --cc=jonshin@cisco.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=mukawa@igel.co.jp \
    --cc=qemu-devel@nongnu.org \
    --cc=yuanhan.liu@linux.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).