Re: [PATCH v3 13/26] genirq: Factor-in percpu irqaction creation
From: Marc Zyngier <maz@kernel.org>
Date: 2025-10-10 09:28:58
Also in:
linux-acpi, lkml
On Fri, 10 Oct 2025 04:59:59 +0100, Jinjie Ruan [off-list ref] wrote:
On 2025/9/22 16:28, Marc Zyngier wrote:quoted
Move the code creating a per-cpu irqaction into its own helper, so that future changes to this code can be kept localised. At the same time, fix the documentation which appears to say the wrong thing when it comes to interrupts being automatically enabled (percpu_devid interrupts never are). Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Marc Zyngier <maz@kernel.org> --- kernel/irq/manage.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-)diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index c94837382037e..d9ddc30678b5d 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c@@ -2442,6 +2442,24 @@ int setup_percpu_irq(unsigned int irq, struct irqaction *act) return retval; } +static +struct irqaction *create_percpu_irqaction(irq_handler_t handler, unsigned long flags, + const char *devname, void __percpu *dev_id) +{ + struct irqaction *action; + + action = kzalloc(sizeof(struct irqaction), GFP_KERNEL); + if (!action) + return NULL; + + action->handler = handler; + action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND; + action->name = devname; + action->percpu_dev_id = dev_id; + + return action; +}This helper could be more universal by consider by distinguishing dev_id and percpu_dev_id, so we can use it in request_nmi() and request_threaded_irq() .
This would mean either adding extra parameters to this function (ugly) or having type confusion by dropping the __percpu attribute (nasty). I'd rather you add a separate helper that deals with non-percpu interrupts, and not mess with something that is definitely meant for percpu interrupts. Thanks, M. -- Without deviation from the norm, progress is not possible.