qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Thibaut Collet <thibaut.collet@6wind.com>,
	mst@redhat.com, stefanha@redhat.com, jasowang@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 1/1] vhost user: add support of live migration
Date: Fri, 10 Jul 2015 15:05:34 +0200	[thread overview]
Message-ID: <559FC31E.10600@redhat.com> (raw)
In-Reply-To: <1435310564-9418-2-git-send-email-thibaut.collet@6wind.com>



On 26/06/2015 11:22, Thibaut Collet wrote:
> Some vhost client/backend 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 for RARP
>    packets automatically send by qemu_announce_self after a migration.
>    These packets are useless for vhost user and just discarded.

When a packet is received by vhost-user, the vhost-user writes the
packet in guest memory.  QEMU must then copy that page of guest memory
from source to destination; it uses a dirty bitmap for this purpose.

How does vhost-user do this?  I can see this patch providing enough
support for *non*live migration.  However, it cannot be enough for live
migration unless I'm missing something obvious.

Paolo

> Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
> ---
>  hw/net/vhost_net.c |    2 ++
>  net/vhost-user.c   |   21 +++++++++++++++++++--
>  2 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 9bd360b..668c422 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 b51bc04..20778a1 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -65,6 +65,24 @@ static void vhost_user_stop(VhostUserState *s)
>      s->vhost_net = 0;
>  }
>  
> +static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
> +                                  size_t size)
> +{
> +    /* A live migration is done. Display an error if the packet is not a RARP.
> +     * RARP are just discarded: guest is already notified of live migration
> +     * by the virtio-net NIC or by the vhost-user backend */
> +    if (size != 60) {
> +        static int display_trace = 1;
> +
> +        if (display_trace) {
> +            fprintf(stderr,"Vhost user receives unexpected packets\n");
> +            fflush(stderr);
> +            display_trace = 0;
> +        }
> +    }
> +    return size;
> +}
> +
>  static void vhost_user_cleanup(NetClientState *nc)
>  {
>      VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
> @@ -90,6 +108,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,
> @@ -146,8 +165,6 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
>  
>          s = DO_UPCAST(VhostUserState, nc, nc);
>  
> -        /* We don't provide a receive callback */
> -        s->nc.receive_disabled = 1;
>          s->chr = chr;
>          s->nc.queue_index = i;
>  
> 

  reply	other threads:[~2015-07-10 13:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26  9:22 [Qemu-devel] [PATCH v4 0/1] Add live migration for vhost user Thibaut Collet
2015-06-26  9:22 ` [Qemu-devel] [PATCH v4 1/1] vhost user: add support of live migration Thibaut Collet
2015-07-10 13:05   ` Paolo Bonzini [this message]
2015-07-13  2:27     ` Linhaifeng
2015-07-17  0:19       ` Marc-André Lureau
2015-07-17  2:25         ` Paolo Bonzini
2015-07-17 10:34           ` Marc-André Lureau
2015-07-17 12:57             ` Paolo Bonzini
2015-07-17 13:35               ` Marc-André Lureau
2015-07-17 13:50                 ` Paolo Bonzini
2015-07-18  0:07                   ` Marc-André Lureau
2015-07-18 13:18                     ` Paolo Bonzini
2015-07-17  0:20 ` [Qemu-devel] [PATCH v4 0/1] Add live migration for vhost user Marc-André Lureau

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=559FC31E.10600@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thibaut.collet@6wind.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).