diff mbox

[1/3] virtio-balloon: discard virtqueue element on reset

Message ID 1473261649-31465-2-git-send-email-lprosek@redhat.com
State New
Headers show

Commit Message

Ladi Prosek Sept. 7, 2016, 3:20 p.m. UTC
The one pending element is being freed but not discarded on device
reset, which causes svq->inuse to creep up, eventually hitting the
"Virtqueue size exceeded" error.

Properly discarding the element on device reset makes sure that its
buffers are unmapped and the inuse counter stays balanced.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Roman Kagan <rkagan@virtuozzo.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
---
 hw/virtio/virtio-balloon.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stefan Hajnoczi Sept. 7, 2016, 5:48 p.m. UTC | #1
On Wed, Sep 07, 2016 at 05:20:47PM +0200, Ladi Prosek wrote:
> The one pending element is being freed but not discarded on device
> reset, which causes svq->inuse to creep up, eventually hitting the
> "Virtqueue size exceeded" error.
> 
> Properly discarding the element on device reset makes sure that its
> buffers are unmapped and the inuse counter stays balanced.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Roman Kagan <rkagan@virtuozzo.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Ladi Prosek <lprosek@redhat.com>
> ---
>  hw/virtio/virtio-balloon.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Roman Kagan Sept. 8, 2016, 6:38 a.m. UTC | #2
On Wed, Sep 07, 2016 at 05:20:47PM +0200, Ladi Prosek wrote:
> The one pending element is being freed but not discarded on device
> reset, which causes svq->inuse to creep up, eventually hitting the
> "Virtqueue size exceeded" error.
> 
> Properly discarding the element on device reset makes sure that its
> buffers are unmapped and the inuse counter stays balanced.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Roman Kagan <rkagan@virtuozzo.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Ladi Prosek <lprosek@redhat.com>
> ---
>  hw/virtio/virtio-balloon.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
diff mbox

Patch

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 5af429a..ad4189a 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -463,6 +463,7 @@  static void virtio_balloon_device_reset(VirtIODevice *vdev)
     VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
 
     if (s->stats_vq_elem != NULL) {
+        virtqueue_discard(s->svq, s->stats_vq_elem, 0);
         g_free(s->stats_vq_elem);
         s->stats_vq_elem = NULL;
     }