[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/25] vhost user: add support of live migration
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 15/25] vhost user: add support of live migration |
Date: |
Fri, 9 Oct 2015 00:17:37 +0300 |
From: Thibaut Collet <address@hidden>
Some vhost user backends are able to support live migration.
To provide this service the following features must be added:
1. Add the VIRTIO_NET_F_GUEST_ANNOUNCE capability to vhost-net when netdev
backend is vhost-user.
2. Provide a nop receive callback to vhost-user.
This callback is called by:
* qemu_announce_self after a migration to send fake RARP to avoid network
outage for peers talking to the migrated guest.
- For guest with GUEST_ANNOUNCE capabilities, guest already sends GARP
when the bit VIRTIO_NET_S_ANNOUNCE is set.
=> These packets must be discarded.
- For guest without GUEST_ANNOUNCE capabilities, migration termination
is notified when the guest sends packets.
=> These packets can be discarded.
* virtio_net_tx_bh with a dummy boot to send fake bootp/dhcp request.
BIOS guest manages virtio driver to send 4 bootp/dhcp request in case of
dummy boot.
=> These packets must be discarded.
Signed-off-by: Thibaut Collet <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/net/vhost_net.c | 2 ++
net/vhost-user.c | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 1ab4133..840f443 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -85,6 +85,8 @@ static const int user_feature_bits[] = {
VIRTIO_NET_F_CTRL_MAC_ADDR,
VIRTIO_NET_F_CTRL_GUEST_OFFLOADS,
+ VIRTIO_NET_F_GUEST_ANNOUNCE,
+
VIRTIO_NET_F_MQ,
VHOST_INVALID_FEATURE_BIT
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 9b38431..87917a5 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -103,6 +103,15 @@ err:
return -1;
}
+static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
+ size_t size)
+{
+ /* Discard the request that is received and managed by backend
+ * by an other way.
+ */
+ return size;
+}
+
static void vhost_user_cleanup(NetClientState *nc)
{
VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
@@ -132,6 +141,7 @@ static bool vhost_user_has_ufo(NetClientState *nc)
static NetClientInfo net_vhost_user_info = {
.type = NET_CLIENT_OPTIONS_KIND_VHOST_USER,
.size = sizeof(VhostUserState),
+ .receive = vhost_user_receive,
.cleanup = vhost_user_cleanup,
.has_vnet_hdr = vhost_user_has_vnet_hdr,
.has_ufo = vhost_user_has_ufo,
--
MST
- [Qemu-devel] [PULL 01/25] configure: probe for memfd, (continued)
- [Qemu-devel] [PULL 01/25] configure: probe for memfd, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 04/25] util: add memfd helpers, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 05/25] util: add fallback for qemu_memfd_alloc(), Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 06/25] vhost: document log resizing, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 07/25] vhost: add vhost_set_log_base op, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 03/25] util: add linux-only memfd fallback, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 09/25] vhost: alloc shareable log, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 10/25] vhost-user: send log shm fd along with log_base, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 13/25] vhost-user: document migration log, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 14/25] net: add trace_vhost_user_event, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 15/25] vhost user: add support of live migration,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 20/25] vhost-user-test: remove useless static check, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 21/25] vhost-user-test: wrap server in TestServer struct, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 24/25] vhost-user-test: check ownership during migration, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 22/25] vhost-user-test: learn to tweak various qemu arguments, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 25/25] intel_iommu: Add support for translation for devices behind bridges, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 11/25] vhost-user: add a migration blocker, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 08/25] vhost-user: add vhost_user_requires_shm_log(), Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 23/25] vhost-user-test: add live-migration test, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 18/25] vhost: add migration block if memfd failed, Michael S. Tsirkin, 2015/10/09
- [Qemu-devel] [PULL 02/25] linux-headers: add unistd.h, Michael S. Tsirkin, 2015/10/09