qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V3 1/6] virtio-pci: fix 1.0 virtqueue migration


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH V3 1/6] virtio-pci: fix 1.0 virtqueue migration
Date: Mon, 9 Nov 2015 13:56:48 +0100

On Fri,  6 Nov 2015 16:02:44 +0800
Jason Wang <address@hidden> wrote:

> We don't migrate the followings fields for virtio-pci:
> 
> uint32_t dfselect;
> uint32_t gfselect;
> uint32_t guest_features[2];
> struct {
>     uint16_t num;
>     bool enabled;
>     uint32_t desc[2];
>     uint32_t avail[2];
>     uint32_t used[2];
> } vqs[VIRTIO_QUEUE_MAX];
> 
> This will confuse driver if migrating during initialization. Solves
> this issue by:
> 
> - introduce transport specific callbacks to load and store extra
>   virtqueue states.
> - add a new subsection for virtio to migrate transport specific modern
>   device state.
> - implement pci specific callbacks.
> - add a new property for virtio-pci for whether or not to migrate
>   extra state.
> - compat the migration for 2.4 and elder machine types
> 
> Cc: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Jason Wang <address@hidden>
> ---
>  hw/virtio/virtio-pci.c         | 129 
> +++++++++++++++++++++++++++++++++++++++++
>  hw/virtio/virtio-pci.h         |  20 ++++---
>  hw/virtio/virtio.c             |  58 ++++++++++++++++++
>  include/hw/compat.h            |   4 ++
>  include/hw/virtio/virtio-bus.h |   3 +
>  5 files changed, 207 insertions(+), 7 deletions(-)

> @@ -133,6 +256,7 @@ static int virtio_pci_load_queue(DeviceState *d, int n, 
> QEMUFile *f)
>      if (vector != VIRTIO_NO_VECTOR) {
>          return msix_vector_use(&proxy->pci_dev, vector);
>      }
> +

whitespace change :)

>      return 0;
>  }
> 

(...)

> +static void put_extra_state(QEMUFile *f, void *pv, size_t size)
> +{
> +    VirtIODevice *vdev = pv;
> +    BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
> +    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
> +

I'd probably put an 'assert(k->save_extra_state)' here. (I think we
have discussed this before, but I can't recall the outcome.)

> +    k->save_extra_state(qbus->parent, f);
> +}

Otherwise, this looks good to me. With or with out the assert,

Reviewed-by: Cornelia Huck <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]