[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: |
Jason Wang |
Subject: |
Re: [Qemu-devel] [PATCH V3 1/6] virtio-pci: fix 1.0 virtqueue migration |
Date: |
Tue, 10 Nov 2015 10:35:23 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 11/09/2015 08:56 PM, Cornelia Huck wrote:
> 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 :)
Right, I will wait for other comments to see if v4 is needed (and fix
there).
>> 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.)
Yes, may help to hunt bugs earlier.
>
>> + 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>
>
>
- [Qemu-devel] [PATCH V3 0/6] virtio 1.0 pci optimizations and fixes, Jason Wang, 2015/11/06
- [Qemu-devel] [PATCH V3 1/6] virtio-pci: fix 1.0 virtqueue migration, Jason Wang, 2015/11/06
- [Qemu-devel] [PATCH V3 2/6] memory: don't try to adjust endianness for zero length eventfd, Jason Wang, 2015/11/06
- [Qemu-devel] [PATCH V3 3/6] KVM: add support for any length io eventfd, Jason Wang, 2015/11/06
- [Qemu-devel] [PATCH V3 4/6] virtio-pci: use zero length mmio eventfd for 1.0 notification cap when possible, Jason Wang, 2015/11/06
- [Qemu-devel] [PATCH V3 5/6] virtio-pci: introduce pio notification capability for modern device, Jason Wang, 2015/11/06
- [Qemu-devel] [PATCH V3 6/6] virtio-pci: unbreak queue_enable read, Jason Wang, 2015/11/06