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=1796295439; b=vqM/w455VVP9gp+tj3mV8fKByr1IBHjjzKX7TKwTSSZmuUIWMuQPiM+VXUQHTguhguJZ DBhyKy7hHKOqCBU5ito/q4vugFcK8eAtU1SkGc2CHn+yzzC0b4NEasVbm+Jjn7IVM56Q9 sE+fJ5mWSqmf/kBr9UnmW3yjM9yPHXEPWS5rxJsNNAuG8hbZ1v+Hrlg4nB8Os025SBqOn sPm4SZ6vnxvEQzQHfsnrUULW1pKz8H5DPabTM7/3R4X7w5HKHQUMB+KhRqtKxU3iiOgXG muOASAjlu9zYcA3t+m+B8Pq64C4RVKVEzodYANdSwzYzx6ShZ21BKtwYXgX7BrRbaeg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796295439; 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=AnSimTw85NnVSl+82RTnLOvieIHfXH/feCjknrvlaPo=; b=TfxrjkoWiD2Ox4M5cC4Sp0U2sve7pby/ju5+fNC+kJO+NLkL48JZVHvQ7peMubOJ3WF9 ZskutqyDl4D+IT8sMGKOtp+4eSQvFD6+tkHGZkpaVMXIsjO5INoRruNmYQUgjJOH4RDBo gBTIyzSJODCUZhqM7P3+OK/y2JmlgQNMSQO16XWRX/3FA4fm5kscI8L9MRAp1xlmfbIyq ImL5vlTheBRXKQOi3wwvxhbvF9j/Rko7PbkLWt4j034TdjZdVerfGO5MACENl9+JkC4e+ 4v8TXAuwqzcSE7nq8hoakPOTO1xexXibwA07730sfPlD6IFsmWw5MmOrj+0gZ897c0g== 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=MgGqPdcm; 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 EA3D2606A332; Thu, 3 Dec 2026 10:57:18 +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=MgGqPdcm Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37FCA1F000C1; Thu, 3 Dec 2026 10:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796295438; bh=AnSimTw85NnVSl+82RTnLOvieIHfXH/feCjknrvlaPo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=MgGqPdcmTyglvCwLvYAWbPck1tS6GVG5Cb0xARSgElr2nFuoyJ5RhU5w87FW4nHGX gsv1KcI0qPXktF27mJ7MlvqT5lF4CY0MmOM+2vjac84Cg+ExcKk6OCOo/PYc/5g0Qr uVb3j7tm448sMHwJ7XyyTUsWHOE78ptHKhc5MVKLzL3fv/PT+XsbluNu69U+rDXrl6 QENmkfNXA2d6HqHGdBcCPry/r+0uw3U7QWL+3V3950ED4hGG0C5pFAF2lS3Mj9P53g 0bR914drDtaN1C9cHlLILeQnsd//ItvvlEJM6+mTD7MbPtGguDPYban9cHbN0+zOsZ e8MOvIt+LqRKQ== Subject: Re: [PATCH net v3 2/4] net: ethernet: ti: cpsw_ale: serialize ALE table accesses From: netdev-bot+sashiko@kernel.org To: manuel.janocha@amperfied.com Cc: s-vadapalli@ti.com, rogerq@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, vigneshr@ti.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org, kuniyu@google.com Date: Thu, 03 Dec 2026 10:57:17 +0000 Message-ID: <179629543778.3146.6031678129130928601@kernel.org> In-Reply-To: <20261202-cpsw-ale-lock-v3-2-b40dc361d6b9@amperfied.com> References: <20261202-cpsw-ale-lock-v3-2-b40dc361d6b9@amperfied.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@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 more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The comment this patch adds to struct cpsw_ale (drivers/net/ethernet/ti/cpsw_ale.h, lines 99-101) says ale->lock… -- net: ethernet: ti: cpsw_ale: serialize ALE table accesses This patch adds a spinlock to struct cpsw_ale. The lock is taken with spin_lock_bh() in all exported ALE functions that access the table through the shared index and data registers. With it, concurrent ndo_set_rx_mode() and VLAN or address operations on different ports can no longer interleave register accesses and corrupt table entries. [ ... ] > diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h > index 87b7d1b3a34a9..f72db771bfa99 100644 > --- a/drivers/net/ethernet/ti/cpsw_ale.h > +++ b/drivers/net/ethernet/ti/cpsw_ale.h > @@ -96,6 +96,10 @@ struct cpsw_ale { > u32 vlan_field_bits; > unsigned long *p0_untag_vid_mask; > const struct ale_entry_fld *vlan_entry_tbl; > + /* serializes access to the ALE table (index and data registers), > + * the VLAN mask mux registers and p0_untag_vid_mask > + */ > + spinlock_t lock; > }; [Severity: Low] This isn't a bug, but is the comment accurate for p0_untag_vid_mask? Only the writers of the bitmap take the lock. The reader in the same header does not: drivers/net/ethernet/ti/cpsw_ale.h: static inline int cpsw_ale_get_vlan_p0_untag(struct cpsw_ale *ale, u16 vid) { return test_bit(vid, ale->p0_untag_vid_mask); } Its caller, cpsw_rx_vlan_encap() in cpsw_priv.c, runs in the RX path without ale->lock: if (!cpsw_ale_get_vlan_p0_untag(cpsw->ale, vid)) { The writer is cpsw_ale_set_vlan_untag(). It is reached from __cpsw_ale_add_vlan(), cpsw_ale_vlan_del_modify_int() and cpsw_ale_del_vlan(), which all hold ale->lock now. It uses bitmap_set()/bitmap_clear() with nbits == 1, and these compile to the non-atomic __set_bit()/__clear_bit(). Would it be clearer to say that the lock serializes writers of p0_untag_vid_mask and that the RX path reads it without the lock? The other option is to switch the writer to set_bit()/clear_bit(), which makes the lockless read explicit. The comment is also unchanged later in the series apart from the added mention of the control registers. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-cpsw-ale-lock-v3-0-b40dc361d6b9%40amperfied.com