[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMOZA0Jj=BYXx1QYxFQRbtmFYfZeQBySqDS6n1skHFEYD=1EZQ@mail.gmail.com>
Date: Wed, 19 Nov 2025 00:06:09 +0100
From: Luigi Rizzo <lrizzo@...gle.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Marc Zyngier <maz@...nel.org>, Luigi Rizzo <rizzo.unipi@...il.com>,
Paolo Abeni <pabeni@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>,
Sean Christopherson <seanjc@...gle.com>, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH v2 3/8] genirq: soft_moderation: implement fixed moderation
On Tue, Nov 18, 2025 at 7:25 PM Luigi Rizzo <lrizzo@...gle.com> wrote:
>
> On Tue, Nov 18, 2025 at 5:31 PM Thomas Gleixner <tglx@...utronix.de> wrote:
> >
> > On Tue, Nov 18 2025 at 11:09, Luigi Rizzo wrote:
> > > ...
> > > (I appreciate the time you are dedicating to this thread)
> >
> > It's hopefully saving me time and nerves later :)
> >
> > > ...
> > That's kinda true for the per interrupt accounting, but if you look at
> > it from a per CPU accounting perspective then you still can handle them
> > individually and mask them when they arrive within or trigger a delay
> > window. That means:
>
> ok, so to sum up, what are the correct methods to do the masking
> you suggest, should i use mask_irq()/unmask_irq() ?
I tried the following instead of disable_irq()/enable_irq().
This seems to work also for posted_msi with no arch-specific code, as
you suggested.
The drain_desc_list() function below should be usable directly with
hotplug remove callbacks.
I still need to figure out if there is anything special needed when
an interrupt is removed, or the system goes into suspend,
while irq_desc's are in the moderation list.
/* run this to mask and moderate an interrupt */
void irq_mod_mask(struct irq_desc *desc)
{
scoped_irqdesc_get_and_buslock(desc->irq_data.irq,
IRQ_GET_DESC_CHECK_GLOBAL) {
struct irq_mod_state *ms = this_cpu_ptr(&irq_mod_state);
/* Add to list of moderated desc on this CPU */
list_add(&desc->mod.ms_node, &ms->descs);
mask_irq(scoped_irqdesc);
ms->mask_irq++;
if (!hrtimer_is_queued(&ms->timer))
irq_moderation_start_timer(ms);
}
}
/* run this on the timer callback */
static int drain_desc_list(struct irq_mod_state *ms)
{
struct irq_desc *desc, *next;
uint srcs = 0;
/* Last round, remove from list and unmask_irq(). */
list_for_each_entry_safe(desc, next, &ms->descs, mod.ms_node) {
list_del_init(&desc->mod.ms_node);
srcs++;
ms->unmask_irq++;
scoped_irqdesc_get_and_buslock(desc->irq_data.irq,
IRQ_GET_DESC_CHECK_GLOBAL) {
unmask_irq(scoped_irqdesc);
}
}
return srcs;
}
cheers
luigi
Powered by blists - more mailing lists