Re: [PATCH 1/6] genirq: platform wide interrupt moderation: Documentation, Kconfig, irq_desc

From: Luigi Rizzo

Date: Thu Nov 13 2025 - 09:56:33 EST


On Thu, Nov 13, 2025 at 3:42 PM Marc Zyngier <maz@xxxxxxxxxx> wrote:
> [...]

>
> The descriptions are also massively x86-specific. That's probably OK
> for the stuff you care about, but I'd certainly would want things to
> be a bit more abstract and applicable to all architectures.

Absolutely.

> I also note that since you explicitly check for handle_edge_irq() in
> set_moderation_mode(), this will not work on anything GIC related, or
> any other architecture that uses the fasteoi flows. I really wonder
> why you are not looking at the actual trigger mode instead...

sure, that would be the best thing. Any suggestions on how to fix the
check ?

>
> Until you fix it, please refrain from touching the GICv3 code, and
> make sure this is solely enabled on x86 -- it clearly wasn't tested on
> anything else.

FWIW I did verify correct operation and performance boost on arm64,
both network and nvme (this was a previous version which
did not restrict to handle_edge_irq).

Also FWIW there should be nothing architecture-specific in this series.
The only reason I touched arch-specific code was to add initialization
of percpu structs, and that only because I had not found a better way
to run it before interrupts were activated.

Following Thomas' suggestion, this is now being replaced with
a more appropriate, architecture-independent code below

/* Per-CPU state initialization */
static void irq_moderation_percpu_init(void *data)
{
struct irq_mod_state *ms = this_cpu_ptr(&irq_mod_state);

hrtimer_setup(&ms->timer, moderation_timer_cb,
CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED_HARD);
INIT_LIST_HEAD(&ms->descs);
}

static int cpuhp_setup_cb(uint cpu)
{
irq_moderation_percpu_init(NULL);
return 0;
}

static int __init init_irq_moderation(void)
{
on_each_cpu(irq_moderation_percpu_init, NULL, 1);
irq_mod_info.initialized = 1;
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
"moderation:online", cpuhp_setup_cb, NULL);
proc_create_data("irq/soft_moderation", 0644, NULL, &proc_ops,
(void *)0);
return 0;
}

cheers
luigi