yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-virtio-balloon-discard-virtqueue-element-on-reset.patch

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