From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131386; b=gsiJslL4dgfd/nsaNzKagmJ2pvDAKl5lKS4vXCSz38p0r24tAsGwkDq7FYFXiMDcDbst 3SWElwOHaoen3xhBR6J7PKW3It1fbAYDJkyU0jmAeLFNSJGkbAxHeXHZWU99POGa7BcOE kOIBjs6VeM5GhRzVOk0YmfAmYPiN24UoLLFVrlHTk+d1NDlX+Nj4BfP6Phw3GrWYdhR22 JOH1xv/l2TlRWZMVhQHVurB3LX2y8icBEVvzeADFjVBmFel7J5LntmFxYgIr3H2iLpB5F FacDkemOBJN8IMcgpj0If2BE4QaOj7swskD4Z6sfmsAgNS/gXEqeYyJC6O5Y5LqiAMw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131386; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=jhWOHZ8VD69mvMZBRt1wsYMx1PhOem8TlAbcV3/L9vg=; b=QjtuOCyaGvX4y3g9cVXuR62Y0iaYscbx5haGsrvnYuw5e/QOcnLtHWLf+C43LXWyHnf/ sUSYYJDVPDqKwFyaRR3AM5/87LNNMnsDqx1UxZHsEzMJRzNPYt33tXHuyo3j/IDyGEUgE NjsFwGnuBQexTht7NTHXW7l6cbLZLoiaUiTkSVgihXRP7gSqYzRj0a2TRe4J0M0s2/PvR UneTIWaxmznp2zo08EYvqpkhuZh5OOkWSJbQnceKZH1pea8Yj/apIirz/z5kvrbHG+0GL oOmXo9jX5RleP30zgPgTn/1a1LdC2rKwhmgaIMA/F4BX7lvY7I7ZRHknDiuRNHAnvCg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X63Kq9qa; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D43D606A32C; Tue, 1 Dec 2026 13:23:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X63Kq9qa Received: by smtp.kernel.org (Postfix) with ESMTPSA id C320F1F0089C; Tue, 1 Dec 2026 13:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796131386; bh=jhWOHZ8VD69mvMZBRt1wsYMx1PhOem8TlAbcV3/L9vg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=X63Kq9qabUeatqNG7XG0yLakOSATn959dTQVOaiHog9AekIrlTpTlWuYrWYAkn2IO djzfvO9JyNed5ZLGIVi2YMedX/2gv8lODSaNMRamoWc+D7gU07gZECpsJ6YzQbsCNM dM7VqeX+Uz5+3Qju+ucN9nJITU6bcOeih1zt64h57MW3iRSUjOptT7Qwjw7Kb5siSQ qC9n2fgWzFQMayCSNeJHaPa5ZiPPVdfvgl1HF0HsasJe4CIjkBMiYmYIWOLmwt3km7 HrCOUDoU15LavFFeHon7oeEmLg6kyjYJzEET7k9VR+PBdJLhuIomwgzdoLQbyqmhlI QZsAetqqhNB3w== Subject: Re: [PATCH net v6 3/4] ice: resync uplink filters after a switchdev session 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 Date: Tue, 01 Dec 2026 13:23:04 +0000 Message-ID: <179613138433.3146.6653712043000778587@kernel.org> In-Reply-To: <20261130132107.1177185-4-poros@redhat.com> References: <20261130132107.1177185-4-poros@redhat.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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