Re: [PATCH] PCI: altera: Convert root port IRQ to a requested handler

From: Manivannan Sadhasivam

Date: Fri Oct 30 2026 - 06:10:23 EST


On Wed, Oct 14, 2026 at 06:07:23PM +0800, Mahesh Vaidya wrote:
> altera_pcie_irq_teardown() removes the chained handler before removing
> the INTx domain. Removing the handler prevents new invocations, but does
> not wait for one already running on another CPU. Such a handler can
> therefore access pcie or pcie->irq_domain after they have been freed.
>
> Chained handlers bypass handle_irq_event(), so synchronize_irq() cannot
> rely on IRQD_IRQ_INPROGRESS and may return without waiting if the parent
> irqchip does not report IRQCHIP_STATE_ACTIVE.
>
> Convert the chained handler to a requested hard IRQ. Request it only
> after creating the INTx domain and call free_irq() before removing the
> domain. free_irq() then synchronizes against any in-flight handler.
>
> Use IRQF_NO_THREAD because generic_handle_domain_irq() requires hardirq
> context. Use IRQF_NO_SUSPEND to preserve the suspend behavior of the
> previous chained cascade. Request and free the IRQ explicitly because
> automatic devres cleanup happens after remove() returns.
>
> Fixes: ec15c4d0d5d2 ("PCI: altera: Allow building as module")
> Reported-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Link: https://lore.kernel.org/linux-pci/20260430204330.3121003-3-mahesh.vaidya@xxxxxxxxxx/
> Suggested-by: Dinh Nguyen <dinguyen@xxxxxxxxxx>
> Assisted-by: ChatGPT:GPT-5
> Signed-off-by: Mahesh Vaidya <mahesh.vaidya@xxxxxxxxxx>

Thomas, can you please share your review?

- Mani

--
மணிவண்ணன் சதாசிவம்