Re: [patch 6/8] genirq: Provide IRQCHIP_AFFINITY_PRE_STARTUP

Thomas Gleixner
2021-07-28T10:40:31Z

On Thu, Jul 22 2021 at 16:12, Marc Zyngier wrote:
> On Wed, 21 Jul 2021 20:11:32 +0100,
> Thomas Gleixner <tglx@linutronix.de> wrote:
>> #include <linux/irqdesc.h>
>> --- a/kernel/irq/chip.c
>> +++ b/kernel/irq/chip.c
>> @@ -265,8 +265,11 @@ int irq_startup(struct irq_desc *desc, b
>> } else {
>> switch (__irq_startup_managed(desc, aff, force)) {
>> case IRQ_STARTUP_NORMAL:
>> + if (d->chip->flags & IRQCHIP_AFFINITY_PRE_STARTUP)
>> + irq_setup_affinity(desc);
>
> How about moving this to activate instead? We already special-case the
> activation of MSIs for PCI (MSI_FLAG_ACTIVATE_EARLY), and this
> wouldn't look completely out of place. The startup mode could be an
> issue though...

Yes, I thought about that, but the ordering here is:

setup()
early_activate()

early activation just needs to program a valid message. Now later we
have request_irq() invoking:

activate()
startup()

So, yes. We could do that in activate, but then we still have the post
startup variant in irq_startup() which makes the code hard to follow.

There is another practical issue. Assume the irq is requested with
IRQF_NOAUTOEN, then irq_startup() will be invoked when the driver calls
enable_irq(), which might be way later and then the affinity setting
might be completely different already. So I rather keep it there.

Thanks,

tglx