From: netdev-bot+sashiko@kernel.org
To: kuba@kernel.org
Cc: davem@davemloft.net, michael.chan@broadcom.com,
netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org,
pavan.chebbi@broadcom.com, bjorn@kernel.org, joe@dama.to
Subject: Re: [PATCH net-next v2 2/7] eth: bnxt_en: follow explicitly set IRQ affinity when placing page pool
Date: Mon, 23 Nov 2026 03:52:52 +0000 [thread overview]
Message-ID: <179540597280.3135.6843062872659992639@kernel.org> (raw)
In-Reply-To: <20261120035214.369158-3-kuba@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0 (1)
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The page pool's NUMA node is chosen from a cached
bp->ring_nid[] entry before the driver checks whether that entry has…
Pre-existing issues:
- [Low] Two different CPUs can be taken from the same affinity mask.
--
eth: bnxt_en: follow explicitly set IRQ affinity when placing page pool
This patch makes the NUMA node of the Rx page pool follow IRQ affinity
that the user set explicitly. The affinity notifier computes the node of
the first online CPU in the mask and publishes it in a new bp->ring_nid[]
array. bnxt_alloc_rx_rings() and bnxt_queue_mem_alloc() look the node up
through a new helper, bnxt_cp_num_to_node(), which falls back to
cpumask_local_spread() when no affinity was set.
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index fe90689e4079d..96f226165ed94 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -3823,6 +3823,20 @@ static int bnxt_alloc_ring(struct bnxt *bp, struct bnxt_ring_mem_info *rmem)
> return 0;
> }
>
> +/* Node of the CPU expected to service cp ring @n. If user did not configure
> + * the affinity explicitly, use the default spread (historic behavior).
> + */
> +static int bnxt_cp_num_to_node(struct bnxt *bp, int n)
> +{
> + int nid = READ_ONCE(bp->ring_nid[n]);
> + unsigned int cpu;
> +
> + if (nid != NUMA_NO_NODE)
> + return nid;
[Severity: Medium]
Can this return a stale node when the recorded mask no longer has any
online CPU?
The only place that resets ring_nid[i] to NUMA_NO_NODE for a stale mask
is bnxt_request_irq(). In __bnxt_open_nic(), memory is allocated before
the IRQs are requested:
__bnxt_open_nic() {
...
rc = bnxt_alloc_mem(bp, irq_re_init);
...
if (irq_re_init) {
bnxt_init_napi(bp);
rc = bnxt_request_irq(bp);
...
}
This means bnxt_alloc_mem()->bnxt_alloc_rx_rings()->bnxt_cp_num_to_node()
reads ring_nid[i] before this check runs:
if (!test_bit(i, bp->ring_affinity_set) ||
!cpumask_intersects(cpu_mask, cpu_online_mask)) {
clear_bit(i, bp->ring_affinity_set);
WRITE_ONCE(bp->ring_nid[i], NUMA_NO_NODE);
Here is one sequence. The user pins ring i through
/proc/irq/N/smp_affinity, the device is closed, and then every CPU in
that mask goes offline. The notifier was released with the IRQs, and
hotplug IRQ migration does not call it.
On the next open, the page pool and ring memory are allocated on the old
node. bnxt_request_irq() then moves the IRQ to
cpumask_local_spread(i, numa_node), which may be on a different node.
Before this patch, both used cpumask_local_spread() and ended up on the
same node.
bnxt_half_open_nic() calls bnxt_alloc_mem() but never calls
bnxt_request_irq(), so on that path the stale value is never corrected.
The later patch in the series ("restart Rx queues when their IRQ moves to
another NUMA node") does not seem to fix this either. Its
bnxt_irq_affinity_update() only acts when nid != NUMA_NO_NODE, and
bnxt_request_irq() has just reset ring_nid to NUMA_NO_NODE. The mismatch
would last until the next affinity change or close/open.
At that point the comment on ring_nid in bnxt.h ("NUMA node of the first
online CPU in the affinity mask") also does not hold.
Would it work to check cpumask_intersects() in bnxt_cp_num_to_node(), or
to invalidate stale entries before bnxt_alloc_mem() runs?
> + cpu = cpumask_local_spread(n, dev_to_node(&bp->pdev->dev));
> + return cpu_to_node(cpu);
> +}
[ ... ]
> @@ -11882,6 +11896,14 @@ static void bnxt_irq_affinity_notify(struct irq_affinity_notify *notify,
> cpumask_copy(irq->bp->ring_cpu_mask[irq->ring_nr], mask);
> set_bit(irq->ring_nr, irq->bp->ring_affinity_set);
>
> + /* Readers can't access ring_cpu_mask atomically, so pre-compute
> + * the info they care about (NUMA node, TPH tag) and store it
> + * with WRITE_ONCE().
> + */
> + cpu = cpumask_first_and(mask, cpu_online_mask);
> + nid = cpu < nr_cpu_ids ? cpu_to_node(cpu) : NUMA_NO_NODE;
> + WRITE_ONCE(irq->bp->ring_nid[irq->ring_nr], nid);
[Severity: Low]
This is a pre-existing issue and was not introduced by this patch. The
TPH steering tag later in this same notifier is still computed from
cpumask_first(mask):
if (pcie_tph_get_cpu_st(irq->bp->pdev, TPH_MEM_TYPE_VM,
cpumask_first(mask), &tag))
return;
The ST table init in bnxt_request_irq() also uses
cpumask_first(cpu_mask). A user-written mask only has to overlap the
online mask, so its lowest CPU can be offline.
With such a mask, the steering tag targets one CPU, while
bnxt_queue_mem_alloc()->bnxt_cp_num_to_node() places the page pool on
the node of a different CPU.
Before this patch the page pool node ignored the mask entirely, so this
patch narrows the mismatch rather than causing it. Could the node and the
tag both use the first online CPU in the mask, so that they stay
consistent?
> #ifdef CONFIG_RFS_ACCEL
> if (irq->bp->dev->rx_cpu_rmap && irq->ring_nr < irq->bp->rx_nr_rings) {
> int err;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120035214.369158-1-kuba%40kernel.org
next prev parent reply other threads:[~2026-11-23 3:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 3:52 [PATCH net-next v2 0/7] eth: bnxt_en: allocate memory on the right NUMA node Jakub Kicinski
2026-11-20 3:52 ` [PATCH net-next v2 1/7] eth: bnxt_en: order event data before setting the sp_event bit Jakub Kicinski
2026-11-22 20:20 ` Björn Töpel
2026-11-20 3:52 ` [PATCH net-next v2 2/7] eth: bnxt_en: follow explicitly set IRQ affinity when placing page pool Jakub Kicinski
2026-11-23 3:52 ` netdev-bot+sashiko [this message]
2026-11-20 3:52 ` [PATCH net-next v2 3/7] eth: bnxt_en: allocate per-queue SW state on the queue's NUMA node Jakub Kicinski
2026-11-20 3:52 ` [PATCH net-next v2 4/7] eth: bnxt_en: explicitly keep device-only memory on the device's node Jakub Kicinski
2026-11-20 3:52 ` [PATCH net-next v2 5/7] eth: bnxt_en: allocate fast path DMA rings on the queue's NUMA node Jakub Kicinski
2026-11-20 3:52 ` [PATCH net-next v2 6/7] eth: bnxt_en: add a local bp variable in the IRQ affinity notifier Jakub Kicinski
2026-11-20 3:52 ` [PATCH net-next v2 7/7] eth: bnxt_en: restart Rx queues when their IRQ moves to another NUMA node Jakub Kicinski
2026-11-21 2:18 ` Michael Chan
2026-11-23 3:52 ` netdev-bot+sashiko
2026-11-21 2:20 ` [PATCH net-next v2 0/7] eth: bnxt_en: allocate memory on the right " Michael Chan
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=179540597280.3135.6843062872659992639@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bjorn@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joe@dama.to \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
/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