[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/4] virtio-balloon: make stats virtqueue length
From: |
Roman Kagan |
Subject: |
Re: [Qemu-devel] [PATCH 2/4] virtio-balloon: make stats virtqueue length 1 |
Date: |
Fri, 19 Aug 2016 14:04:13 +0300 |
User-agent: |
Mutt/1.6.2-neo (2016-08-08) |
On Fri, Aug 19, 2016 at 12:05:29PM +0200, Ladi Prosek wrote:
> On Thu, Aug 18, 2016 at 8:27 PM, Roman Kagan <address@hidden> 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.
>
> Looks good to me, one nit inline.
>
> > Signed-off-by: Roman Kagan <address@hidden>
> > Cc: "Michael S. Tsirkin" <address@hidden>
> > Cc: Ladi Prosek <address@hidden>
> > ---
> > 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);
> > - }
> > -
>
> Worth adding an assert?
>
> assert(s->stats_vq_elem == NULL); // enforced by one-element stats virtqueue
Yep, makes perfect sense.
Thanks,
Roman.
Re: [Qemu-devel] [PATCH 0/4] virtio-balloon: assorted fixes, Stefan Hajnoczi, 2016/08/19