From: netdev-bot+sashiko@kernel.org
To: cldlss@gmail.com
Cc: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net] iavf: restore queues after failed VF reset
Date: Fri, 04 Dec 2026 08:47:08 +0000 [thread overview]
Message-ID: <179637402858.3146.6755658258482535238@kernel.org> (raw)
In-Reply-To: <20261203083936.79920-1-cldlss@gmail.com>
Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.
Critical: 0 · High: 0 (1) · Medium: 5 · Low: 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 patch replays the uc/mc addresses that iavf_disable_vf()
discards, but not the VLAN filters it frees in the same block.
- [Medium] If iavf_start_queues() fails when called from
iavf_finish_config(), the error is only logged with netdev_err() and…
- [Medium] iavf_disable_vf() now calls
netif_addr_lock_bh(adapter->netdev) and walks dev->uc/dev->mc whether…
- [Medium] On resume, the new queue restart can be skipped and never
retried.
- [Medium] iavf: iavf_add_filter() can miss re-arming MAC filter AQ after
VF recovery
- [Low] The commit message misdescribes the history it cites.
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but
iavf_clear_mac_filters(), called from iavf_down(), runs…
--
iavf: restore queues after failed VF reset
This patch moves the queue start sequence out of iavf_open() into a new
iavf_start_queues(). iavf_finish_config() now calls it when a registered
netdev is still IFF_UP but the adapter is in __IAVF_DOWN after a failed
reset. The patch also clears the uc/mc sync state in iavf_disable_vf() so
the addresses can be replayed, and iavf_reset_step() reschedules
finish_config when the netdev is running.
> The 2023 revert removed dev_close() from reset failures while retaining
> the removal of direct IFF_UP updates. Reopening the preserved interface
> after successful reinitialization restores the missing recovery step.
[Severity: Low]
Is this description of the history accurate?
Commit 08f1c147b726 removed the direct IFF_UP clear from iavf_disable_vf()
and added dev_close() on both reset failure paths. The revert d916d273041b
then removed those dev_close() calls and kept the removal of the IFF_UP
update.
So the revert dropped a close. That close cleared IFF_UP and left it to
the administrator to bring the interface up again. As far as I can tell,
the driver never restarted the data path by itself after a VF disabled
event.
Would it be more accurate to call the automatic restart new recovery
behaviour, rather than a missing step being restored? The Fixes tag itself
looks reasonable, since d916d273041b is where IFF_UP started to persist
without queues.
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index 4de3ea8525b3f..c235c408f0a5b 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
[ ... ]
> @@ -2027,33 +2030,44 @@ static void iavf_finish_config(struct work_struct *work)
[ ... ]
> + } else if ((netdev->flags & IFF_UP) && netif_device_present(netdev) &&
> + !(adapter->flags & (IAVF_FLAG_PF_COMMS_FAILED |
> + IAVF_FLAG_RESET_PENDING |
> + IAVF_FLAG_RESET_NEEDED)) &&
> + !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
[Severity: Medium]
Can this restart be skipped on resume and then never retried?
iavf_resume() queues the reset task before it marks the device present:
iavf_resume() {
...
queue_work(adapter->wq, &adapter->reset_task);
netif_device_attach(adapter->netdev);
...
}
netif_device_attach() takes neither RTNL nor the netdev lock.
Suppose the VF was suspended with the adapter in __IAVF_DOWN and the
netdev IFF_UP. On resume, iavf_reset_step() takes the !running branch, and
the new iavf_schedule_finish_config() call queues finish_config.
If iavf_finish_config() gets the locks before the resume thread reaches
netif_device_attach(), netif_device_present() is false here. In that case
iavf_start_queues() is skipped without any message.
Nothing requeues finish_config after the attach. Would the interface then
stay up with no data queues?
> + /* The netdev kept IFF_UP while the VF was down. */
> + adapter->flags |= IAVF_FLAG_QUEUES_DISABLED;
> + err = iavf_start_queues(adapter);
> + if (err)
> + netdev_err(netdev, "Failed to restart queues after VF reinitialization: %d\n",
> + err);
> }
[Severity: Medium]
What happens if iavf_start_queues() fails here?
It can fail in iavf_setup_all_tx_resources(),
iavf_setup_all_rx_resources() or iavf_request_traffic_irqs(). The unwind
frees the traffic IRQs and the Tx/Rx rings, and the adapter stays in
__IAVF_DOWN. IFF_UP and __LINK_STATE_START stay set, because nothing calls
dev_close().
Nothing tries again after that:
- finish_config is not requeued.
- No reset is scheduled.
- The watchdog does not restart queues in __IAVF_DOWN.
Doesn't that leave the interface up with no traffic until a manual
down/up, which is the state this patch is trying to fix?
The running branch in iavf_reset_step() handles the same allocation
failures by going to reset_err and iavf_disable_vf(), which leads to
another watchdog reinit. Should this path have a similar retry?
[ ... ]
> @@ -3068,7 +3082,11 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
> iavf_free_all_rx_resources(adapter);
> }
>
> + /* Startup must be able to replay addresses whose VF filters are lost. */
> + netif_addr_lock_bh(adapter->netdev);
[Severity: Medium]
Can this take addr_list_lock before it has been initialized?
dev->addr_list_lock is only initialized in register_netdevice():
register_netdevice() {
...
spin_lock_init(&dev->addr_list_lock);
netdev_set_addr_lockdep_class(dev);
...
}
iavf_disable_vf() can run before the netdev is registered.
During first probe, iavf_poll_virtchnl_msg() can schedule reset_task on
VIRTCHNL_EVENT_RESET_IMPENDING. iavf_reset_step() then calls
iavf_disable_vf() on the "Reset never finished" path, before the
early-restart check:
iavf_reset_step() {
...
if (i == IAVF_RESET_WAIT_COMPLETE_COUNT) {
dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n", reg_val);
iavf_disable_vf(adapter);
return;
}
continue_reset:
/* If we are still early in the state machine, just restart. */
if (adapter->state <= __IAVF_INIT_FAILED) {
...
}
A reset can also reach reset_err after iavf_init_config_adapter() sets
__IAVF_DOWN but before iavf_finish_config() calls register_netdevice().
That path ends up here too.
With CONFIG_DEBUG_SPINLOCK this reports a spinlock with bad magic. With
lockdep it reports "trying to register non-static key".
Should the address lock and the unsync be skipped when netdev->reg_state
is not NETREG_REGISTERED?
> spin_lock_bh(&adapter->mac_vlan_list_lock);
> + __dev_uc_unsync(adapter->netdev, NULL);
> + __dev_mc_unsync(adapter->netdev, NULL);
[Severity: Medium]
Can the uc/mc addresses that are unsynced here get stuck on
adapter->mac_filter_list without ever being sent to the PF?
After iavf_disable_vf() the netdev keeps IFF_UP and stays present, so
the core rx mode path (netif_rx_mode_run()) can still call
iavf_set_rx_mode() while the watchdog sits in __IAVF_COMM_FAILED.
iavf_set_rx_mode() has no IAVF_FLAG_PF_COMMS_FAILED or state check.
Because the entries in netdev->uc and netdev->mc now have sync_cnt of
0, __hw_addr_sync_dev() calls iavf_addr_sync()->iavf_add_filter() for
each of them. They land on mac_filter_list with f->add set,
IAVF_FLAG_AQ_ADD_MAC_FILTER is set, and the core lists are marked
synced again.
The next watchdog tick in __IAVF_COMM_FAILED then does:
adapter->aq_required = 0;
adapter->current_op = VIRTCHNL_OP_UNKNOWN;
This drops IAVF_FLAG_AQ_ADD_MAC_FILTER but leaves the entries pending
on the list. The polled init states up to __IAVF_INIT_CONFIG_ADAPTER do
not set the flag again.
When iavf_finish_config() later calls iavf_start_queues(), the
iavf_add_filter() call for adapter->hw.mac.addr only re-arms the flag
when it creates a new entry. If hw.mac.addr was already pulled in from
netdev->uc, it takes the existing-entry branch:
} else {
f->remove = false;
}
A bridge static FDB, a macsec upper device or PACKET_MR_UNICAST can
put dev_addr into netdev->uc, and iavf_addr_unsync() already
special-cases that.
iavf_configure()->iavf_set_rx_mode() is then a no-op because every
address is already synced, and iavf_up_complete() moves the adapter to
__IAVF_RUNNING with the flag still clear. iavf_add_ether_addrs() is
never called, so the multicast filters, including the IPv6
solicited-node groups needed for neighbour discovery, and any secondary
unicast filters are never programmed on the PF. Traffic for them is
dropped until an unrelated address change sets the flag again or the
interface is cycled down and up.
Before this patch the core lists stayed synced across
iavf_disable_vf(), so only addresses added in that window could hit
this.
Should iavf_add_filter() set IAVF_FLAG_AQ_ADD_MAC_FILTER whenever the
existing entry still has f->add set? Or should iavf_set_rx_mode() avoid
syncing while IAVF_FLAG_PF_COMMS_FAILED is set, so the replay happens
from iavf_start_queues() as intended?
[Severity: High]
This isn't a bug introduced by this patch, but there is a related
locking problem. This hunk takes netif_addr_lock_bh() around
__dev_uc_unsync() and __dev_mc_unsync(). iavf_clear_mac_filters(), called
from iavf_down(), does the same unsync with only mac_vlan_list_lock held:
iavf_clear_mac_filters() {
spin_lock_bh(&adapter->mac_vlan_list_lock);
/* clear the sync flag on all filters */
__dev_uc_unsync(adapter->netdev, NULL);
__dev_mc_unsync(adapter->netdev, NULL);
...
}
Some writers of the address lists hold only addr_list_lock and not RTNL.
One example is this path, reachable by an unprivileged
IPV6_ADD_MEMBERSHIP:
__ipv6_sock_mc_join()->__ipv6_dev_mc_inc()->igmp6_group_added()->
dev_mc_add()
Upper devices can also call dev_uc_sync() or dev_mc_sync() on iavf with
only its address lock held.
Can __hw_addr_unsync_dev() from iavf_down() race with these writers? The
race would be on the netdev_hw_addr list and rbtree, and on the
non-atomic sync_cnt and refcount updates.
Should iavf_clear_mac_filters() also take netif_addr_lock_bh(), like the
new code here?
>
> /* Delete all of the filters */
> list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
> @@ -3083,6 +3101,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
> adapter->num_vlan_filters = 0;
>
> spin_unlock_bh(&adapter->mac_vlan_list_lock);
> + netif_addr_unlock_bh(adapter->netdev);
[Severity: Medium]
The uc/mc addresses are now unsynced so that iavf_configure()->
iavf_set_rx_mode() can replay them. What restores the VLAN filters that
are freed in the same locked section?
iavf_disable_vf() frees every entry on adapter->vlan_filter_list and sets
num_vlan_filters to 0.
In iavf_virtchnl_completion(), the VLAN replay for
VIRTCHNL_OP_GET_VF_RESOURCES and VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS only
re-marks entries that are already on that list:
if (!list_empty(&adapter->vlan_filter_list)) {
/* re-add all VLAN filters over virtchnl */
Only iavf_add_vlan() creates new entries, and it is reached only from
ndo_vlan_rx_add_vid(). The stack won't call that again for VIDs it already
considers installed.
netdev_update_features() in iavf_finish_config() doesn't push them either,
because NETIF_F_HW_VLAN_CTAG_FILTER doesn't toggle.
Cloud filters on adapter->cloud_filter_list are freed the same way, while
tc still holds them.
After the automatic restart in iavf_finish_config(), the primary MAC, the
uc/mc addresses and the FDIR filters are restored. Would VLAN
sub-interfaces and ADq filters be left with no matching VF filters?
On a PF that enforces VLAN pruning, VLAN traffic would be dropped. On
i40e, the forgotten VIDs would start being dropped once any new VLAN is
added.
Freeing the VLAN list predates this patch, and a manual down/up never
restored it either. The commit message does say that reinitialization can
replay the filters that were discarded.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203083936.79920-1-cldlss%40gmail.com
prev parent reply other threads:[~2026-12-04 8:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 8:39 [PATCH net] iavf: restore queues after failed VF reset Alexander Lopintsev
2026-12-04 8:47 ` 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=179637402858.3146.6755658258482535238@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=cldlss@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.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