Netdev List
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH net-next 6/6] eth: bnxt_en: restart Rx queues when their IRQ moves to another NUMA node
Date: Thu, 19 Nov 2026 03:21:52 +0000	[thread overview]
Message-ID: <179505851274.3136.4469982545223123709@kernel.org> (raw)
In-Reply-To: <20261118023905.3050661-7-kuba@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 2 · Medium: 1 · Low: 0

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).

- [High] The new error handling in bnxt_irq_affinity_update() cannot
  work, and the path it targets oopses.
- [High] bnxt_irq_affinity_update() takes only the netdev instance lock,
  via bnxt_lock_sp() (not bnxt_rtnl_lock_sp()), before calling…
- [Medium] The code restarts more queues than the commit message and the
  new function comment describe ('Restart the Rx queues whose IRQ…

--

eth: bnxt_en: restart Rx queues when their IRQ moves to another NUMA node

This patch schedules the IRQ affinity update work on every device that
supports the queue API, instead of only when the TPH Steering Tag changes.
The work restarts an Rx queue when its page pool's nid differs from the
node of the CPU servicing the IRQ. After a failed restart it checks that
the device is still open.

> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 134b24842c4f2..5f4a8db1f8b58 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c

[ ... ]

> @@ -14663,7 +14662,10 @@ static void bnxt_rtnl_unlock_sp(struct bnxt *bp)
>  	rtnl_unlock();
>  }
>  
> -static void bnxt_tph_update(struct bnxt *bp)
> +/* Restart the Rx queues whose IRQ moved, if the move changed the TPH
> + * Steering Tag or the node the queue memory should be allocated on.
> + */
> +static void bnxt_irq_affinity_update(struct bnxt *bp)
>  {
>  	struct net_device *dev = bp->dev;
>  	int i;

[ ... ]

> @@ -14680,20 +14684,26 @@ static void bnxt_tph_update(struct bnxt *bp)
>  		map_idx = bnxt_cp_num_to_irq_num(bp, i);
>  		irq = &bp->irq_tbl[map_idx];
>  		tag = READ_ONCE(irq->new_tag);
> -		if (irq->tag == tag)
> -			continue;
> -
> -		if (pcie_tph_set_st_entry(bp->pdev, irq->msix_nr, tag))
> +		if (irq->tag != tag &&
> +		    !pcie_tph_set_st_entry(bp->pdev, irq->msix_nr, tag))
> +			new_tag = true;
> +		if (rxr->page_pool->p.nid != bnxt_cp_num_to_node(bp, i))
> +			new_node = true;

[Severity: Medium]
The new function comment says only "Rx queues whose IRQ moved" are
restarted. Is that what this loop does?

An affinity notification for any one Rx IRQ queues
BNXT_IRQ_AFFINITY_SP_EVENT. This loop then compares every ring's
page_pool nid against bnxt_cp_num_to_node(bp, i), whether or not that
ring's IRQ moved.

For rings whose affinity was never set, bnxt_request_irq() leaves
ring_nid[i] as NUMA_NO_NODE. bnxt_cp_num_to_node() then falls back to:

	cpu = cpumask_local_spread(n, dev_to_node(&bp->pdev->dev));
	return cpu_to_node(cpu);

That result depends on cpu_online_mask at the time of the call.

After CPU hotplug (for example SMT disable or offlining CPUs), can this
fallback pick a different node from the one used at open? If so, moving
one unrelated IRQ would restart these other queues and move their memory
to the new default-spread node.

The comment in bnxt_request_irq() says this placement is "just a hint",
so the new node may not match where the IRQ actually runs.

> +		if (!new_tag && !new_node)
>  			continue;
>  
> -		err = netdev_rx_queue_restart(dev, irq->ring_nr);
> +		err = netdev_rx_queue_restart(dev, i);
>  		if (err) {
>  			netdev_err(dev, "RX queue restart failed: err=%d\n",
>  				   err);
> +			/* Failing to start a new queue may close the device */
> +			if (!test_bit(BNXT_STATE_OPEN, &bp->state))
> +				break;

[Severity: High]
If the restart fails because the device was closed, can this check ever
be reached? Here is the sequence I'm looking at:

bnxt_irq_affinity_update()
  netdev_rx_queue_restart(dev, i)
    netdev_rx_queue_reconfig()
      ndo_queue_stop(old_mem)        /* succeeds */
      bnxt_queue_start(new_mem)
        /* clone page_pool, rings and rx_tpa moved into bp->rx_ring[idx] */
        bnxt_hwrm_rx_ring_alloc() fails -> err_reset
        netif_close(dev)
          bnxt_close()->bnxt_close_nic()->__bnxt_close_nic()
            bnxt_free_mem(bp, true)
              kfree(bp->rx_ring);
              bp->rx_ring = NULL;
      err_start_queue:
      bnxt_queue_start(old_mem)
        rxr = &bp->rx_ring[idx];
        rxr->rx_prod = clone->rx_prod;   /* bp->rx_ring is NULL */

Wouldn't this hit a NULL pointer dereference in the sp workqueue while
netdev_lock is held, before control returns to this check?

If that step were survived, err_free_new_queue_mem would call
ndo_queue_mem_free(dev, new_mem). That runs page_pool_destroy() and
bnxt_free_ring() a second time on resources bnxt_free_mem() already
released.

The commit message says "check that the device is still up after
errors", which relies on this path returning normally.

Before this patch the path ran only on TPH Steering Tag changes.
bnxt_irq_affinity_notify() now queues the work on every queue-API PF,
and any cross-node Rx IRQ move restarts a queue. irqbalance or a write
to /proc/irq/N/smp_affinity is enough to trigger it. An HWRM failure
during queue start is the only other precondition.

[Severity: High]
bnxt_irq_affinity_update() starts with bnxt_lock_sp(bp). That only takes
netdev_lock(bp->dev), not RTNL.

The new comment expects this restart to close the device. The close
happens via bnxt_queue_start() err_reset -> netif_close(dev) ->
netif_close_many() -> __dev_close_many(), which begins with:

	ASSERT_RTNL();
	might_sleep();

It then calls the NETDEV_GOING_DOWN notifiers, dev_deactivate_many(),
rtmsg_ifinfo() and the NETDEV_DOWN notifiers.

Doesn't all of that run without RTNL here? That would trigger the
assertion and race with other RTNL holders.

Would bnxt_rtnl_lock_sp()/bnxt_rtnl_unlock_sp() be more appropriate,
as bnxt_reset() uses?

The old bnxt_tph_update() used the same helper, but it only ran on TPH
tag changes. With this patch the path runs for any cross-node IRQ move
on a queue-API PF. In the same failure, the core rollback then hits the
NULL bp->rx_ring dereference described above.

>  			continue;
>  		}
>  
> -		irq->tag = tag;
> +		if (new_tag)
> +			irq->tag = tag;
>  	}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118023905.3050661-1-kuba%40kernel.org

      parent reply	other threads:[~2026-11-19  3:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  2:38 [PATCH net-next 0/6] eth: bnxt_en: allocate memory on the right NUMA node Jakub Kicinski
2026-11-18  2:39 ` [PATCH net-next 1/6] eth: bnxt_en: order event data before setting the sp_event bit Jakub Kicinski
2026-11-18 12:27   ` Björn Töpel
2026-11-19  3:21   ` netdev-bot+sashiko
2026-11-18  2:39 ` [PATCH net-next 2/6] eth: bnxt_en: follow explicitly set IRQ affinity when placing page pool Jakub Kicinski
2026-11-18 12:32   ` Björn Töpel
2026-11-18 14:42   ` Joe Damato
2026-11-19  3:21   ` netdev-bot+sashiko
2026-11-18  2:39 ` [PATCH net-next 3/6] eth: bnxt_en: allocate per-queue SW state on the queue's NUMA node Jakub Kicinski
2026-11-18 12:37   ` Björn Töpel
2026-11-18 14:49   ` Joe Damato
2026-11-18  2:39 ` [PATCH net-next 4/6] eth: bnxt_en: explicitly keep device-only memory on the device's node Jakub Kicinski
2026-11-18 12:38   ` Björn Töpel
2026-11-18 14:50   ` Joe Damato
2026-11-18  2:39 ` [PATCH net-next 5/6] eth: bnxt_en: allocate fast path DMA rings on the queue's NUMA node Jakub Kicinski
2026-11-18 12:39   ` Björn Töpel
2026-11-18 14:51   ` Joe Damato
2026-11-18  2:39 ` [PATCH net-next 6/6] eth: bnxt_en: restart Rx queues when their IRQ moves to another " Jakub Kicinski
2026-11-18 12:50   ` Björn Töpel
2026-11-18 15:01   ` Joe Damato
2026-11-19  1:24   ` Michael Chan
2026-11-19  3:21   ` netdev-bot+sashiko [this message]

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=179505851274.3136.4469982545223123709@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --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