From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 894D0606A683 for ; Tue, 1 Dec 2026 13:23:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=S7hD5pOI; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X63Kq9qa Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 64E9C8065B; Tue, 1 Dec 2026 13:23:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id g7xHsEiDeJaO; Tue, 1 Dec 2026 13:23:11 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 7E29680663 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796131391; b=FX9WkJyTR2wSaruFDzBrh61shj4fvhyU1I6PXC95rgBkc4NwVxDh1KU8+ub6m5wBCn72 cxSuhbsFMNsGYwL2RltJxh9cN/LElPO19J5GjC1NIaUqq1unfobZi5saTVfCmVJhtHhvL ZRMKKqMa7vLC/lA2sU2cZAeYZQ+yEjnG3raqGAO27ELlRwgBjJh8hZ7QzYiYnMnJ5bkZa sMJaBcxl1L2LlUvOfADgorlpaSr/O/0hsh+PhaXBWYLDiXgHY56OpOCuThbByBYFz022I qgKet3DUYAzDNp3A2Jagp1rcg73flbFvGXb7RPK9SYjk/MsHFWMZgPS76nnB3u3v1MQ== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796131391; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version:X-BeenThere:X-Mailman-Version: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=jhWOHZ8VD69mvMZBRt1wsYMx1PhOem8TlAbcV3/L9vg=; b=HH05RuIccT46N3KeX6m8gwly+m8shtT+yBqh9U1VU2LTn1M9MFDxPPTmDoVgYv/LtrEz E+kFjz5IeN6eaqffo/o0gHsW49BDT9ZlI/oSOI92qIB48sbydX4fo1OhFaHybIlIkxHUy ki8eQAyKw6J5nfVObmITEuP6Ryea2WoKySE00rcSp0fq9CGVuvnZRp0t7USobTijy5Iv/ XTLdcP9Ps5zHI6LT/CdOupJHwvhNCjP+aQs4SWFVb69jdnhCOLQaS4Y+t8UgG5E3qjrUQ zwribO6/a03OqU/bDWOLjYM5vIYdylrXDQkTwoYaaje8wD++cwMd/Se8a/N+6fxlelA== ARC-Authentication-Results: i=1; smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796131391; bh=jhWOHZ8VD69mvMZBRt1wsYMx1PhOem8TlAbcV3/L9vg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=S7hD5pOIZC+o33+X34sAy0Vp8X7xdxoSZnYwB0JdudCTZlm3DaNdBrdnc3NOjvjJ+ yNpiOt57/mfhoF7WgWglHKTSse/mZkJWXq1Of2P8xQ4f+XsLzvDlq+5gaEIAznAgHk EavPcTHbeO5k/HhvieGRfCCHsocVwacobIsJ+I2xPc9JdePPOQbvbq7Cle79w9oa4f WQAI+3S4/nV8dAI0bmLcYYSWKR5gDUrntMIhhqZNo0AOiGZ0KflOSsPX+hLOkbRai/ 0mf45u470owvIISiaX0mhiki9GY8S2T7Md1qc2h23t1hoE3FZclbS0nO+i1bAqe805 jPmspRVJGVvgQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 7E29680663; Tue, 1 Dec 2026 13:23:11 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id 36FD8472 for ; Tue, 1 Dec 2026 13:23:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 1CE2F40600 for ; Tue, 1 Dec 2026 13:23:09 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id BPgUe9qgIyGl for ; Tue, 1 Dec 2026 13:23:08 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org 0C61340603 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=netdev-bot+sashiko@kernel.org; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X63Kq9qa Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0C61340603 for ; Tue, 1 Dec 2026 13:23:07 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5D10641909; Tue, 1 Dec 2026 13:23:06 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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