From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Hanjun Guo <guohanjun@huawei.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
"Nadav Haklai" <nadavh@marvell.com>,
Gregory Clement <gregory.clement@bootlin.com>,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Antoine Tenart <antoine.tenart@bootlin.com>,
Stefan Chulski <stefanc@marvell.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] platform-msi: Free descriptors in platform_msi_domain_free()
Date: Sat, 17 Nov 2018 22:02:38 +0100 [thread overview]
Message-ID: <20181117220238.1b56e9c2@xps13> (raw)
In-Reply-To: <15c33e01-b60a-8e74-5399-12e7ca2da8d1@huawei.com>
Hi Marc, Hanjun,
Hanjun Guo <guohanjun@huawei.com> wrote on Mon, 12 Nov 2018 11:30:42
+0800:
> Hi Marc, Miquel,
>
> On 2018/10/12 18:24, Marc Zyngier wrote:
> > Hi Miquel,
> >
> > On 11/10/18 10:12, Miquel Raynal wrote:
> >> Since the addition of platform MSI support, there were two helpers
> >> supposed to allocate/free IRQs for a device:
> >>
> >> platform_msi_domain_alloc_irqs()
> >> platform_msi_domain_free_irqs()
> >>
> >> In these helpers, IRQ descriptors are allocated in the "alloc" routine
> >> while they are freed in the "free" one.
> >>
> >> Later, two other helpers have been added to handle IRQ domains on top
> >> of MSI domains:
> >>
> >> platform_msi_domain_alloc()
> >> platform_msi_domain_free()
> >>
> >> Seen from the outside, the logic is pretty close with the former
> >> helpers and people used it with the same logic as before: a
> >> platform_msi_domain_alloc() call should be balanced with a
> >> platform_msi_domain_free() call. While this is probably what was
> >> intended to do, the platform_msi_domain_free() does not remove/free
> >> the IRQ descriptor(s) created/inserted in
> >> platform_msi_domain_alloc().
> >>
> >> One effect of such situation is that removing a module that requested
> >> an IRQ will let one orphaned IRQ descriptor (with an allocated MSI
> >> entry) in the device descriptors list. Next time the module will be
> >> inserted back, one will observe that the allocation will happen twice
> >> in the MSI domain, one time for the remaining descriptor, one time for
> >> the new one. It also has the side effect to quickly overshoot the
> >> maximum number of allocated MSI and then prevent any module requesting
> >> an interrupt in the same domain to be inserted anymore.
> >>
> >> This situation has been met with loops of insertion/removal of the
> >> mvpp2.ko module (requesting 15 MSIs each time).
> >>
> >> Fixes: 552c494a7666 ("platform-msi: Allow creation of a MSI-based stacked irq domain")
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> >
> > Thanks for the respin. If nobody disagrees, I'll route this through Thomas to stash into tip, and hopefully have that in 4.19.
>
> I didn't see this patch hit mainline, did I miss something?
Indeed, I can't see it neither. Marc, is it possible to have it queued
for your next PR?
Miquèl
next prev parent reply other threads:[~2018-11-18 7:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 9:12 [PATCH v2] platform-msi: Free descriptors in platform_msi_domain_free() Miquel Raynal
2018-10-12 10:24 ` Marc Zyngier
2018-11-12 3:30 ` Hanjun Guo
2018-11-17 21:02 ` Miquel Raynal [this message]
2018-12-12 14:33 ` Miquel Raynal
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=20181117220238.1b56e9c2@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=antoine.tenart@bootlin.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@bootlin.com \
--cc=guohanjun@huawei.com \
--cc=marc.zyngier@arm.com \
--cc=maxime.chevallier@bootlin.com \
--cc=nadavh@marvell.com \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
--cc=stefanc@marvell.com \
--cc=thomas.petazzoni@bootlin.com \
/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.