From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, andrew+netdev@lunn.ch,
netdev@vger.kernel.org, luoxuanqiang@kylinos.cn,
mheib@redhat.com, fballuch@redhat.com,
aleksandr.loktionov@intel.com, richardcochran@gmail.com,
saikrishnag@marvell.com, stable@vger.kernel.org,
vadim.fedorenko@linux.dev, jacob.e.keller@intel.com,
rafal.romanowski@intel.com
Subject: Re: [PATCH net 1/6] i40e: fix napi_disable hang in i40e_down() during firmware update
Date: Tue, 17 Nov 2026 00:47:48 +0000 [thread overview]
Message-ID: <179487646854.3136.3461897028756425738@kernel.org> (raw)
In-Reply-To: <20261113004602.129864-2-anthony.l.nguyen@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 2 (1) · Medium: 0 · 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 fix is incomplete and the commit message gets the root cause
wrong.
- [High] The patch adds an unconditional set_bit(__I40E_VSI_DOWN) in
i40e_vsi_reinit_locked() and still ignores the return value of…
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but
i40e_vsi_reinit_locked() calls i40e_down() unconditionally, even when…
--
i40e: fix napi_disable hang in i40e_down() during firmware update
This patch sets __I40E_VSI_DOWN in i40e_vsi_reinit_locked() before it
calls i40e_down(). With the bit set, i40e_napi_poll() bails out and
napi_disable() can complete when the rings hold garbage during an NVM
update.
> i40e_down() expects its caller to set __I40E_VSI_DOWN before calling it,
> as noted in the comment at the top of the function. All callers do this
> except i40e_vsi_reinit_locked(), which calls i40e_down() directly
> without setting the flag.
[Severity: High]
Is this accurate? i40e_set_ringparam() in i40e_ethtool.c (the ethtool -G
path) also appears to call i40e_down() on a running interface without
setting the bit:
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:i40e_set_ringparam() {
...
/* Bring interface down, copy in the new ring info,
* then restore the interface
*/
i40e_down(vsi);
...
}
By then i40e_up_complete() has already cleared __I40E_VSI_DOWN, so this
bail-out in i40e_napi_poll() never fires:
if (test_bit(__I40E_VSI_DOWN, vsi->state)) {
napi_complete(napi);
return 0;
}
If the descriptors hold garbage, can this chain hang in the same way
while holding RTNL?
i40e_set_ringparam()->i40e_down()->i40e_napi_disable_all()->napi_disable()
The other callers already seem to set the bit:
- i40e_vsi_close()
- the DOWN_REQUESTED branch of i40e_do_reset()
- i40e_set_loopback()
- the err_up_complete path of i40e_vsi_open()
Two later patches in this series modify i40e_set_ringparam() but don't
add the set_bit():
- "i40e: fix freeing of TX rings on RX allocation failure"
- "i40e: avoid resetting BQL state when freeing temporary Tx rings in
set_ringparam"
Should i40e_set_ringparam() also call set_bit(__I40E_VSI_DOWN, vsi->state)
before i40e_down()? The later i40e_up()->i40e_up_complete() would clear it
again.
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index abbc71e815ae3..dd729776c64dd 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -7461,6 +7461,8 @@ static void i40e_vsi_reinit_locked(struct i40e_vsi *vsi)
>
> while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state))
> usleep_range(1000, 2000);
> + /* required by i40e_down() */
> + set_bit(__I40E_VSI_DOWN, vsi->state);
> i40e_down(vsi);
[Severity: High]
This is a pre-existing issue, but i40e_vsi_reinit_locked() calls
i40e_down() unconditionally. That includes the case where the VSI is
already down but the netdev is still netif_running(). Can napi_disable()
then run a second time on NAPI instances that are already disabled?
The first napi_disable_locked() leaves NAPIF_STATE_SCHED and
NAPIF_STATE_NPSVC set, and only napi_enable() clears them. A second call
would spin here forever:
net/core/dev.c:napi_disable_locked() {
...
do {
while (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
usleep_range(20, 200);
val = READ_ONCE(n->state);
}
...
}
It would do so while holding netdev_lock, and also RTNL in the MTU path.
One way to get here is a tx_timeout that escalates past level 3:
i40e_tx_timeout()
default:
set_bit(__I40E_DOWN_REQUESTED, pf->state);
set_bit(__I40E_VSI_DOWN_REQUESTED, vsi->state);
i40e_reset_subtask()
i40e_do_reset()
set_bit(__I40E_VSI_DOWN, vsi->state);
i40e_down(vsi); <- NAPI disabled, netdev still running
ip link set mtu ...
i40e_change_mtu()
if (netif_running(netdev))
i40e_vsi_reinit_locked(vsi);
i40e_down(vsi); <- second napi_disable()
A failed i40e_up() inside i40e_vsi_reinit_locked() also leaves NAPI
disabled, so the next MTU change would hit the same loop.
The new set_bit() has no effect in either case. i40e_vsi_close() and
i40e_set_loopback() use this pattern to avoid a second teardown:
if (!test_and_set_bit(__I40E_VSI_DOWN, vsi->state))
i40e_down(vsi);
Would that pattern work here as well? It should also prevent the hang
this patch targets.
>
> i40e_up(vsi);
[Severity: High]
What happens to the new __I40E_VSI_DOWN bit if i40e_up() fails here, for
example via i40e_change_mtu()->i40e_vsi_reinit_locked()? The return value
is ignored. i40e_up_complete() clears the bit only after the rings have
started:
drivers/net/ethernet/intel/i40e/i40e_main.c:i40e_up_complete() {
...
/* start rings */
err = i40e_vsi_start_rings(vsi);
if (err)
return err;
clear_bit(__I40E_VSI_DOWN, vsi->state);
i40e_napi_enable_all(vsi);
...
}
So the commit message's "i40e_up_complete() already clears the flag when
the VSI comes back up, so no additional cleanup is needed" seems to hold
only when bring-up succeeds.
i40e_vsi_start_rings() enables Rx before Tx. On -ETIMEDOUT it returns
without disabling the queues it already enabled.
If the Tx enable times out, every Rx queue could be live. Their
descriptors were already filled by i40e_vsi_configure_rx(). Meanwhile
__I40E_VSI_DOWN stays set and the netdev is still IFF_UP.
A later ndo_stop would then do:
i40e_vsi_close()
if (!test_and_set_bit(__I40E_VSI_DOWN, vsi->state))
i40e_down(vsi); <- skipped, i40e_vsi_stop_rings() never runs
i40e_vsi_free_irq(vsi);
i40e_vsi_free_tx_resources(vsi);
i40e_vsi_free_rx_resources(vsi);
Can i40e_free_rx_resources() then unmap the Rx pages and
dma_free_coherent() the descriptor ring while the hardware Rx queue is
still enabled and can DMA into that memory?
The stale bit also makes i40e_quiesce_vsi() return early without setting
__I40E_VSI_NEEDS_RESTART. A later PF reset, which is common after an NVM
update, would then not reopen the VSI, even though the netdev reports
IFF_UP.
Before this patch, the same failure led to a double napi_disable() hang
on close. i40e_down() still ran, so the rings were stopped first.
i40e_vsi_open() handles the same i40e_up_complete() failure with:
err_up_complete:
i40e_down(vsi);
Should i40e_vsi_reinit_locked() check the return value of i40e_up() and
clean up in a similar way?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113004602.129864-1-anthony.l.nguyen%40intel.com
parent reply other threads:[~2026-11-17 0:47 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20261113004602.129864-2-anthony.l.nguyen@intel.com>]
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=179487646854.3136.3461897028756425738@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fballuch@redhat.com \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=luoxuanqiang@kylinos.cn \
--cc=mheib@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafal.romanowski@intel.com \
--cc=richardcochran@gmail.com \
--cc=saikrishnag@marvell.com \
--cc=stable@vger.kernel.org \
--cc=vadim.fedorenko@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;
as well as URLs for NNTP newsgroup(s).