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