Hi!

Noticed a thing - when we do vfio-pci hotplug, we register a memory listener on PCI address space:

memory_listener_register(&container->listener, container->space->as);

Then on the "pseries" machine, I add IOMMU subregions and this ends up in vfio_listener_region_add() where I can create hardware window and hook it to KVM, etc, some stuff. So far so good.

Now I am trying hot unplug. So vfio_instance_finalize() is called, and from it - vfio_put_group -> vfio_disconnect_container -> vfio_listener_release -> memory_listener_unregister(&container->listener), as expected.

Hoewever, unlike memory_listener_register() (which calls region_add() callbacks), memory_listener_unregister() is as simple as this:

void memory_listener_unregister(MemoryListener *listener)
{
    QTAILQ_REMOVE(&memory_listeners, listener, link);
}

No region_del() calls => no proper cleanup. Hm.

Is there any particular reason for it to be that simple and there is another way to be notified about some memory listener being unregistered? Thanks.


--
Alexey

Reply via email to