Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Tue, 01 Dec 2026 13:23
Re: [PATCH net v6 3/4] ice: resync uplink filters after a switchdev session
Author: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 13:23
Date: Tue, 01 Dec 2026 13:23
137 lines
13345 bytes
13345 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · 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 adds two new open-coded locks that poll a bit flag:
`while (test_and_set_bit(ICE_CFG_BUSY, uplink_vsi->state))…
- [Low] The patch adds a lockless store-buffering protocol on
pf->eswitch.is_running.
--
ice: resync uplink filters after a switchdev session
This patch hands the uplink promisc configuration to the eswitch for the
length of a switchdev session, using a new ICE_VSI_ESWITCH_UPLINK bit.
When the session ends, the new ice_eswitch_resync_uplink() hands it back
and queues a full filter sync. The patch also adds a full barrier before
the is_running test in ice_set_rx_mode(), subscribes a promiscuous DFLT
VSI to multicast, and enables VLAN pruning on every promisc off.
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> index 44ef1fcfc6e4a..e14fc60b6de3c 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);
> +
> + /* VLAN changes during the session may have added these */
> + ice_fltr_clear_vlan_vsi_promisc(&pf->hw, uplink_vsi,
> + ICE_MCAST_VLAN_PROMISC_BITS);
> + ice_fltr_clear_vsi_promisc(&pf->hw, uplink_vsi->idx,
> + ICE_MCAST_PROMISC_BITS, 0);
> + uplink_vsi->current_netdev_flags &= ~IFF_ALLMULTI;
> +
> + 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);
[Severity: Medium]
This builds a sleeping lock by polling ICE_CFG_BUSY, and
ice_eswitch_setup_env() gets the same loop. The new handoff of the
uplink promisc config relies on that flag behaving like a mutex for:
- setting and clearing ICE_VSI_ESWITCH_UPLINK
- dropping or re-arming the UMAC/MMAC/PROMISC_CHANGED bits
- keeping the eswitch out while ice_vsi_sync_fltr() is in its promisc
section
Could this be a real mutex in struct ice_vsi instead? Lockdep cannot see
the flag. Also, every CFG_BUSY user here runs in process context and
already sleeps in the loop.
The two sides also release the flag differently. The new code uses
clear_bit_unlock(), but ice_vsi_sync_fltr(), the other holder, uses a
relaxed clear_bit():
drivers/net/ethernet/intel/ice/ice_main.c:ice_vsi_sync_fltr() {
...
exit:
clear_bit(ICE_CFG_BUSY, vsi->state);
return err;
}
On weakly ordered architectures, is anything ordering the plain stores
that ice_vsi_sync_fltr() makes inside the section (vsi->current_netdev_flags,
for example) before that release?
The current_netdev_flags &= ~IFF_ALLMULTI read-modify-write above could
race with those stores. A later patch in the series, "ice: use a VLAN
agnostic multicast promisc rule pair for PF VSIs", removes it, so no
concrete lost update is left at the end of the series. This patch still
adds the pattern itself.
> +
> + set_bit(ICE_FLAG_FLTR_SYNC, pf->flags);
> + ice_service_task_schedule(pf);
> +}
[ ... ]
> @@ -331,6 +371,11 @@ static void ice_eswitch_disable_switchdev(struct ice_pf *pf)
> ice_eswitch_release_env(pf);
>
> pf->eswitch.is_running = false;
> +
> + /* after is_running is cleared, so no rx mode change is lost, its
> + * test_and_set_bit() pairs with smp_mb() in ice_set_rx_mode()
> + */
> + ice_eswitch_resync_uplink(pf->eswitch.uplink_vsi);
> }
[Severity: Low]
With this patch, the is_running store takes part in a lockless barrier
pairing with ice_set_rx_mode():
smp_mb();
if (ice_is_switchdev_running(vsi->back))
return;
ice_is_switchdev_running() is a plain load:
return pf->eswitch.is_running;
The store in ice_eswitch_enable_switchdev() is plain as well.
Should these accesses use READ_ONCE()/WRITE_ONCE()? ice_set_rx_mode()
and ice_eswitch_disable_switchdev() can run at the same time with no
common lock. As written, KCSAN would report a data race on is_running.
Nothing stops the compiler from re-reading or fusing the load at other
callers either, such as the xmit path in ice_txrx.c.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130132107.1177185-1-poros%40redhat.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads