[PATCH v3 13/26] genirq: Factor-in percpu irqaction creation
Marc Zyngier
maz at kernel.org
Fri Oct 10 02:28:55 PDT 2025
On Fri, 10 Oct 2025 04:59:59 +0100,
Jinjie Ruan <ruanjinjie at huawei.com> wrote:
>
>
>
> On 2025/9/22 16:28, Marc Zyngier wrote:
> > 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 at huawei.com>
> > Signed-off-by: Marc Zyngier <maz at 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.
More information about the linux-arm-kernel
mailing list