From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
qemu-devel@nongnu.org, Marcel Apfelbaum <marcel@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH qemu] pci: Add missing drop of bus master AS reference
Date: Tue, 28 Mar 2017 05:33:48 +0300 [thread overview]
Message-ID: <20170328053258-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170328000628.GA13461@umbus.fritz.box>
On Tue, Mar 28, 2017 at 11:06:28AM +1100, David Gibson wrote:
> On Mon, Mar 27, 2017 at 05:28:17PM +0200, Paolo Bonzini wrote:
> >
> >
> > On 27/03/2017 06:40, Alexey Kardashevskiy wrote:
> > > The recent introduction of a bus master container added
> > > memory_region_add_subregion() into the PCI device registering path but
> > > missed memory_region_del_subregion() in the unregistering path leaving
> > > a reference to the root memory region of the new container.
> > >
> > > This adds missing memory_region_del_subregion().
> > >
> > > Fixes: 3716d5902d743 ("pci: introduce a bus master container")
> > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > > ---
> > > hw/pci/pci.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> > > index e6b08e1988..bd8043c460 100644
> > > --- a/hw/pci/pci.c
> > > +++ b/hw/pci/pci.c
> > > @@ -869,6 +869,8 @@ static void do_pci_unregister_device(PCIDevice *pci_dev)
> > > pci_dev->bus->devices[pci_dev->devfn] = NULL;
> > > pci_config_free(pci_dev);
> > >
> > > + memory_region_del_subregion(&pci_dev->bus_master_container_region,
> > > + &pci_dev->bus_master_enable_region);
> > > address_space_destroy(&pci_dev->bus_master_as);
> > > }
> > >
> > >
> >
> > My own review fail. The enable subregion would be deleted when a memory
> > region is finalized, but the enable subregions is keeping the owner
> > alive. And until the owner is alive, the container region is not
> > deleted either. So there is a reference count cycle, which we need to
> > break.
> >
> > It's probably good to revisit commit 2e2b8eb ("memory: allow destroying
> > a non-empty MemoryRegion", 2015-10-01). For 2.9,
> >
> > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Merged to ppc-for-2.9.
I have it on pci branch, seems more appropriate.
> --
> David Gibson | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
> | _way_ _around_!
> http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2017-03-28 2:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-27 4:40 [Qemu-devel] [PATCH qemu] pci: Add missing drop of bus master AS reference Alexey Kardashevskiy
2017-03-27 15:28 ` Paolo Bonzini
2017-03-28 0:06 ` David Gibson
2017-03-28 2:33 ` Michael S. Tsirkin [this message]
2017-03-28 2:47 ` David Gibson
2017-03-29 2:40 ` Jason Wang
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=20170328053258-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=jasowang@redhat.com \
--cc=marcel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.