Re: [PATCH net v7 3/4] ice: resync uplink filters after a switchdev session
From: netdev-bot+sashiko
Date: Thu Dec 03 2026 - 03:02:22 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · 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).
- [Medium] The patch adds two new critical sections in
drivers/net/ethernet/intel/ice/ice_eswitch.c that use the ICE_CFG_BUSY…
--
ice: resync uplink filters after a switchdev session
This patch adds an ICE_VSI_ESWITCH_UPLINK bit so the eswitch owns the
uplink promisc configuration during a switchdev session. When the session
ends, it queues a full filter sync so the uplink is programmed again from
the netdev flags. It also adds a barrier in ice_set_rx_mode() and changes
how ice_vsi_sync_fltr() handles multicast promisc and VLAN pruning.
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> index 44ef1fcfc6e4a..e91f126bc8a67 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> @@ -10,6 +10,34 @@
> #include "devlink/devlink.h"
> #include "ice_tc_lib.h"
>
> +/**
> + * ice_eswitch_resync_uplink - hand the uplink filters back after switchdev
> + * @uplink_vsi: the uplink VSI
> + */
> +static void ice_eswitch_resync_uplink(struct ice_vsi *uplink_vsi)
> +{
> + struct ice_pf *pf = uplink_vsi->back;
> +
> + while (test_and_set_bit(ICE_CFG_BUSY, uplink_vsi->state))
> + usleep_range(1000, 2000);
> +
[ ... ]
> + clear_bit(ICE_VSI_ESWITCH_UPLINK, uplink_vsi->state);
> + set_bit(ICE_VSI_PROMISC_CHANGED, uplink_vsi->state);
> + set_bit(ICE_VSI_UMAC_FLTR_CHANGED, uplink_vsi->state);
> + set_bit(ICE_VSI_MMAC_FLTR_CHANGED, uplink_vsi->state);
> + clear_bit_unlock(ICE_CFG_BUSY, uplink_vsi->state);
> +
> + set_bit(ICE_FLAG_FLTR_SYNC, pf->flags);
> + ice_service_task_schedule(pf);
> +}
> +
> /**
> * ice_eswitch_setup_env - configure eswitch HW filters
> * @pf: pointer to PF struct
> @@ -28,6 +56,15 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
> if (ice_down(uplink_vsi))
> return -ENODEV;
>
> + /* the eswitch owns the uplink promisc config until the resync */
> + while (test_and_set_bit(ICE_CFG_BUSY, uplink_vsi->state))
> + usleep_range(1000, 2000);
> + set_bit(ICE_VSI_ESWITCH_UPLINK, uplink_vsi->state);
> + /* drop a pending sync, the address lists are unsynced below */
> + clear_bit(ICE_VSI_UMAC_FLTR_CHANGED, uplink_vsi->state);
> + clear_bit(ICE_VSI_MMAC_FLTR_CHANGED, uplink_vsi->state);
> + clear_bit_unlock(ICE_CFG_BUSY, uplink_vsi->state);
> +
[Severity: Medium]
Both new sections, in ice_eswitch_resync_uplink() and
ice_eswitch_setup_env(), use ICE_CFG_BUSY in uplink_vsi->state as a
sleeping lock. They take it with a test_and_set_bit()/usleep_range() poll
loop and drop it with clear_bit_unlock().
Could a real lock be used here instead of a hand-built bit lock?
The new ownership handoff depends entirely on this bit for mutual
exclusion. That covers publishing ICE_VSI_ESWITCH_UPLINK, dropping the
pending UMAC/MMAC syncs and the resync when the session ends. Lockdep
can't see the bit, it has no owner tracking or fairness, and the
acquire/release ordering has to be built by hand.
The ordering is already hard to keep consistent. This version had to
switch ice_vsi_sync_fltr() to clear_bit_unlock(), but other holders of the
same bit still release it with a plain clear_bit():
drivers/net/ethernet/intel/ice/ice_main.c:ice_vlan_rx_add_vid() {
...
finish:
clear_bit(ICE_CFG_BUSY, vsi->state);
...
}
ice_vlan_rx_kill_vid() does the same.
There doesn't appear to be a concrete deadlock among the current holders:
ice_vsi_sync_fltr() from the service task, the VLAN ndos under rtnl, and
the devlink path here. But lockdep would not catch a future lock ordering
problem in these sections.
Would a per-VSI mutex around the filter and promisc state give the same
exclusion, with proper acquire/release semantics? These sections are still
there in the last patch of the series.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202071642.2527605-1-poros%40redhat.com