yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-s390x-pci-Always-delete-and-free-the-release_timer.patch

b38b0f
From 586c02abcca49fceeca0d6f1b4e5cab30dd9a123 Mon Sep 17 00:00:00 2001
b38b0f
From: Cornelia Huck <cohuck@redhat.com>
b38b0f
Date: Wed, 17 Apr 2019 13:57:29 +0100
b38b0f
Subject: [PATCH 12/24] s390x/pci: Always delete and free the release_timer
b38b0f
b38b0f
RH-Author: Cornelia Huck <cohuck@redhat.com>
b38b0f
Message-id: <20190417135741.25297-13-cohuck@redhat.com>
b38b0f
Patchwork-id: 85795
b38b0f
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 12/24] s390x/pci: Always delete and free the release_timer
b38b0f
Bugzilla: 1699070
b38b0f
RH-Acked-by: David Hildenbrand <david@redhat.com>
b38b0f
RH-Acked-by: Thomas Huth <thuth@redhat.com>
b38b0f
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
b38b0f
b38b0f
From: David Hildenbrand <david@redhat.com>
b38b0f
b38b0f
We should always get rid of it. I don't see a reason to keep the timer
b38b0f
alive if the devices are going away. This looks like a memory leak.
b38b0f
b38b0f
(hmp) device_add virtio-mouse-pci,id=test
b38b0f
(hmp) device_del test
b38b0f
-> guest notified, timer pending.
b38b0f
-> guest does not react for some reason (e.g. crash)
b38b0f
-> s390_pcihost_timer_cb(). Timer not pending anymore. qmp_unplug().
b38b0f
b38b0f
-> Device deleted. Timer expired (not pending) but not freed.
b38b0f
b38b0f
Signed-off-by: David Hildenbrand <david@redhat.com>
b38b0f
Message-Id: <20190114103110.10909-4-david@redhat.com>
b38b0f
Reviewed-by: Collin Walling <walling@linux.ibm.com>
b38b0f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
b38b0f
(cherry picked from commit d648a3e62d5e726526f9df283341999792f4fbf9)
b38b0f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
b38b0f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
---
b38b0f
 hw/s390x/s390-pci-bus.c | 2 +-
b38b0f
 1 file changed, 1 insertion(+), 1 deletion(-)
b38b0f
b38b0f
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
b38b0f
index a785acb..ea0c74c 100644
b38b0f
--- a/hw/s390x/s390-pci-bus.c
b38b0f
+++ b/hw/s390x/s390-pci-bus.c
b38b0f
@@ -982,7 +982,7 @@ static void s390_pcihost_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
b38b0f
         return;
b38b0f
     }
b38b0f
 
b38b0f
-    if (pbdev->release_timer && timer_pending(pbdev->release_timer)) {
b38b0f
+    if (pbdev->release_timer) {
b38b0f
         timer_del(pbdev->release_timer);
b38b0f
         timer_free(pbdev->release_timer);
b38b0f
         pbdev->release_timer = NULL;
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f