From: "Michael S. Tsirkin" <mst@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>
Cc: qemu-devel@nongnu.org, "Denis V. Lunev" <den@openvz.org>,
Ladi Prosek <lprosek@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/6] virtio-balloon: make stats virtqueue length 1
Date: Mon, 22 Aug 2016 04:57:19 +0300 [thread overview]
Message-ID: <20160822045658-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1471613966-7267-3-git-send-email-rkagan@virtuozzo.com>
On Fri, Aug 19, 2016 at 04:39:21PM +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>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
This would need a bunch of compat handlers to
avoid changes for old machine types.
> ---
> v1 > v2:
> - added assert in virtio_balloon_receive_stats
>
> hw/virtio/virtio-balloon.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index 5af429a..fb8784e 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -262,12 +262,8 @@ 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);
> - }
> + /* enforced by stats virtqueue depth being 1 */
> + assert(!s->stats_vq_elem);
>
> s->stats_vq_elem = elem;
>
> @@ -443,7 +439,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);
>
> reset_stats(s);
> }
> --
> 2.7.4
next prev parent reply other threads:[~2016-08-22 1:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-19 13:39 [Qemu-devel] [PATCH v2 0/6] virtio-balloon: assorted fixes Roman Kagan
2016-08-19 13:39 ` [Qemu-devel] [PATCH v2 1/6] virtio: assert on ->inuse underflow Roman Kagan
2016-08-23 21:03 ` Stefan Hajnoczi
2016-08-24 2:42 ` Michael S. Tsirkin
2016-08-19 13:39 ` [Qemu-devel] [PATCH v2 2/6] virtio-balloon: make stats virtqueue length 1 Roman Kagan
2016-08-22 1:57 ` Michael S. Tsirkin [this message]
2016-08-19 13:39 ` [Qemu-devel] [PATCH v2 3/6] virtio-balloon: don't restart stats timer in callback Roman Kagan
2016-08-19 13:39 ` [Qemu-devel] [PATCH v2 4/6] virtio-balloon: keep collecting stats on save/restore Roman Kagan
2016-09-01 8:35 ` Ladi Prosek
2016-09-01 14:17 ` Roman Kagan
2016-09-01 15:43 ` Ladi Prosek
2016-09-01 16:18 ` Michael S. Tsirkin
2016-09-01 18:03 ` Roman Kagan
2016-08-19 13:39 ` [Qemu-devel] [PATCH v2 5/6] virtio-balloon: drop ->stats_vq_offset Roman Kagan
2016-08-19 13:39 ` [Qemu-devel] [PATCH v2 6/6] virtio-ballon: drop reset handler Roman Kagan
2016-08-19 13:43 ` Roman Kagan
2016-08-19 13:39 ` [Qemu-devel] [PATCH v2 6/6] virtio-balloon: " Roman Kagan
2016-08-19 14:48 ` [Qemu-devel] [PATCH v2 0/6] virtio-balloon: assorted fixes Roman Kagan
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=20160822045658-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=den@openvz.org \
--cc=lprosek@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkagan@virtuozzo.com \
--cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.