qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>
Subject: [Qemu-devel] memory_listener_unregister does not call region_del() - why?
Date: Tue, 3 May 2016 19:07:39 +1000	[thread overview]
Message-ID: <65fbea72-f65f-fda9-775c-f9044f1e144d@ozlabs.ru> (raw)

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	other threads:[~2016-05-03  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03  9:07 Alexey Kardashevskiy [this message]
2016-05-04  6:54 ` [Qemu-devel] memory_listener_unregister does not call region_del() - why? Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65fbea72-f65f-fda9-775c-f9044f1e144d@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).