From: Stefan Hajnoczi <stefanha@gmail.com>
To: Roman Kagan <rkagan@virtuozzo.com>
Cc: qemu-devel@nongnu.org, "Denis V. Lunev" <den@openvz.org>,
Ladi Prosek <lprosek@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/4] virtio-balloon: make stats virtqueue length 1
Date: Fri, 19 Aug 2016 14:44:10 +0100 [thread overview]
Message-ID: <20160819134410.GD20309@stefanha-x1.localdomain> (raw)
In-Reply-To: <1471544874-26996-3-git-send-email-rkagan@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 1974 bytes --]
On Thu, Aug 18, 2016 at 09:27:52PM +0300, Roman Kagan wrote:
> The protocol for virtio-balloon stats virtqueue doesn't allow more than
> one element in the virtqueue.
>
> So, instead of trying to compensate for guest misbehavior if it sends
> new data before the slot has been released by the host, just define the
> stats virtqueue length to 1 initially and rely on the generic virtio
> code to handle overflows.
>
> Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Ladi Prosek <lprosek@redhat.com>
> ---
> hw/virtio/virtio-balloon.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index 5af429a..0baf4b3 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -262,13 +262,6 @@ static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
> goto out;
> }
>
> - if (s->stats_vq_elem != NULL) {
> - /* This should never happen if the driver follows the spec. */
> - virtqueue_push(vq, s->stats_vq_elem, 0);
> - virtio_notify(vdev, vq);
> - g_free(s->stats_vq_elem);
> - }
> -
> s->stats_vq_elem = elem;
>
> /* Initialize the stats to get rid of any stale values. This is only
> @@ -443,7 +436,7 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
>
> s->ivq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);
> s->dvq = virtio_add_queue(vdev, 128, virtio_balloon_handle_output);
> - s->svq = virtio_add_queue(vdev, 128, virtio_balloon_receive_stats);
> + s->svq = virtio_add_queue(vdev, 1, virtio_balloon_receive_stats);
This change breaks live migration compatibility. The device is not
allowed to change in existing machine types.
I think Ladi's fix for this bug is the way to go. It preserves
migration compatibility.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-08-19 13:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 18:27 [Qemu-devel] [PATCH 0/4] virtio-balloon: assorted fixes Roman Kagan
2016-08-18 18:27 ` [Qemu-devel] [PATCH 1/4] virtio: assert on ->inuse underflow Roman Kagan
2016-08-18 18:27 ` [Qemu-devel] [PATCH 2/4] virtio-balloon: make stats virtqueue length 1 Roman Kagan
2016-08-19 10:05 ` Ladi Prosek
2016-08-19 11:04 ` Roman Kagan
2016-08-19 13:44 ` Stefan Hajnoczi [this message]
2016-08-19 14:38 ` Roman Kagan
2016-08-18 18:27 ` [Qemu-devel] [PATCH 3/4] virtio-balloon: don't restart stats timer in callback Roman Kagan
2016-08-18 18:27 ` [Qemu-devel] [PATCH 4/4] virtio-balloon: keep collecting stats on save/restore Roman Kagan
2016-08-19 9:57 ` Ladi Prosek
2016-08-19 11:37 ` Roman Kagan
2016-08-19 12:08 ` Ladi Prosek
2016-08-19 14:45 ` Roman Kagan
2016-08-19 19:01 ` Ladi Prosek
2016-08-19 13:41 ` [Qemu-devel] [PATCH 0/4] virtio-balloon: assorted fixes Stefan Hajnoczi
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=20160819134410.GD20309@stefanha-x1.localdomain \
--to=stefanha@gmail.com \
--cc=den@openvz.org \
--cc=lprosek@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkagan@virtuozzo.com \
/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).