From: sashiko-bot@kernel.org
To: "Kris Pan" <kris.pan@intel.com>
Cc: linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org,
linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 10/10] net: Keep core-managed IRQ affinity automatic
Date: Tue, 01 Dec 2026 03:41:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-242465@kernel.org> (raw)
In-Reply-To: <20261130033709.2704805-11-kris.pan@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] net: napi_restore_config() clobbers explicit user IRQ
affinity provenance
- [Medium] net: iavf_napi_poll() aborts polling on queues relocated by
irq_set_affinity_auto()
--
commit 0f2dab218632e320a8692e002bb91de0e36ea073
Author: Kris Pan <kris.pan@intel.com>
net: Keep core-managed IRQ affinity automatic
This commit switches napi_restore_config() to irq_set_affinity_auto() so
core-managed NAPI IRQs retain automatic placement provenance across NAPI
enable cycles, and updates CPU reverse maps in irq_cpu_rmap_notify() and
netif_napi_irq_notify() from irq_copy_programmed_affinity() when runtime
IRQ isolation is active.
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 88abf8ced9c5f..93a772d09d8b4 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[ ... ]
> @@ -7637,6 +7638,9 @@ netif_napi_irq_notify(struct irq_affinity_notify *notify,
> container_of(notify, struct napi_struct, notify);
> #ifdef CONFIG_RFS_ACCEL
> struct cpu_rmap *rmap = napi->dev->rx_cpu_rmap;
> + const struct cpumask *prog;
> + cpumask_var_t prog_mask;
> + bool allocated;
> int err;
> #endif
>
> @@ -7645,7 +7649,23 @@ netif_napi_irq_notify(struct irq_affinity_notify *notify,
>
> #ifdef CONFIG_RFS_ACCEL
> if (napi->dev->rx_cpu_rmap_auto) {
> - err = cpu_rmap_update(rmap, napi->napi_rmap_idx, mask);
> + /*
> + * The notifier reports the requested mask; the reverse map
> + * has to describe the CPUs the chip is asked to use, which
> + * runtime IRQ isolation may have filtered or relocated.
> + */
> + prog = mask;
> + allocated = false;
> + /* See irq_cpu_rmap_notify(). */
> + if (irq_isolation_active()) {
> + allocated = alloc_cpumask_var(&prog_mask, GFP_KERNEL);
> + if (allocated &&
> + irq_copy_programmed_affinity(napi->irq, prog_mask))
> + prog = prog_mask;
> + }
> + err = cpu_rmap_update(rmap, napi->napi_rmap_idx, prog);
> + if (allocated)
> + free_cpumask_var(prog_mask);
> if (err)
> netdev_warn(napi->dev, "RMAP update failed (%d)\n",
> err);
[Severity: Medium]
When runtime IRQ isolation relocates an automatic NAPI IRQ to a
housekeeping CPU, does leaving napi->config->affinity_mask set to the
unfiltered requested mask break iavf_napi_poll()?
iavf opts into core-managed affinity via netif_set_affinity_auto() and
checks napi->config->affinity_mask in its poll loop to stop polling when
an IRQ moves to another CPU:
drivers/net/ethernet/intel/iavf/iavf_txrx.c:iavf_napi_poll() {
...
if (!clean_complete) {
int cpu_id = smp_processor_id();
/* It is possible that the interrupt affinity has changed but,
* if the cpu is pegged at 100%, polling will never exit while
* traffic continues and the interrupt will be stuck on this
* cpu. We check to make sure affinity is correct before we
* continue to poll, otherwise we must stop polling so the
* interrupt can move to the correct cpu.
*/
if (!cpumask_test_cpu(cpu_id,
&q_vector->napi.config->affinity_mask)) {
/* Tell napi that we are done polling */
napi_complete_done(napi, work_done);
/* Force an interrupt */
iavf_force_wb(vsi, q_vector);
/* Return budget-1 so that polling stops */
return budget - 1;
}
...
}
Because netif_napi_irq_notify() copies the unfiltered mask into
napi->config->affinity_mask and only uses irq_copy_programmed_affinity()
for cpu_rmap_update(), a queue relocated by irq_set_affinity_auto() from
an isolated CPU to a housekeeping CPU will never find smp_processor_id()
in napi->config->affinity_mask. Under sustained load (!clean_complete),
every poll cycle on the housekeeping CPU aborts after a single budget and
triggers an immediate hardware interrupt via iavf_force_wb().
> @@ -7796,7 +7816,7 @@ static void napi_restore_config(struct napi_struct *n)
>
> if (n->dev->irq_affinity_auto &&
> test_bit(NAPI_STATE_HAS_NOTIFIER, &n->state))
> - irq_set_affinity(n->irq, &n->config->affinity_mask);
> + irq_set_affinity_auto(n->irq, &n->config->affinity_mask);
[Severity: Medium]
Does calling irq_set_affinity_auto() unconditionally in
napi_restore_config() overwrite explicit user IRQ pinning across NAPI
enable cycles?
When an administrator pins a queue IRQ via /proc/irq/N/smp_affinity,
write_irq_affinity() calls irq_set_affinity(), which clears
IRQS_AFFINITY_AUTO on desc->istate and notifies netif_napi_irq_notify().
netif_napi_irq_notify() saves the user mask into
napi->config->affinity_mask, which is meant to preserve user-configured
affinity across device resets, without recording that the mask came from
an explicit user request rather than the initial automatic spread.
On the next napi_enable_locked() (such as link down/up, MTU change, or
ethtool channel change), napi_restore_config() calls
irq_set_affinity_auto() with that user mask, which passes
IRQ_AFFINITY_SET_AUTO to __irq_set_affinity() and re-sets
IRQS_AFFINITY_AUTO. Runtime IRQ isolation then treats the explicitly
pinned IRQ as automatically placed and relocates it to housekeeping CPUs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130033709.2704805-1-kris.pan@intel.com?part=10
next prev parent reply other threads:[~2026-12-01 3:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 3:36 [RFC PATCH 00/10] genirq/cpuset: Evict unmanaged IRQs from runtime-isolated CPUs Kris Pan
2026-11-30 3:36 ` [RFC PATCH 01/10] genirq: Add IRQCHIP_AFFINITY_FILTERABLE flag Kris Pan
2026-11-30 3:37 ` [RFC PATCH 02/10] sched/isolation: Add runtime isolation helpers Kris Pan
2026-11-30 3:37 ` [RFC PATCH 03/10] genirq: Track automatic vs. explicit affinity provenance Kris Pan
2026-11-30 3:37 ` [RFC PATCH 04/10] genirq: Filter unmanaged IRQ affinity against runtime isolation Kris Pan
2026-11-30 3:37 ` [RFC PATCH 05/10] genirq: Reapply unmanaged IRQ affinity on isolation changes Kris Pan
2026-12-01 3:41 ` sashiko-bot
2026-11-30 3:37 ` [RFC PATCH 06/10] genirq: Align affinity notifiers and IRQ threads with isolation Kris Pan
2026-12-01 3:41 ` sashiko-bot
2026-11-30 3:37 ` [RFC PATCH 07/10] genirq: Handle runtime isolation across hotplug and suspend Kris Pan
2026-12-01 3:41 ` sashiko-bot
2026-11-30 3:37 ` [RFC PATCH 08/10] x86/apic: Support runtime IRQ isolation Kris Pan
2026-12-01 3:41 ` sashiko-bot
2026-11-30 3:37 ` [RFC PATCH 09/10] sched/isolation: Publish runtime isolation to genirq Kris Pan
2026-11-30 3:37 ` [RFC PATCH 10/10] net: Keep core-managed IRQ affinity automatic Kris Pan
2026-12-01 3:41 ` sashiko-bot [this message]
2026-12-01 3:41 ` [RFC PATCH 00/10] genirq/cpuset: Evict unmanaged IRQs from runtime-isolated CPUs sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-242465@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kris.pan@intel.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox