[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_u
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize |
Date: |
Wed, 17 May 2017 14:52:02 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 17/05/2017 14:00, Fam Zheng wrote:
> On Wed, 05/17 02:58, Paolo Bonzini wrote:
>> The child property is deleted when bus_unparent calls object_unparent:
>>
>> while ((kid = QTAILQ_FIRST(&bus->children)) != NULL) {
>> DeviceState *dev = kid->child;
>> object_unparent(OBJECT(dev));
>> }
>>
>> and in turn bus_unparent is called by the VirtIOSCSIPCI's unparent
>> callback (device_unparent):
>>
>> while (dev->num_child_bus) {
>> bus = QLIST_FIRST(&dev->child_bus);
>> object_unparent(OBJECT(bus));
>> }
>
> OK, sorry for being dumb, these are way over my head. Let me try again:
>
> I count three references before unplug:
>
> a.1) object_property_add_child in virtio_instance_init_common as
> virtio-backend
> a.2) qdev_set_parent_bus in virtio_scsi_pci_realize by virtio-pci-bus
> a.3) qbus_set_hotplug_handler in virtio_scsi_device_realize for
>
> Only two object_unref()'s happen in unplug, respectively:
>
> b.1) object_finalize_child_property, matches a.1)
> b.2) bus_remove_child, matches a.2)
>
> Do we need cleanup for a.3) ? The patch below does fix the crash for me.
Yes, good catch. Either there, or in bus_unparent.
Paolo
- [Qemu-stable] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Fam Zheng, 2017/05/16
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Fam Zheng, 2017/05/16
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Paolo Bonzini, 2017/05/16
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Fam Zheng, 2017/05/16
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Paolo Bonzini, 2017/05/16
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Fam Zheng, 2017/05/16
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Paolo Bonzini, 2017/05/17
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize, Fam Zheng, 2017/05/17
- Re: [Qemu-stable] [Qemu-devel] [PATCH v2] virtio: Move memory_listener_unregister to .unrealize,
Paolo Bonzini <=