Re: [PATCH 3/6] genirq: soft_moderation: activate hooks in handle_irq_event()

From: Thomas Gleixner

Date: Thu Nov 13 2025 - 04:45:14 EST


On Wed, Nov 12 2025 at 19:24, Luigi Rizzo wrote:

Forgot to mention it on the earlier patches. The subject line is wrong
in multiple aspects. See documentation.

> arch/x86/kernel/cpu/common.c | 1 +
> drivers/irqchip/irq-gic-v3.c | 2 ++

How are those related to the subject?

> kernel/irq/handle.c | 3 +++
> kernel/irq/irqdesc.c | 1 +
> 4 files changed, 7 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 02d97834a1d4d..1953419fde6ff 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -2440,6 +2440,7 @@ void cpu_init(void)
>
> intel_posted_msi_init();
> }
> + irq_moderation_percpu_init();

Why is this called in architecture specific code? There is absolutely
nothing architecture specific about this. The CPU hotplug infrastructure
can handle this just fine in a generic way.

> #include <asm/irq_regs.h>
> @@ -254,9 +255,11 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
> irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
> raw_spin_unlock(&desc->lock);
>
> + irq_moderation_hook(desc); /* may disable irq so must run unlocked */

That's just wrong. That can trivially be implemented in a way which
works with the lock held.

> ret = handle_irq_event_percpu(desc);
> raw_spin_lock(&desc->lock);
> + irq_moderation_epilogue(desc); /* start moderation timer if needed */
> irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
> return ret;
> }
> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
> index db714d3014b5f..e3efbecf5b937 100644
> --- a/kernel/irq/irqdesc.c
> +++ b/kernel/irq/irqdesc.c
> @@ -134,6 +134,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,
> desc->tot_count = 0;
> desc->name = NULL;
> desc->owner = owner;
> + irq_moderation_init_fields(desc);

That's clearly part of activation in handle_irq_event() ....

Thanks

tglx