From: netdev-bot+sashiko@kernel.org
To: poros@redhat.com
Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, aleksandr.loktionov@intel.com,
horms@kernel.org, michal.swiatkowski@linux.intel.com,
grzegorz.nitka@intel.com, pmenzel@molgen.mpg.de,
wojciech.drewek@intel.com, marcin.szycik@linux.intel.com,
martyna.szapar-mudlaw@linux.intel.com, ivecera@redhat.com,
alice.michael@intel.com, jacob.e.keller@intel.com,
jbrandeb@kernel.org, patryk.holda@intel.com,
sx.rinitha@intel.com, aaron.ma@canonical.com,
intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v6 3/4] ice: resync uplink filters after a switchdev session
Date: Tue, 01 Dec 2026 13:23:04 +0000 [thread overview]
Message-ID: <179613138433.3146.6653712043000778587@kernel.org> (raw)
In-Reply-To: <20261130132107.1177185-4-poros@redhat.com>
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
next prev parent reply other threads:[~2026-12-01 13:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:21 [PATCH net v6 0/4] ice: fix DFLT Rx rule handling for promisc and switchdev Petr Oros
2026-11-30 13:21 ` [PATCH net v6 1/4] ice: stop the service task before the PF is unloaded Petr Oros
2026-12-01 13:23 ` netdev-bot+sashiko
2026-11-30 13:21 ` [PATCH net v6 2/4] ice: do not leave switchdev mode while subfunction ports exist Petr Oros
2026-11-30 13:21 ` [PATCH net v6 3/4] ice: resync uplink filters after a switchdev session Petr Oros
2026-12-01 13:23 ` netdev-bot+sashiko [this message]
2026-11-30 13:21 ` [PATCH net v6 4/4] ice: use a VLAN agnostic multicast promisc rule pair for PF VSIs Petr Oros
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=179613138433.3146.6653712043000778587@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aaron.ma@canonical.com \
--cc=aleksandr.loktionov@intel.com \
--cc=alice.michael@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=grzegorz.nitka@intel.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=ivecera@redhat.com \
--cc=jacob.e.keller@intel.com \
--cc=jbrandeb@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.szycik@linux.intel.com \
--cc=martyna.szapar-mudlaw@linux.intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=patryk.holda@intel.com \
--cc=pmenzel@molgen.mpg.de \
--cc=poros@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sx.rinitha@intel.com \
--cc=wojciech.drewek@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
all inboxes | Powered by JetHome®