From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgBlH-0007wE-Ut for qemu-devel@nongnu.org; Sun, 27 Sep 2015 09:13:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgBlE-0007n7-F9 for qemu-devel@nongnu.org; Sun, 27 Sep 2015 09:13:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgBlE-0007mx-8C for qemu-devel@nongnu.org; Sun, 27 Sep 2015 09:13:00 -0400 Date: Sun, 27 Sep 2015 16:12:55 +0300 From: "Michael S. Tsirkin" Message-ID: <20150927161158-mutt-send-email-mst@redhat.com> References: <1443111741-4736-1-git-send-email-marcandre.lureau@redhat.com> <1443111741-4736-16-git-send-email-marcandre.lureau@redhat.com> <627233075.16911211.1443131585532.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <627233075.16911211.1443131585532.JavaMail.zimbra@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 15/21] vhost user: add rarp sending after live migration for legacy guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Marc-Andr=E9?= Lureau Cc: Linhaifeng , Thibaut Collet , Jason Wang , qemu-devel , marcandre lureau , Paolo Bonzini On Thu, Sep 24, 2015 at 05:53:05PM -0400, Marc-Andr=E9 Lureau wrote: > Hi >=20 > ----- Original Message ----- > > On Thu, Sep 24, 2015 at 6:22 PM, wrote= : > > > From: Thibaut Collet > > > > > > A new vhost user message is added to allow QEMU to ask to vhost use= r > > > backend to > > > broadcast a fake RARP after live migration for guest without GUEST_= ANNOUNCE > > > capability. > > > > > > This new message is sent only if the backend supports the new > > > VHOST_USER_PROTOCOL_F_RARP protocol feature. > > > The payload of this new message is the MAC address of the guest (no= t known > > > by > > > the backend). The MAC address is copied in the first 6 bytes of a u= 64 to > > > avoid > > > to create a new payload message type. > > > > > > This new message has no equivalent ioctl so a new callback is added= in the > > > userOps structure to send the request. > > > > > > Upon reception of this new message the vhost user backend must gene= rate and > > > broadcast a fake RARP request to notify the migration is terminated= . > > > > > > Signed-off-by: Thibaut Collet > > > [Rebased and fixed checkpatch errors - Marc-Andr=E9] > > > Signed-off-by: Marc-Andr=E9 Lureau > > > --- > > > docs/specs/vhost-user.txt | 15 +++++++++++++++ > > > hw/net/vhost_net.c | 17 +++++++++++++++++ > > > hw/virtio/vhost-user.c | 30 +++++++++++++++++++++++++++= +++ > > > include/hw/virtio/vhost-backend.h | 3 +++ > > > include/net/vhost_net.h | 1 + > > > net/vhost-user.c | 24 ++++++++++++++++++++++-- > > > 6 files changed, 88 insertions(+), 2 deletions(-) > > > > > > diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt > > > index e0292a0..e0d71e2 100644 > > > --- a/docs/specs/vhost-user.txt > > > +++ b/docs/specs/vhost-user.txt > > > @@ -194,6 +194,7 @@ Protocol features > > > > > > #define VHOST_USER_PROTOCOL_F_MQ 0 > > > #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 > > > +#define VHOST_USER_PROTOCOL_F_RARP 2 > > > > > > Message types > > > ------------- > > > @@ -381,3 +382,17 @@ Message types > > > Master payload: vring state description > > > > > > Signal slave to enable or disable corresponding vring. > > > + > > > + * VHOST_USER_SEND_RARP > > > + > > > + Id: 19 > > > + Equivalent ioctl: N/A > > > + Master payload: u64 > > > + > > > + Ask vhost user backend to broadcast a fake RARP to notify th= e > > > migration > > > + is terminated for guest that does not support GUEST_ANNOUNCE= . > > > + Only legal if feature bit VHOST_USER_F_PROTOCOL_FEATURES is = present > > > in > > > + VHOST_USER_GET_FEATURES and protocol feature bit > > > VHOST_USER_PROTOCOL_F_RARP > > > + is present in VHOST_USER_GET_PROTOCOL_FEATURES. > > > + The first 6 bytes of the payload contain the mac address of = the > > > guest to > > > + allow the vhost user backend to construct and broadcast the = fake > > > RARP. > > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > > > index 840f443..da66b64 100644 > > > --- a/hw/net/vhost_net.c > > > +++ b/hw/net/vhost_net.c > > > @@ -388,6 +388,18 @@ void vhost_net_cleanup(struct vhost_net *net) > > > g_free(net); > > > } > > > > > > +int vhost_net_notify_migration_done(struct vhost_net *net, char* m= ac_addr) > > > +{ > > > + const VhostOps *vhost_ops =3D net->dev.vhost_ops; > > > + int r =3D -1; > > > + > > > + if (vhost_ops->vhost_migration_done) { > > > + r =3D vhost_ops->vhost_migration_done(&net->dev, mac_addr)= ; > > > + } > > > + > > > + return r; > > > +} > > > + > > > bool vhost_net_virtqueue_pending(VHostNetState *net, int idx) > > > { > > > return vhost_virtqueue_pending(&net->dev, idx); > > > @@ -479,6 +491,11 @@ void vhost_net_virtqueue_mask(VHostNetState *n= et, > > > VirtIODevice *dev, > > > { > > > } > > > > > > +int vhost_net_notify_migration_done(struct vhost_net *net) > > > +{ > > > + return -1; > > > +} > > > + > > > VHostNetState *get_vhost_net(NetClientState *nc) > > > { > > > return 0; > > > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c > > > index 455caba..b7f3699 100644 > > > --- a/hw/virtio/vhost-user.c > > > +++ b/hw/virtio/vhost-user.c > > > @@ -10,6 +10,7 @@ > > > > > > #include "hw/virtio/vhost.h" > > > #include "hw/virtio/vhost-backend.h" > > > +#include "hw/virtio/virtio-net.h" > > > #include "sysemu/char.h" > > > #include "sysemu/kvm.h" > > > #include "qemu/error-report.h" > > > @@ -30,6 +31,7 @@ > > > #define VHOST_USER_PROTOCOL_FEATURE_MASK 0x3ULL > > > #define VHOST_USER_PROTOCOL_F_MQ 0 > > > #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 > > > +#define VHOST_USER_PROTOCOL_F_RARP 2 > >=20 > > The VHOST_USER_PROTOCOL_FEATURE_MASK must be changed and set to 0x7U= LL > >=20 Better, change VHOST_USER_PROTOCOL_FEATURE_MASK to be calculated based on other macros. >=20 > Good catch (too many rebases, having a test would help to prevent this = kind of mistake) >=20 > thanks So there will be v6 with a fix? --=20 MST