qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv2] virtio: verify that all outstanding buffers are flushed
@ 2012-12-12 10:51 Michael S. Tsirkin
  2012-12-12 13:50 ` Stefan Hajnoczi
  0 siblings, 1 reply; 25+ messages in thread
From: Michael S. Tsirkin @ 2012-12-12 10:51 UTC (permalink / raw)
  To: qemu-devel, Rusty Russell
  Cc: Paolo Bonzini, Anthony Liguori, Avi Kivity, Stefan Hajnoczi,
	Michael S. Tsirkin

Add sanity check to address the following concern:

During migration, all we pass the index of the request;
the rest can be re-read from the ring.

This is not generally enough if any available requests are outstanding.
Imagine a ring of size 4.  Below A means available U means used.

A 1
A 2
U 2
A 2
U 2
A 2
U 2
A 2
U 2

At this point available ring has wrapped around, the only
way to know head 1 is outstanding is because backend
has stored this info somewhere.

The reason we manage to migrate without tracking this in migration
state is because we flush outstanding requests before
migration.
This flush is device-specific though, let's add
a safeguard in virtio core to ensure it's done properly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Changes from v1:
    v1 was against the wrong tree, it didn't build against qemu.git

 hw/virtio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/virtio.c b/hw/virtio.c
index f40a8c5..6227642 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -788,6 +788,8 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
         if (vdev->vq[i].vring.num == 0)
             break;
 
+        assert(!vdev->vq[i].inuse);
+
         qemu_put_be32(f, vdev->vq[i].vring.num);
         qemu_put_be64(f, vdev->vq[i].pa);
         qemu_put_be16s(f, &vdev->vq[i].last_avail_idx);
-- 
MST

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-12-16 20:36 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12 10:51 [Qemu-devel] [PATCHv2] virtio: verify that all outstanding buffers are flushed Michael S. Tsirkin
2012-12-12 13:50 ` Stefan Hajnoczi
2012-12-12 14:01   ` Paolo Bonzini
2012-12-12 14:30     ` Michael S. Tsirkin
2012-12-12 14:36       ` Paolo Bonzini
2012-12-12 14:47         ` Michael S. Tsirkin
2012-12-12 15:01           ` Paolo Bonzini
2012-12-12 15:25             ` Michael S. Tsirkin
2012-12-12 15:52               ` Paolo Bonzini
2012-12-12 16:37                 ` Michael S. Tsirkin
2012-12-12 16:51                   ` Paolo Bonzini
2012-12-12 17:14                     ` Michael S. Tsirkin
2012-12-12 17:39                       ` Paolo Bonzini
2012-12-12 19:23                         ` Michael S. Tsirkin
2012-12-12 21:00                           ` Paolo Bonzini
2012-12-12 21:19                             ` Michael S. Tsirkin
2012-12-12 21:33                               ` Anthony Liguori
2012-12-12 21:51                                 ` Michael S. Tsirkin
2012-12-14  1:06                                 ` Rusty Russell
2012-12-14  7:51                                   ` Paolo Bonzini
2012-12-16 20:36                                     ` Anthony Liguori
2012-12-13  7:39                               ` Paolo Bonzini
2012-12-13 10:48                   ` Kevin Wolf
2012-12-16 16:14                     ` Michael S. Tsirkin
2012-12-12 14:26   ` Michael S. Tsirkin

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).