Skip to contentSkip to conversation

virtio: Unregister memory listener when unrealize

PATCH In review Fam Zheng 2 participants 4 messages May 10, 2017

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 virtio: Unregister memory listener when unrealize

---
 hw/virtio/virtio.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/virtio.c +1 -0
index 03592c5..a7741f4 100644
@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp)
         }
     }
 
+    memory_listener_unregister(&vdev->listener);
     g_free(vdev->bus_name);
     vdev->bus_name = NULL;
 }
Signature · 1 line
2.9.3
author
#1 lore raw
Quoted 22 lines · Fam Zheng
---
 hw/virtio/virtio.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/virtio.c +1 -0
index 03592c5..a7741f4 100644
@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp)
         }
     }
 
+    memory_listener_unregister(&vdev->listener);
     g_free(vdev->bus_name);
     vdev->bus_name = NULL;
 }
Signature · 1 line
2.9.3

Oops, I think the one in the .finalize() callback should be removed meanwhile.

Fam

#2 lore raw
In reply to Fam Zheng
Quoted 11 lines · Fam Zheng
---
 hw/virtio/virtio.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/virtio.c +0 -0
index 03592c5..a7741f4 100644

hw/virtio/virtio.c static void virtio_device_unrealize(DeviceState *dev, Error **errp) · line 2521

Quoted 7 lines
hw/virtio/virtio.c +1 -0
@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp)
         }
     }
 
+    memory_listener_unregister(&vdev->listener);
     g_free(vdev->bus_name);
     vdev->bus_name = NULL;
 }

Is this a bug fix? If yes, what exactly's broken without it?

author
#3 lore raw
Quoted 16 lines · Markus Armbruster
Quoted 14 lines · Fam Zheng
---
 hw/virtio/virtio.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/virtio.c +0 -0
index 03592c5..a7741f4 100644
@@ -2515,6 +2515,7 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp)
         }
     }
 
Quoted 7 lines

hw/virtio/virtio.c static void virtio_device_unrealize(DeviceState *dev, Error **errp) · line 2521

Quoted 4 lines
hw/virtio/virtio.c +1 -0
+    memory_listener_unregister(&vdev->listener);
     g_free(vdev->bus_name);
     vdev->bus_name = NULL;
 }

Is this a bug fix? If yes, what exactly's broken without it?

I thought it was obvious (missing unregister) but that was a mistake. There is one in virtio_device_instance_finalize(), but the callback is just not called due to something else with the QOM refcnt.

Will revise, and add commit message, of course.

Fam