Article View: linux.kernel.netdev
Article #25317Re: [PATCH net-next v4 2/6] enic: serialize V2 VF mailbox requests
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 14:04
Date: Tue, 01 Dec 2026 14:04
117 lines
12490 bytes
12490 bytes
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 commit message describes a race that cannot happen at this
commit: "If two VF control paths issue requests at the same time, theβ¦
- [Low] The commit message says the patch will "Clear pending state on
send failure so a later request cannot inherit it".
--
enic: serialize V2 VF mailbox requests
This commit adds a VF-only mutex, vf_mbox_request_lock. The mutex is held
from before a mailbox request is armed until its reply or timeout has
been consumed. The commit also rechecks vf_registered in
enic_mbox_vf_unregister() after taking the mutex, and clears the expected
reply state when a send fails.
> The VF stores one expected reply and uses one completion for mailbox
> requests. If two VF control paths issue requests at the same time, the
> second request can replace the reply state for the first.
[Severity: Low]
Can two VF control paths actually issue requests at the same time at this
commit?
The only VF request senders are enic_mbox_vf_capability_check(),
enic_mbox_vf_register() and enic_mbox_vf_unregister() in enic_mbox.c.
Their callers in enic_main.c already appear to exclude each other:
- enic_admin_chan_reopen() is only called from enic_reset() and
enic_tx_hang_reset(). Both hold rtnl_lock() for the whole reset.
- Probe calls the capability check and register back to back. This
happens before INIT_WORK() for the reset works and before
register_netdev().
- enic_remove() calls disable_work_sync() on reset, tx_hang_reset and
change_mtu_work before it calls enic_mbox_vf_unregister(). The probe
error path is single threaded.
So the new recheck in enic_mbox_vf_unregister() does not seem to guard
against any overlap the current tree can produce:
enic_mbox_vf_request_start(enic);
if (!READ_ONCE(enic->vf_registered)) {
enic_mbox_vf_request_finish(enic);
return 0;
}
The mutex seems to become necessary later in the series. That is where
more enic_mbox_vf_request_start() users are added for the MAC add/del,
packet filter and recovery paths.
Could the commit message say this is preparation for those concurrent
request paths? Otherwise it may be read, or backported, as a standalone
race fix.
The comment above mbox_comp in struct enic in enic.h also still says:
/* MBOX request-reply state. Existing request callers allow only one
* request in flight. [ ... ]
Should that comment be updated together with the new
vf_mbox_request_lock?
> Add a request mutex used only by the VF. Hold it from before a request is
> armed until its reply or timeout has been consumed. Recheck registration
> in the unregister path after taking the mutex. Clear pending state on
> send failure so a later request cannot inherit it.
[Severity: Low]
Does "Clear pending state on send failure so a later request cannot
inherit it" describe new behavior? enic_mbox_send_msg_id() already clears
the armed state on its unlock path:
unlock:
if (err && reply_expected) {
spin_lock_bh(&enic->mbox_state_lock);
if (enic->mbox_expected_reply == expected_reply &&
enic->mbox_expected_msg_num == msg_num) {
enic->mbox_expected_reply = 0;
enic->mbox_expected_msg_num = 0;
}
spin_unlock_bh(&enic->mbox_state_lock);
}
That covers the two failures that can happen after arming: the
dma_mapping_error() -ENOMEM and the send -ETIMEDOUT.
The earlier exits are the -EINVAL payload size check, the -ENODEV check
for no channel or sends disabled, -ENOSPC, and the kmalloc() -ENOMEM.
All of them return before reply_expected is set, so no state was armed.
enic_mbox_vf_request_start() also zeroes mbox_expected_reply and
mbox_expected_msg_num before every request. Because of that, the clear
in enic_mbox_vf_request_abort() repeats what already happens:
> +static void enic_mbox_vf_request_abort(struct enic *enic)
> +{
> + lockdep_assert_held(&enic->vf_mbox_request_lock);
> + spin_lock_bh(&enic->mbox_state_lock);
> + enic->mbox_expected_reply = 0;
> + enic->mbox_expected_msg_num = 0;
> + spin_unlock_bh(&enic->mbox_state_lock);
> + mutex_unlock(&enic->vf_mbox_request_lock);
> +}
Could the commit message be reworded so this is not presented as a fix
for an inheritance problem?
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-b4-enic-sriov-v2-vf-receive-control-v4-0-5858d5a9ecb1%40cisco.com
Technical Details
Message-ID:
<179613388882.3146.17579339315974208420@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375139-linux-kernel-netdev=dewy.ruReferences:
<20261130-b4-enic-sriov-v2-vf-receive-control-v4-2-5858d5a9ecb1@cisco.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375139-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v4 2/6] enic: serialize V2 VF mailbox requests Date: Tue, 01 Dec 2026 14:04:48 +0000 Organization: Usenet Network Message-ID: <179613388882.3146.17579339315974208420@kernel.org> References: <20261130-b4-enic-sriov-v2-vf-receive-control-v4-2-5858d5a9ecb1@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1729622"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:kzW31zlEdpcmE2prR0lFW1CMypM= sha256:VtCM4g89xdfXEhuha4AYjpN2G0ek9EL38CZPghIQzXM= sha1:IwEoCkfum29yweOE2HeVws4Cxl8= sha256:/sJpVd3cC+NvIDSkB0oGbgWp7TdR4DtUIyHXI3JjMSo= 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 002991173D1; Tue, 1 Dec 2026 17:05:11 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 GlNRo0WqHVBx; Tue, 1 Dec 2026 17:05:08 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375139-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 21654117373; Tue, 1 Dec 2026 17:05:00 +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 E7CE3289EB; Tue, 1 Dec 2026 14:04:54 +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=1796133893; b=kbzOMUEO75VSmfMi4/RhgiVxq4/T8Qodl6e0DqPx2QkemkFsZoTIFtCePJRXoJYFPG5d RUf7E1JXPGT7eKk1VP1QhKmGSOgFVNKU6QeXZME9nNmWb/owVW9JSoXoR2F3Uu9gPX8/A tbHCZdynzkr8zlWiWs3DsCxWIdJBBLDKQF2d5AiK0uEXoZxBewfQvKlwQ1z27SBqSzD/N 3op2SXk02sU6Vxtwyxj3FZIewom2hWb0IIg6QaJr5twWEg17SIXBXB1cwNdqttjmd8gQE OKIqX0s6TkSqIsg/V43Dqekwl9k7PJLV/TaHQrxA1kBd9yxfXu9EsFga9ix3rdMwd7w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133893; 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=sgtycA2HR0d+Vzrjlzvte1qo5ENG2mslMssLbjwwBb8=; b=17MzFDtg9qsPeCMMUQqgYE2+ofhWBXBDc/92TfBS1UYffbGTwr69Z/R35DhSPgJZ5DOQ xkfhaF5vKIoUHbnnMd4E75VVfTIXdLHspNYzq83I1LxUYCjvh30ohVyWkvHQd6gVn4x/L L44nL9O+M07Vy6RdVsT2E7UmHJP8dJD3tM/bjpR+fFHOdPqcpuWnvF3Ap6MVPexICbrcL GFRLt3zhqMkDPXN1qOAyyQRSR7QKFHSx9iV6ub8lbDF9MPnOfpwSHSMLkqoOz1hWV7p6q +6FP3/yS6sy1cmCbuDEnqSvliThmcQPY6gDnMRdqZE2wi3420f+yhiSX7em7SlfKYgg== 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=krDJFs9C; 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 6F240606A33B; Tue, 1 Dec 2026 14:04:53 +0000 (UTC) X-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=krDJFs9C 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=1796133890; b=blQ25IXdab4TEOWbrkI+JHZE3RIbwD8a/6m1QBbGDPhsc80GYJ92IvbnMKhU47hkpuQV /bWkTDDQzflSLSK+08rFK2t/hm41DbowljP6ZJDT9+QJMEYnSRIXKQUd2NOvl3oQZTT6q 1Wp/W1lnSCMTUCntyIwElyjtQ2w/CGAXPwHC7gQNHn2xQOYNj8gLYdyuVvfiQN9KfZy2Z NTCHbO1kECGuU8t32j2orE07j2C3YLINDV3Krrh2FQq/COFRQH+A/aB3wnAzEkxj1shew mlTeFIaq6Qer/R4/4VHhNUksPAneHM2VzgW33zrNitxXPQxkYnbX+Zdgad/1lwTVqKg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133890; 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=sgtycA2HR0d+Vzrjlzvte1qo5ENG2mslMssLbjwwBb8=; b=u9hiU42edX399yw/TkTC95fSeJXkIL2k0i727CvPfMjP/7SPDNbKe2V7WzYTdogSW908 fPma2nEmKRZUlYTTRhf8xjhDhP8EW411ZTrBCHr6FNxxl01K1uvSs1jhkHBJokAJPJKdO hbaD3GvYD8yIbYuVOS8raXoG2cHnSdxm22CkCa1H368KYhddn8zu9k7Hi6IcwXPyZ+dMk yN2qI3DBUtFbhBRTCcgWKJd1jouN7xSZ/9trfCmPGQIAspwZxYyVeljGv5hBIVF2iWf1u vdrkk4CR3z0uE1AiToJXetv+coY8L7l0Cx0YQ6nmD5gYzo9o1UkfVHjcwIPrlCzIDPQ== 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=krDJFs9C; 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 CB248606A31A; Tue, 1 Dec 2026 14:04:50 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46B521F00893; Tue, 1 Dec 2026 14:04:49 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796133890; bh=sgtycA2HR0d+Vzrjlzvte1qo5ENG2mslMssLbjwwBb8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=krDJFs9CHs7JrDrN5z7r5njFxtlAim68UdjBIq2Z/Z7e7nvn5Kvx3Q6U/fVriGeUP 366ClWOKyFT1+jlFcbOboFLk40QkcGEVxMRQz6Q3pUdIZ2b0w4HxTAHbA+SAOeRgUK jNIS5/VPBellolOpUBc/tuTlvmPfaXEorb62nXsyqAD0omA7rjs0lB9kTgmemhgo6l Ap9cPlsgWqoKctV1ctrrGd3Fs4FeGBJUEAJAQG1RpFBunxYN4mLlxAPEdSn36vQtAT kR764b5oCncHUL6hQBU9H6e3kudxuweRAAwoE96jg6fm+JziOjeuhvkDxg8ZbmhJpd hmSkmJqdwkiOQ== X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, willemb@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sebaddel@cisco.com, aradhana@cisco.com, rfaucett@cisco.com X-In-Reply-To: <20261130-b4-enic-sriov-v2-vf-receive-control-v4-2-5858d5a9ecb1@cisco.com> X-sashiko-severity: Low 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