From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: QEMU-devel <qemu-devel@nongnu.org>, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH] virtio: verify that all outstanding buffers are flushed (was Re: vmstate conversion for virtio?)
Date: Mon, 10 Dec 2012 22:35:12 +0200 [thread overview]
Message-ID: <20121210203512.GA1418@redhat.com> (raw)
In-Reply-To: <20121205110807.GA10045@redhat.com>
On Wed, Dec 05, 2012 at 01:08:07PM +0200, Michael S. Tsirkin wrote:
> Add sanity check to address the following concern:
>
> On Wed, Dec 05, 2012 at 09:47:22AM +1030, Rusty Russell wrote:
> > All we need is the index of the request; the rest can be re-read from
> > the ring.
>
> I'd like to point out that this is not generally
> true 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>
Doh sent a wrong patch sorry. I'll resend the right one shortly.
Pls disregard.
> ---
>
> diff --git a/hw/virtio.c b/hw/virtio.c
> index f40a8c5..b80a5a9 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(!vq->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
prev parent reply other threads:[~2012-12-10 20:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-04 3:09 [Qemu-devel] vmstate conversion for virtio? Rusty Russell
2012-12-04 6:30 ` Michael S. Tsirkin
2012-12-04 11:44 ` Juan Quintela
2012-12-04 23:17 ` Rusty Russell
2012-12-05 11:08 ` [Qemu-devel] [PATCH] virtio: verify that all outstanding buffers are flushed (was Re: vmstate conversion for virtio?) Michael S. Tsirkin
2012-12-06 6:03 ` Rusty Russell
2012-12-06 8:02 ` Michael S. Tsirkin
2012-12-06 23:39 ` Rusty Russell
2012-12-10 14:16 ` Anthony Liguori
2012-12-10 23:54 ` Rusty Russell
2012-12-10 20:35 ` Michael S. Tsirkin [this message]
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=20121210203512.GA1418@redhat.com \
--to=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rusty@rustcorp.com.au \
/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 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).