cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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