From: Bjorn Helgaas <helgaas@kernel.org>
To: Ali Tariq <alitariq45892@gmail.com>
Cc: "Daire McNamara" <daire.mcnamara@microchip.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Mason Huo" <mason.huo@starfivetech.com>,
"Minda Chen" <minda.chen@starfivetech.com>,
"open list:PCI DRIVER FOR PLDA PCIE IP"
<linux-pci@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PCI: plda: Synchronize chained IRQs during deinitialization
Date: Tue, 14 Jul 2026 12:58:52 -0500 [thread overview]
Message-ID: <20260714175852.GA1387886@bhelgaas> (raw)
In-Reply-To: <20260714174345.1073909-1-alitariq45892@gmail.com>
On Tue, Jul 14, 2026 at 10:43:45PM +0500, Ali Tariq wrote:
> During driver unbind or probe failure teardown,
> plda_pcie_irq_domain_deinit() unlinks the chained interrupt
> handlers for the main, MSI, and INTx interrupts using
> irq_set_chained_handler_and_data(). However, this function
> only updates the handler pointers and does not wait for any
> in-flight interrupt handlers running on other CPUs to finish.
>
> If a PCIe interrupt fires concurrently with the teardown
> process, the handler could continue running on another CPU.
> If the hardware clocks are disabled shortly after in
> host_deinit(), the executing handler will attempt to read
> un-clocked PCIe registers, triggering a fatal system bus
> fault (external abort) or kernel panic.
>
> Add synchronize_irq() after clearing each chained handler to
> guarantee that any executing handlers have fully completed
> before proceeding with interrupt domain removal and hardware
> deinitialization.
>
> Fixes: 76c911396807 ("PCI: plda: Add host init/deinit and map bus functions")
> Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
> ---
> drivers/pci/controller/plda/pcie-plda-host.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c
> index f9a34f323ad8..f6759e255c75 100644
> --- a/drivers/pci/controller/plda/pcie-plda-host.c
> +++ b/drivers/pci/controller/plda/pcie-plda-host.c
> @@ -560,8 +560,13 @@ EXPORT_SYMBOL_GPL(plda_pcie_setup_iomems);
> static void plda_pcie_irq_domain_deinit(struct plda_pcie_rp *pcie)
> {
> irq_set_chained_handler_and_data(pcie->irq, NULL, NULL);
> + synchronize_irq(pcie->irq);
> +
> irq_set_chained_handler_and_data(pcie->msi_irq, NULL, NULL);
> + synchronize_irq(pcie->msi_irq);
> +
> irq_set_chained_handler_and_data(pcie->intx_irq, NULL, NULL);
> + synchronize_irq(pcie->intx_irq);
Several other drivers call irq_set_chained_handler_and_data(..., NULL)
without synchronize_irq(). Do they need similar fixes?
> irq_domain_remove(pcie->msi.dev_domain);
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-07-14 17:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 17:43 [PATCH] PCI: plda: Synchronize chained IRQs during deinitialization Ali Tariq
2026-07-14 17:58 ` Bjorn Helgaas [this message]
2026-07-16 9:25 ` Ali Tariq
2026-07-14 18:02 ` sashiko-bot
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=20260714175852.GA1387886@bhelgaas \
--to=helgaas@kernel.org \
--cc=alitariq45892@gmail.com \
--cc=bhelgaas@google.com \
--cc=daire.mcnamara@microchip.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=mason.huo@starfivetech.com \
--cc=minda.chen@starfivetech.com \
--cc=robh@kernel.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