All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.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: Mon, 2 May 2016 10:37:51 -0700	[thread overview]
Message-ID: <20160502173751.GM5641@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <20160502080610-mutt-send-email-mst@redhat.com>

On Mon, May 02, 2016 at 01:45:31PM +0300, Michael S. Tsirkin wrote:
> On Sun, May 01, 2016 at 02:04:42PM -0700, Yuanhan Liu wrote:
> > On Sun, May 01, 2016 at 02:37:19PM +0300, Michael S. Tsirkin wrote:
> > > On Fri, Apr 29, 2016 at 10:48:35AM -0700, Yuanhan Liu wrote:
> > > > > But, I
> > > > > would worry first about a backend that crashes that it may corrupt the
> > > > > VM memory too...
> > > > 
> > > > Not quite sure I follow this. But, backend just touches the virtio
> > > > related memory, so it will do no harm to the VM?
> > > 
> > > It crashed so apparently it's not behaving as designed -
> > > how can we be sure it does not harm the VM?
> > 
> > Hi Michael,
> > 
> > What I know so far, a crash might could corrupt the virtio memory in two
> > ways:
> > 
> > - vring_used_elem might be in stale state when we are in the middle of
> >   updating used vring. Say, we might have updated the "id" field, but
> >   leaving "len" untouched.
> > 
> > - vring desc buff might also be in stale state, when we are copying
> >   data into it.
> 
> 
> - a random write into VM memory due to backend bug corrupts it.
> 
> > However, the two issues will not be real issue, as used->idx is not
> > updated in both case. Thefore, those corrupted memory will not be
> > processed by guest. So, no harm I'd say. Or, am I missing anything?
> 
> Why is backend crashing? It shouldn't so maybe this means it's
> memory is corrupt. That is the claim.

As far as virtio memory is not corrupted (or even corrupt in above
ways), there would be no issue. But, yes, you made a good point: we
make no guarantees that it's not the virtio memory corruption caused
the crash.

> > BTW, Michael, what's your thoughts on the whole reconnect stuff?
> > 
> > 	--yliu
> 
> My thoughts are that we need to split these patchsets up.
> 
> There are several issues here:
> 
> 
> 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.

A monitor command is a good suggestion. But I'm thinking why vmstop is
necessary. Basically, a disconnect is as to a cable unplug to physical
NIC; we don't need pause it before unplugging.

> 
> 2. Unexpected disconnect
> - If buffers are processed in order or flushed before socket close,
>   then on disconnect status can be recovered
>   from ring alone. If that is of interest, we might want to add
>   a protocol flag for that. F_DISCONNECT_FLUSH ?

Sorry, what does this flag supposed to work here?

> Without this,
>   only graceful disconnect or reset with guest's help can be supported.
> - As Marc-André said, without graceful shutdown it is not enough to
>   handle ring state though.  We must handle socket getting disconnected
>   in the middle of send/receive.  While it's more work,
>   it does seem like a nice interface to support.

Same as above, what the backend (or QEMU) can do for this case without
the guest's (reset) help?


> - I understand the concern that existing guests do not handle NEED_RESET
>   status. One way to fix this would be a new feature bit. If NEED_RESET not
>   handled,

I could check the code by myself, but I'm thinking it might be trivial
for you to answer my question: how do we know that NEED_RESET is not
handled?

> request hot-unplug instead.

Same as above, may I know how to request a hot-unplug?

> 
> 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

Agreed. I guess that would anaswer my first question: we don't actually
need to do vmstop before disconnect.

	--yliu

> - 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.
> - Alternatively, we should also have an option to stop vm automatically (like we do on
>   disk errors) to reduce number of dropped packets.
> 
> 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.
> 
> 
> -- 
> MST

  parent reply	other threads:[~2016-05-02 17:34 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
2016-05-05  3:44                       ` Yuanhan Liu
2016-05-05 13:42                         ` Michael S. Tsirkin
2016-05-02 17:37               ` Yuanhan Liu [this message]
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=20160502173751.GM5641@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=huawei.xie@intel.com \
    --cc=i.maximets@samsung.com \
    --cc=jonshin@cisco.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=mst@redhat.com \
    --cc=mukawa@igel.co.jp \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.