* [Qemu-devel] [PATCH 1/1] virtio: sync the dataplane vring state to the virtqueue before virtio_save
@ 2015-10-26 11:42 Denis V. Lunev
2015-10-27 17:02 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Denis V. Lunev @ 2015-10-26 11:42 UTC (permalink / raw)
Cc: Kevin Wolf, Michael S. Tsirkin, Pavel Butsykin, qemu-devel,
Stefan Hajnoczi, Paolo Bonzini, Denis V. Lunev
From: Pavel Butsykin <pbutsykin@virtuozzo.com>
When creating snapshot with the dataplane enabled, the snapshot file gets
not the actual state of virtqueue, because the current state is stored in
VirtIOBlockDataPlane. Therefore, before saving snapshot need to sync
the dataplane vring state to the virtqueue. The dataplane will resume its
work at the next notify virtqueue.
When snapshot loads with loadvm we get a message:
VQ 0 size 0x80 Guest index 0x15f5 inconsistent with Host index 0x0:
delta 0x15f5
error while loading state for instance 0x0 of device
'0000:00:08.0/virtio-blk'
Error -1 while loading VM state
to reproduce the error I used the following hmp commands:
savevm snap1
loadvm snap1
qemu parameters:
--enable-kvm -smp 4 -m 1024 -drive file=/var/lib/libvirt/images/centos6.4.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0 -set device.virtio-disk0.x-data-plane=on
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
---
hw/block/virtio-blk.c | 5 +++++
hw/scsi/virtio-scsi.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 8beb26b..89ab72a 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -798,6 +798,11 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
static void virtio_blk_save(QEMUFile *f, void *opaque)
{
VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
+ VirtIOBlock *s = VIRTIO_BLK(vdev);
+
+ if (s->dataplane) {
+ virtio_blk_data_plane_stop(s->dataplane);
+ }
virtio_save(vdev, f);
}
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 20885fb..8ad3257 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -665,6 +665,11 @@ static void virtio_scsi_reset(VirtIODevice *vdev)
static void virtio_scsi_save(QEMUFile *f, void *opaque)
{
VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
+ VirtIOSCSI *s = VIRTIO_SCSI(vdev);
+
+ if (s->dataplane_started) {
+ virtio_scsi_dataplane_stop(s);
+ }
virtio_save(vdev, f);
}
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] virtio: sync the dataplane vring state to the virtqueue before virtio_save
2015-10-26 11:42 [Qemu-devel] [PATCH 1/1] virtio: sync the dataplane vring state to the virtqueue before virtio_save Denis V. Lunev
@ 2015-10-27 17:02 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2015-10-27 17:02 UTC (permalink / raw)
To: Denis V. Lunev
Cc: Kevin Wolf, Paolo Bonzini, Michael S. Tsirkin, qemu-devel,
Pavel Butsykin
On Mon, Oct 26, 2015 at 02:42:57PM +0300, Denis V. Lunev wrote:
> From: Pavel Butsykin <pbutsykin@virtuozzo.com>
>
> When creating snapshot with the dataplane enabled, the snapshot file gets
> not the actual state of virtqueue, because the current state is stored in
> VirtIOBlockDataPlane. Therefore, before saving snapshot need to sync
> the dataplane vring state to the virtqueue. The dataplane will resume its
> work at the next notify virtqueue.
>
> When snapshot loads with loadvm we get a message:
> VQ 0 size 0x80 Guest index 0x15f5 inconsistent with Host index 0x0:
> delta 0x15f5
> error while loading state for instance 0x0 of device
> '0000:00:08.0/virtio-blk'
> Error -1 while loading VM state
>
> to reproduce the error I used the following hmp commands:
> savevm snap1
> loadvm snap1
>
> qemu parameters:
> --enable-kvm -smp 4 -m 1024 -drive file=/var/lib/libvirt/images/centos6.4.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0 -set device.virtio-disk0.x-data-plane=on
>
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> CC: "Michael S. Tsirkin" <mst@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/block/virtio-blk.c | 5 +++++
> hw/scsi/virtio-scsi.c | 5 +++++
> 2 files changed, 10 insertions(+)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-27 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-26 11:42 [Qemu-devel] [PATCH 1/1] virtio: sync the dataplane vring state to the virtqueue before virtio_save Denis V. Lunev
2015-10-27 17:02 ` Stefan Hajnoczi
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).