On Mon, Aug 15, 2016 at 2:50 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Mon, Aug 15, 2016 at 1:35 PM, Ladi Prosek <lpro...@redhat.com> wrote: >> On Mon, Aug 15, 2016 at 2:09 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: >>> On Fri, Aug 05, 2016 at 01:36:32PM +0200, Ladi Prosek wrote: >>>> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c >>>> index 5af429a..65457e9 100644 >>>> --- a/hw/virtio/virtio-balloon.c >>>> +++ b/hw/virtio/virtio-balloon.c >>>> @@ -423,6 +423,26 @@ static int virtio_balloon_load_device(VirtIODevice >>>> *vdev, QEMUFile *f, >>>> return 0; >>>> } >>>> >>>> +static void virtio_balloon_vmstate_cb(void *opaque, int running, >>>> + RunState state) >>>> +{ >>>> + VirtIOBalloon *s = opaque; >>>> + >>>> + if (!running) { >>>> + /* put the stats element back if the VM is not running */ >>>> + if (s->stats_vq_elem != NULL) { >>>> + virtqueue_discard(s->svq, s->stats_vq_elem, >>>> s->stats_vq_offset); >>> >>> The third argument should be 0 because we did not write anything into >>> in_sg[]. >> >> Thanks! Then it looks like the regular virtqueue_push in >> balloon_stats_poll_cb should also be called with 0 and the >> stats_vq_offset field can be deleted altogether. We never write to >> in_sg. > > Yes.
I'll send a follow-up patch fixing this later if that's ok. Liang is already testing this patch and passing non-0 does no harm, in_sg is empty anyway so it doesn't make a difference really. Thanks, Ladi