From: Greg Kurz <groug@kaod.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Cédric Le Goater" <clg@kaod.org>,
qemu-stable <qemu-stable@nongnu.org>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH 2/3] spapr/pci: Free MSIs during reset
Date: Fri, 26 Jul 2019 19:04:10 +0200 [thread overview]
Message-ID: <20190726190410.6c882fcd@bahia.lan> (raw)
In-Reply-To: <b52e6301-fd01-7a37-974b-d8e062af9490@redhat.com>
On Fri, 26 Jul 2019 18:17:57 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> Cc'ing qemu-stable@
>
This patch relies on the previous one, otherwise g_hash_table_remove_all() will
just g_free() the spapr_pci_msi structures, but it will not tear down the MSIs
in the interrupt controller.
Also, this bug is so old that I'm not sure it qualifies for stable.
> On 7/26/19 4:44 PM, Greg Kurz wrote:
> > When the machine is reset, the MSI bitmap is cleared but the allocated
> > MSIs are not freed. Some operating systems, such as AIX, can detect the
> > previous configuration and assert.
> >
> > Empty the MSI cache, this performs the needed cleanup.
> >
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> > hw/ppc/spapr_pci.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> > index bc22568bfa71..e45507bf2b53 100644
> > --- a/hw/ppc/spapr_pci.c
> > +++ b/hw/ppc/spapr_pci.c
> > @@ -2078,6 +2078,8 @@ static void spapr_phb_reset(DeviceState *qdev)
> > if (spapr_phb_eeh_available(SPAPR_PCI_HOST_BRIDGE(qdev))) {
> > spapr_phb_vfio_reset(qdev);
> > }
> > +
> > + g_hash_table_remove_all(sphb->msi);
>
> It is not clear to my why spapr_phb_unrealize() doesn't require the same
> call, but this is not related to this patch.
>
Because spapr_phb_unrealize() does this:
if (sphb->msi) {
g_hash_table_unref(sphb->msi);
sphb->msi = NULL;
}
and
https://developer.gnome.org/glib/stable/glib-Hash-Tables.html#g-hash-table-unref
g_hash_table_unref ()
void
g_hash_table_unref (GHashTable *hash_table);
Atomically decrements the reference count of hash_table by one. If the reference
count drops to 0, all keys and values will be destroyed, and all memory allocated
by the hash table is released. This function is MT-safe and may be called from any
thread.
If I have to re-post, I can make it clear with a comment.
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
> > }
> >
> > static Property spapr_phb_properties[] = {
> >
> >
next prev parent reply other threads:[~2019-07-26 17:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-26 14:44 [Qemu-devel] [PATCH 0/3] spapr/pci: Improve MSI tracking Greg Kurz
2019-07-26 14:44 ` [Qemu-devel] [PATCH 1/3] spapr/pci: Consolidate de-allocation of MSIs Greg Kurz
2019-07-26 14:56 ` Cédric Le Goater
2019-07-28 1:54 ` David Gibson
2019-07-26 14:44 ` [Qemu-devel] [PATCH 2/3] spapr/pci: Free MSIs during reset Greg Kurz
2019-07-26 14:56 ` Cédric Le Goater
2019-07-26 16:17 ` Philippe Mathieu-Daudé
2019-07-26 17:04 ` Greg Kurz [this message]
2019-07-28 7:06 ` David Gibson
2019-07-26 14:44 ` [Qemu-devel] [PATCH 3/3] spapr/irq: Drop spapr_irq_msi_reset() Greg Kurz
2019-07-26 15:01 ` Cédric Le Goater
2019-07-26 15:06 ` Greg Kurz
2019-07-28 7:07 ` David Gibson
2019-07-28 1:51 ` [Qemu-devel] [PATCH 0/3] spapr/pci: Improve MSI tracking David Gibson
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=20190726190410.6c882fcd@bahia.lan \
--to=groug@kaod.org \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-stable@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).