From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: "Marek Behún" <kabel@kernel.org>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Rob Herring" <robh@kernel.org>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH] PCI: mvebu: Dispose INTx irqs prior to removing INTx domain
Date: Thu, 20 Jun 2024 11:58:53 +0530 [thread overview]
Message-ID: <20240620062853.GA15813@thinkpad> (raw)
In-Reply-To: <20240619142829.2804-1-kabel@kernel.org>
+ Marc
On Wed, Jun 19, 2024 at 04:28:29PM +0200, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
>
> Documentation for irq_domain_remove() says that all mapping within the
> domain must be disposed prior to domain remove.
>
> Currently INTx irqs are not disposed in pci-mvebu.c device unbind callback
> which cause that kernel crashes after unloading driver and trying to read
> /sys/kernel/debug/irq/irqs/<num> or /proc/interrupts.
>
Thanks a lot for respinning this patch. It is indeed fixing a real problem since
this driver can be unloaded runtime.
It is always a debate on whether an irqchip controller should be allowed to be
removed runtime or not, but I hope Marc will provide some inputs here.
> Fixes: ec075262648f ("PCI: mvebu: Implement support for legacy INTx interrupts")
> Reported-by: Hajo Noerenberg <hajo-linux-bugzilla@noerenberg.de>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Marek Behún <kabel@kernel.org>
> [ refactored a little ]
> Signed-off-by: Marek Behún <kabel@kernel.org>
But this patch looks good to me. I hope that we should be able to use this patch
as a precedent for other drivers as well.
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
- Mani
> ---
> This was discussed back in 2022
> https://lore.kernel.org/linux-arm-kernel/20220709161858.15031-1-pali@kernel.org/
> IMO Pali gave good arguments about why it should be applied, and Lorenzo
> agreed.
>
> Can we get this applied?
> ---
> drivers/pci/controller/pci-mvebu.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
> index 29fe09c99e7d..91a02b23aeb1 100644
> --- a/drivers/pci/controller/pci-mvebu.c
> +++ b/drivers/pci/controller/pci-mvebu.c
> @@ -1683,8 +1683,15 @@ static void mvebu_pcie_remove(struct platform_device *pdev)
> irq_set_chained_handler_and_data(irq, NULL, NULL);
>
> /* Remove IRQ domains. */
> - if (port->intx_irq_domain)
> + if (port->intx_irq_domain) {
> + for (int j = 0; j < PCI_NUM_INTX; j++) {
> + int virq = irq_find_mapping(port->intx_irq_domain, j);
> +
> + if (virq > 0)
> + irq_dispose_mapping(virq);
> + }
> irq_domain_remove(port->intx_irq_domain);
> + }
>
> /* Free config space for emulated root bridge. */
> pci_bridge_emul_cleanup(&port->bridge);
> --
> 2.44.2
>
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-06-20 6:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 14:28 [PATCH] PCI: mvebu: Dispose INTx irqs prior to removing INTx domain Marek Behún
2024-06-20 6:28 ` Manivannan Sadhasivam [this message]
2024-06-20 13:16 ` Andrew Lunn
-- strict thread matches above, loose matches on Subject: below --
2022-07-09 16:18 Pali Rohár
2022-07-10 0:14 ` Pali Rohár
2022-08-09 1:26 ` Jianjun Wang
2022-07-11 11:44 ` Marek Behún
2022-08-08 18:44 ` Pali Rohár
2022-08-09 2:00 ` Bjorn Helgaas
2022-08-09 13:39 ` Pali Rohár
2022-08-25 13:43 ` Lorenzo Pieralisi
2022-08-29 9:54 ` Lorenzo Pieralisi
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=20240620062853.GA15813@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=andrew@lunn.ch \
--cc=bhelgaas@google.com \
--cc=gregory.clement@bootlin.com \
--cc=kabel@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=maz@kernel.org \
--cc=robh@kernel.org \
--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 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).