All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: elohimes@gmail.com
Cc: qemu-devel@nongnu.org, Xie Yongji <xieyongji@baidu.com>,
	dgilbert@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/5] virtio: Migrate the "start_on_kick" flag
Date: Mon, 3 Jun 2019 22:16:39 +0200	[thread overview]
Message-ID: <20190603221639.5e4ddac1@bahia.lab.toulouse-stg.fr.ibm.com> (raw)
In-Reply-To: <20190529070955.25565-3-xieyongji@baidu.com>

On Wed, 29 May 2019 15:09:52 +0800
elohimes@gmail.com wrote:

> From: Xie Yongji <xieyongji@baidu.com>
> 
> We should migrate the "start_on_kick" flag so that we
> would not miss starting device on kicking at startup
> after migration.
> 

Hmm... IIUC "start_on_kick" means "virtio 1.0 transitional device that has
not been started yet", ie:

!vdev->started &&
(virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) &&
 !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1))

If so, not sure why you need this extra field in the first place, but
you probably don't need to migrate it. Just recalculate in a post load
callback.

> Signed-off-by: Xie Yongji <xieyongji@baidu.com>
> ---
>  hw/virtio/virtio.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index fc8fca81ad..4d4ff67791 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -1802,6 +1802,13 @@ static bool virtio_started_needed(void *opaque)
>      return vdev->started;
>  }
>  
> +static bool virtio_start_on_kick_needed(void *opaque)
> +{
> +    VirtIODevice *vdev = opaque;
> +
> +    return vdev->start_on_kick;
> +}
> +
>  static const VMStateDescription vmstate_virtqueue = {
>      .name = "virtqueue_state",
>      .version_id = 1,
> @@ -1941,6 +1948,17 @@ static const VMStateDescription vmstate_virtio_started = {
>      }
>  };
>  
> +static const VMStateDescription vmstate_virtio_start_on_kick = {
> +    .name = "virtio/start_on_kick",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .needed = &virtio_start_on_kick_needed,
> +    .fields = (VMStateField[]) {
> +        VMSTATE_BOOL(start_on_kick, VirtIODevice),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
>  static const VMStateDescription vmstate_virtio = {
>      .name = "virtio",
>      .version_id = 1,
> @@ -1957,6 +1975,7 @@ static const VMStateDescription vmstate_virtio = {
>          &vmstate_virtio_broken,
>          &vmstate_virtio_extra_state,
>          &vmstate_virtio_started,
> +        &vmstate_virtio_start_on_kick,
>          NULL
>      }
>  };



  reply	other threads:[~2019-06-03 20:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  7:09 [Qemu-devel] [PATCH 0/5] virtio: fix some issues of "started" and "start_on_kick" flag elohimes
2019-05-29  7:09 ` [Qemu-devel] [PATCH 1/5] virtio: Set "start_on_kick" on virtio_set_features() elohimes
2019-06-03 16:53   ` Greg Kurz
2019-06-04  1:41     ` Yongji Xie
2019-05-29  7:09 ` [Qemu-devel] [PATCH 2/5] virtio: Migrate the "start_on_kick" flag elohimes
2019-06-03 20:16   ` Greg Kurz [this message]
2019-06-03 21:03     ` Michael S. Tsirkin
2019-06-03 21:25       ` Greg Kurz
2019-06-03 21:51         ` Michael S. Tsirkin
2019-06-04  2:15     ` Yongji Xie
2019-05-29  7:09 ` [Qemu-devel] [PATCH 3/5] virtio: Make sure we get correct state of device on handle_aio_output() elohimes
2019-05-29  7:09 ` [Qemu-devel] [PATCH 4/5] virtio: Don't change "started" flag on virtio_vmstate_change() elohimes
2019-05-29  7:09 ` [Qemu-devel] [PATCH 5/5] virtio: add "use-started" property elohimes
2019-06-03 20:49   ` Greg Kurz
2019-06-04  2:37     ` Yongji Xie

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=20190603221639.5e4ddac1@bahia.lab.toulouse-stg.fr.ibm.com \
    --to=groug@kaod.org \
    --cc=dgilbert@redhat.com \
    --cc=elohimes@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xieyongji@baidu.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 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.