yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 2c71eba27413f9b34610cee3f6b16b0678f4d102 Mon Sep 17 00:00:00 2001
9ae3a8
From: Ladi Prosek <lprosek@redhat.com>
9ae3a8
Date: Wed, 5 Oct 2016 17:22:27 +0200
9ae3a8
Subject: [PATCH 5/8] virtio-balloon: discard virtqueue element on reset
9ae3a8
9ae3a8
RH-Author: Ladi Prosek <lprosek@redhat.com>
9ae3a8
Message-id: <1475666548-9186-6-git-send-email-lprosek@redhat.com>
9ae3a8
Patchwork-id: 72484
9ae3a8
O-Subject: [RHEL-7.4 qemu-kvm v2 PATCH 5/6] virtio-balloon: discard virtqueue element on reset
9ae3a8
Bugzilla: 1377968
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
The one pending element is being freed but not discarded on device
9ae3a8
reset, which causes svq->inuse to creep up, eventually hitting the
9ae3a8
"Virtqueue size exceeded" error.
9ae3a8
9ae3a8
Properly discarding the element on device reset makes sure that its
9ae3a8
buffers are unmapped and the inuse counter stays balanced.
9ae3a8
9ae3a8
Cc: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Cc: Roman Kagan <rkagan@virtuozzo.com>
9ae3a8
Cc: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
9ae3a8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
(cherry picked from commit 104e70cae78bd4afd95d948c6aff188f10508a9c)
9ae3a8
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
  * s->stats_vq_elem => &s->stats_vq_elem because the field is not
9ae3a8
    s pointer in 1.5.3
9ae3a8
---
9ae3a8
 hw/virtio/virtio-balloon.c | 1 +
9ae3a8
 1 file changed, 1 insertion(+)
9ae3a8
9ae3a8
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
9ae3a8
index 17b3029..faf93f7 100644
9ae3a8
--- a/hw/virtio/virtio-balloon.c
9ae3a8
+++ b/hw/virtio/virtio-balloon.c
9ae3a8
@@ -398,6 +398,7 @@ static void virtio_balloon_device_reset(VirtIODevice *vdev)
9ae3a8
     VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
9ae3a8
 
9ae3a8
     if (s->stats_vq_elem_pending) {
9ae3a8
+        virtqueue_discard(s->svq, &s->stats_vq_elem, 0);
9ae3a8
         s->stats_vq_elem_pending = false;
9ae3a8
     }
9ae3a8
 }
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8