From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: "Michael S. Tsirkin" <mst@redhat.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: Fri, 29 Apr 2016 12:40:09 +0200 [thread overview]
Message-ID: <CAJ+F1CLWsQFOf2kn0bQLmT7HyF=jSDKAf8B+f8zVy-20rZbuxA@mail.gmail.com> (raw)
In-Reply-To: <20160428052304.GF25677@yliu-dev.sh.intel.com>
Hi
On Thu, Apr 28, 2016 at 7:23 AM, Yuanhan Liu
<yuanhan.liu@linux.intel.com> wrote:
> On Fri, Apr 01, 2016 at 01:16:21PM +0200, marcandre.lureau@redhat.com wrote:
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>> docs/specs/vhost-user.txt | 15 +++++++++++++++
>> hw/virtio/vhost-user.c | 16 ++++++++++++++++
>> 2 files changed, 31 insertions(+)
>>
>> diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt
>> index 8a635fa..60d6d13 100644
>> --- a/docs/specs/vhost-user.txt
>> +++ b/docs/specs/vhost-user.txt
>> @@ -487,3 +487,18 @@ Message types
>> request to the master. It is passed in the ancillary data.
>> This message is only sent if VHOST_USER_PROTOCOL_F_SLAVE_CHANNEL
>> feature is available.
>> +
>> +Slave message types
>> +-------------------
>> +
>> + * VHOST_USER_SLAVE_SHUTDOWN:
>> + Id: 1
>> + Master payload: N/A
>> + Slave payload: u64
>> +
>> + Request the master to shutdown the slave. A 0 reply is for
>> + success, in which case the slave may close all connections
>> + immediately and quit. A non-zero reply cancels the request.
>> +
>> + Before a reply comes, the master may make other requests in
>> + order to flush or sync state.
>
> Hi all,
>
> I threw this proposal as well as DPDK's implementation to our customer
> (OVS, Openstack and some other teams) who made such request before. I'm
> sorry to say that none of them really liked that we can't handle crash.
> Making reconnect work from a vhost-user backend crash is exactly something
> they are after.
Handling crashes is not quite the same as what I propose here. I see
it as a different goal. But I doubt about usefulness and reliability
of a backend that crashes. In many case, vhost-user was designed after
kernel vhost, and qemu code has the same expectation about the kernel
or the vhost-user backend: many calls are sync and will simply
assert() on unexpected results.
> And to handle the crash, I was thinking of the proposal from Michael.
> That is to do reset from the guest OS. This would fix this issue
> ultimately. However, old kernel will not benefit from this, as well
> as other guest other than Linux, making it not that useful for current
> usage.
Yes, I hope Michael can help with that, I am not very familiar with
the kernel code.
> Thinking of that the VHOST_USER_SLAVE_SHUTDOWN just gives QEMU a chance
> to get the vring base (last used idx) from the backend, Huawei suggests
Right, but after this message, the backend should have flushed all
pending ring packets and stop processing them. So it's also a clean
sync point.
> that we could still make it in a consistent state after the crash, if
> we get the vring base from vring->used->idx. That worked as expected
You can have a backend that would have already processed packets and
not updated used idx. You could also have out-of-order packets in
flights (ex: desc 1-2-3 avail, 1-3 used, 2 pending..). I can't see a
clean way to restore this, but to reset the queues and start over,
with either packet loss or packet duplication. If the backend
guarantees to process packets in order, it may simplify things, but it
would be a special case.
> from my test. The only tricky thing might be how to detect a crash,
> and we could do a simple compare of the vring base from QEMU with
> the vring->used->idx at the initiation stage. If mismatch found, get
> it from vring->used->idx instead.
I don't follow, would the backend restore its last vring->used->idx
after a crash?
> Comments/thoughts? Is it a solid enough solution to you? If so, we
> could make things much simpler, and what's most important, we could
> be able to handle crash.
That's not so easy, many of the vhost_ops->vhost*() are followed by
assert(r>0), which will be hard to change to handle failure. But, I
would worry first about a backend that crashes that it may corrupt the
VM memory too...
--
Marc-André Lureau
next prev parent reply other threads:[~2016-04-29 10:40 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 [this message]
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
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='CAJ+F1CLWsQFOf2kn0bQLmT7HyF=jSDKAf8B+f8zVy-20rZbuxA@mail.gmail.com' \
--to=marcandre.lureau@gmail.com \
--cc=huawei.xie@intel.com \
--cc=i.maximets@samsung.com \
--cc=jonshin@cisco.com \
--cc=mst@redhat.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).