Article View: linux.kernel.netdev
Article #9369Re: [net PATCH 10/13] fbnic: Keep the BMC MAC address set whole across a capabilities update
From: netdev-bot+sashiko
Date: Sun, 01 Nov 2026 22:33
Date: Sun, 01 Nov 2026 22:33
112 lines
12208 bytes
12208 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
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] fbnic_mbx_init() is a second, unsequenced writer of
fw_cap.bmc_mac_addr, and it also resets the live seqcount.
--
fbnic: Keep the BMC MAC address set whole across a capabilities update
This patch puts a seqcount around fw_cap.bmc_mac_addr. With it,
fbnic_bmc_rpc_init() can take a consistent snapshot while the mailbox
Rx path replaces the BMC MAC address set. The writer parses the new set
into a local copy and swaps it in inside a write section, with
preemption disabled.
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
> index 7964ce814b8ea..09d03274be08c 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
> @@ -104,6 +104,7 @@ void fbnic_mbx_init(struct fbnic_dev *fbd)
>
> /* Reset FW Capabilities */
> memset(&fbd->fw_cap, 0, sizeof(fbd->fw_cap));
> + seqcount_init(&fbd->fw_cap.bmc_mac_seq);
[Severity: Medium]
Doesn't this make fbnic_mbx_init() a second writer of bmc_mac_addr?
The commit message and the new comments in struct fbnic_fw_cap and
fbnic_fw_parse_bmc_cap() say there is only one writer:
Updates are rare and the mailbox Rx path is the only writer, so a
seqcount is enough and the readers never wait on a lock.
However, the memset() here clears bmc_mac_addr outside any write
section. seqcount_init() then sets the live counter back to 0 instead
of making it odd.
fbnic_mbx_init() is reached on system resume and PCI slot_reset with
only devl_lock held:
__fbnic_pm_resume()
fbnic_fw_request_mbx()
__fbnic_fw_enable_mbx()
fbnic_mbx_init()
The fbnic_bmc_rpc_init() reader in the service task holds RTNL and the
netdev instance lock. Nothing makes these two paths exclude each other.
Can a service task pass still be running at that point?
fbnic_pm_suspend() calls ndo_stop directly, so netif_running() stays
true. fbnic_service_task_stop() also does not wait for a running pass:
fbnic_service_task_stop() {
...
cancel_delayed_work(&fbd->service_task);
}
Take a pass that is already blocked on rtnl_lock() during suspend. It
runs once suspend drops RTNL, passes this check in
fbnic_service_task(), and re-arms itself every HZ into resume:
if (netif_running(netdev)) {
fbnic_health_check(fbd);
fbnic_bmc_rpc_check(fbd);
schedule_delayed_work(&fbd->service_task, HZ);
}
If that pass is inside the new snapshot loop in fbnic_bmc_rpc_init(),
it looks like it can accept a torn copy in two ways.
First, bmc_mac_seq sits just before bmc_mac_addr in struct fbnic_fw_cap,
so the forward memset() clears the counter before the addresses. A
reader that samples 0 during the memset() can copy a half-cleared
address that is not all zeros. read_seqcount_retry() still sees 0, so
the copy is accepted.
Second, a reader samples seq == 2 and is preempted partway through the
24-byte copy. 2 is the usual value after one caps response since the
last init. The reset sets the counter to 0, and the next caps response
parsed via fbnic_mbx_poll_tx_ready() takes it 0 -> 1 -> 2. The reader
then copies the rest from the new set, and read_seqcount_retry() sees
2 == 2.
Either way, the torn address is tagged FBNIC_MAC_ADDR_T_BMC. The same
pass's __fbnic_set_rx_mode() then writes it to the MACDA TCAM, which is
the failure the commit message describes.
__fbnic_pm_resume() later rebuilds through __fbnic_open() ->
fbnic_bmc_rpc_init(), so the bad entry should normally be short-lived.
Would it work to init the seqcount once at probe and do the
bmc_mac_addr reset inside a write section? Another option would be to
quiesce the service task with cancel_delayed_work_sync() before the
mailbox is reinitialized.
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179322311834.40667.5383039334126572422.stgit%40ahduyck-xeon-server.home.arpa
Technical Details
Message-ID:
<179357239987.3131.13754518756856318258@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354351-linux-kernel-netdev=dewy.ruReferences:
<179322343381.40667.1127592669876224055.stgit@ahduyck-xeon-server.home.arpa>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354351-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [net PATCH 10/13] fbnic: Keep the BMC MAC address set whole across a capabilities update Date: Sun, 01 Nov 2026 22:33:19 +0000 Organization: Usenet Network Message-ID: <179357239987.3131.13754518756856318258@kernel.org> References: <179322343381.40667.1127592669876224055.stgit@ahduyck-xeon-server.home.arpa> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2789897"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ih0w5E9eqEtjMDYb0w1na0CuBlA= sha256:f+nOrGPwdCFlWgReMFdCVL6qMI9xmWn550TLLwccKzo= sha1:zzuloDI6h7gqJIWy0gBUwZ+XYHQ= sha256:pDvbYBIgoRlU8C6aRX2EovuAN/CDM8ePVHtAN2M/UhU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 73E0611401C; Mon, 2 Nov 2026 01:51:42 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VVQhDsnsqmJ4; Mon, 2 Nov 2026 01:51:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354351-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id C8E02C72C6; Mon, 2 Nov 2026 01:51:26 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id EA6D837417; Sun, 1 Nov 2026 22:33:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793572402; b=y4UdjTctPkEZWWC0cTzxpLg32IpusHShCSVqVWL0+UiklTL4Fi919whnjzWRE3bzHJIB bYkAhDqfKuTpbGdFy19HXrfsZZr5amZl8CaCbEwtSo67IGknGPCCjnXClPxax6Bjdl6Rz kGfw6q1JSjKqjRWISjp9J6bI9JeJ9+1vpkmtMIZafHvF+mmo+eeZp+8jqBAE2/4C1l4eb ELsWrVxHNG1JnM6pXIyuiiZgw3i7ItrfidIKnFMMes6B51wf0GbHj66MtAFSkpW9rgl31 9ublp7rXVioww+Gxg3Xs68/raietWvyT58oTL4WPPL8iDT0nis2ZfitjYPDyz9E2bJQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793572402; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=NR0Hh93UXRawxt+JabCf16N9EyzOgiFv1Rdldxr8dmE=; b=JB3wSVTC9x5wIoYsOHIBi6dMiJnKRleMnjg/4qL5DC8exjH7s+uEHeaD7XpQZQDYXPQ8 BszHwXUh6gY5t6A4sO+eVDmlMbVlZTLaMK4enC3kRB6bioR7lrOUnjzAS3ERtitOzMC2h hvSqSkwTVwmMRJqEbxMOn2R+PnNXNVQgFxyLzl4DrlpzH7eQUmxZ3tnTDYTFJ4ed3a5X2 KImDsTU+uiHWuQW4jtEiBO96mRMfC78Es5lqfRsmRIiuGRmrR9+k/Nrp0wF7d7VGFGhNI Ol/IatB/QsnE7nKdsTpGu8oSqiRNKpN+i57IjKwiUV95sIULxn9aHrjV6OGaaJ915IA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mHPu4b7V; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54A90606A33C; Sun, 1 Nov 2026 22:33:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mHPu4b7V X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793572401; b=j16I5Gt9MP/2gBxGPsPD+w7FnLb1tVCmIH/JImY9Px6eeqxOYU8pwd7ywoUmfIJfUa9s SW9nDkfpkd1f14HSusL1DmnAxvdwW1Lky8evznckjf2ZXSwm0V3AC3VAo4ZVo8gmDTUNY ZoKe4BBLKSqQAwrY/NYDX9zQRMYvfQYFeC54pGM+DzjJY5yHU4FDWasNvNIOTBIJ9PHpI JE7mz28rgERd4ChqBq2XM0b6a8qgvwlO48KglVpKIZU1k6V7VJ/BmamUTK2DJ811xG15r Psswnd0Lgwq/aEv2oBIlIfNlQFZk91B40EVU6vkvXiXCHzjrf+PBy+HR9XvNZeaWplA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793572401; 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=NR0Hh93UXRawxt+JabCf16N9EyzOgiFv1Rdldxr8dmE=; b=0oP1NX/tVDqMqhF80PGVf665AX5F+fgsLqU+CB56fyMqjNTeo+DuTXam1QtuLz429rQ3 XiKfCBR+CbaO0a8T+kkCl7y6VLbfwKm91rcjAqCjsMevnVbCO1harzKVdCuN1fqbNt/sF Cjgu0drlP/0otIrLyIp6o55JD54R39vPianrRZHoy0ce5SrpPD5Ff2td+TczRF1zwQguO onetIoHlpikiWsvhT6IRqBzCz0cMHW78DPErv3AE7lpsF0e/yVmoFcDtxz0VnrUSZGbFO sC70dt3cnDoNBye+L/pmMgkVo3uixzUrSEsmOG0hrMdKzlN01q4KNEjEvh3niTQQX+w== X-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=mHPu4b7V; arc=none smtp.remote-ip=100.103.45.18 X-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 34FBA606A33A for <netdev@vger.kernel.org>; Sun, 1 Nov 2026 22:33:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 505AD1F000C1; Sun, 1 Nov 2026 22:33:20 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793572400; bh=NR0Hh93UXRawxt+JabCf16N9EyzOgiFv1Rdldxr8dmE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=mHPu4b7VIrq22AYrb5L++nEoTzSx9h3P8RDhrTXr2w7qynRo4VVvDQ8iTDN2lVR9U Kx0SyXuLiN4bL9YfNEBZ90go6RoXTe10h6vGtR03KOC+lNcma8cDrwAr56PYmdJn7w SDuA4MNThiKJqdKxAeNReYludyQYEiWub53odRdcUYv5+ZN9hLsQUehSC5VqqeIy40 /7evpswIlN80lKbpA/UTMlcSGj9xb7Ar37d0wK3vOmUk4FbgmAxzV/Po6oyrE/gBph iYQeO3SE4IBSJzoJQKfTbFGe9IYZyj1y+e0e2CNeTuptTYlIjMPFp/d5P+Zo5ZYoxH iDOf0d/ahu+aQ== X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, horms@kernel.org, kernel-team@meta.com, kuba@kernel.org, pabeni@redhat.com X-In-Reply-To: <179322343381.40667.1127592669876224055.stgit@ahduyck-xeon-server.home.arpa> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list