Re: [PATCH] genirq/generic-chip: Set IRQ_DOMAIN_FLAG_DESTROY_GC in irq_domain_alloc_generic_chips()
From: Qingshuang Fu
Date: Fri Sep 04 2026 - 03:27:09 EST
在 2026/9/4 14:26, Thomas Gleixner 写道:
On Fri, Sep 04 2026 at 00:37, Herve Codina wrote:
On Wed, 2 Sep 2026 14:59:39 +0800
Qingshuang Fu <fuqingshuang@xxxxxxxxxx> wrote:
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.cThe flag has been intended to be use with irq_domain_instantiate() which can call
index 2c8bc6ce082e..13b634053a3e 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -308,6 +308,7 @@ int irq_domain_alloc_generic_chips(struct irq_domain *d,
dgc->gc_flags = info->gc_flags;
dgc->exit = info->exit;
d->gc = dgc;
+ d->flags |= IRQ_DOMAIN_FLAG_DESTROY_GC;
/* Calc pointer to the first generic chip */
tmp += dgc_sz;
irq_domain_alloc_generic_chips() internally. Callers of irq_domain_instantiate()
call only irq_remove_domain().
Indeed calling only irq_domain_instantiate() and calling both
irq_domain_remove_generic_chips() followed by irq_remove_domain() is, in that case,
not consistent too.
IHMO, if the flag IRQ_DOMAIN_FLAG_DESTROY_GC need to be automatically set
somewhere, it could be in irq_domain_instantiate().
Yes, in the 'if (info->dgc_info)' branch.
Hi,
Thank you very much for your valuable suggestion.
I have posted the v2 patch here:
https://lore.kernel.org/all/20260904070943.934476-1-fuqingshuang@xxxxxxxxxx/
In v2, IRQ_DOMAIN_FLAG_DESTROY_GC is now set inside the info->dgc_info
branch within __irq_domain_instantiate(), right after irq_domain_alloc_generic_chips()
succeeds.
Now only domains created via irq_domain_instantiate() with dgc_info get
IRQ_DOMAIN_FLAG_DESTROY_GC automatically. Explicit callers of
irq_domain_alloc_generic_chips() remain untouched and are still responsible
for cleaning‑up generic chips manually.
Regards,
Qingshuang Fu