Re: [PATCH 0/3] irqchip: Remove interrupt domains on driver teardown

From: Radu Rendec

Date: Sat Nov 28 2026 - 16:37:14 EST


On Sat, 2026-11-28 at 17:41 +0800, Guangshuo Li wrote:
> Pair domain creation with removal in the LS external interrupt, TI SCI
> interrupt and UniPhier AIDET drivers.
>
> Guangshuo Li (3):
>   irqchip/ls-extirq: Remove the interrupt domain on unbind
>   irqchip/ti-sci-intr: Remove the interrupt domain on unbind
>   irqchip/uniphier-aidet: Remove the interrupt domain on unbind
>
> base-commit: 1aed0e209f0c3bb1f28d4d69c2fc23528d30981e

Thanks for the patches! I agree that they fix a real bug: leaking the
IRQ domain on the removal path - and it's true even for the drivers
that can be compiled only as built-in because (at least in theory) the
platform device can be explicitly unbound from the driver, even if the
driver itself cannot be removed from the kernel.

But I think the fix is incomplete and makes things worse in the
presence of downstream IRQ consumers. irq_domain_remove() makes *no*
checks for active mappings, and this is documented in the comment block
above the function. So it will remove the per-domain data associated
with mapped IRQs as well as the domain itself, while those IRQs are
active and can trigger at any time.

For irq-ls-extirq.c and irq-uniphier-aidet.c, I think the more
reasonable fix is to disable unbinding by setting .suppress_bind_attrs
to true in the driver structure. devm handling still makes sense for
the reset of the probe function, for rollback on the failure paths; but
the domain is created last and there's nothing else that can fail after
that, so there's no need to ever remove it at probe time.

For irq-ti-sci-intr.c, things are different because it's defined as
tristate in Kconfig, so it can be unloaded. I would do something
similar to what drivers/irqchip/irq-ts4800.c does in its remove
function: iterate through the mappings and explicitly remove them,
before calling irq_domain_remove().

That said, I think there are at least two other drivers that have
similar/related problems:
* drivers/irqchip/irq-ast2700-intc0.c has the same problem as this
series tries to fix: it calls irq_domain_create_hierarchy() but
there is no matching irq_domain_remove() for the unbind path.
* drivers/irqchip/irq-stm32mp-exti.c does exactly what you did, and
therefore has the problem I described above (for active mappings).