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=1796133890; b=blQ25IXdab4TEOWbrkI+JHZE3RIbwD8a/6m1QBbGDPhsc80GYJ92IvbnMKhU47hkpuQV /bWkTDDQzflSLSK+08rFK2t/hm41DbowljP6ZJDT9+QJMEYnSRIXKQUd2NOvl3oQZTT6q 1Wp/W1lnSCMTUCntyIwElyjtQ2w/CGAXPwHC7gQNHn2xQOYNj8gLYdyuVvfiQN9KfZy2Z NTCHbO1kECGuU8t32j2orE07j2C3YLINDV3Krrh2FQq/COFRQH+A/aB3wnAzEkxj1shew mlTeFIaq6Qer/R4/4VHhNUksPAneHM2VzgW33zrNitxXPQxkYnbX+Zdgad/1lwTVqKg== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46B521F00893; Tue, 1 Dec 2026 14:04:49 +0000 (UTC) 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== Subject: Re: [PATCH net-next v4 2/6] enic: serialize V2 VF mailbox requests From: netdev-bot+sashiko@kernel.org To: satishkh@cisco.com 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 Date: Tue, 01 Dec 2026 14:04:48 +0000 Message-ID: <179613388882.3146.17579339315974208420@kernel.org> In-Reply-To: <20261130-b4-enic-sriov-v2-vf-receive-control-v4-2-5858d5a9ecb1@cisco.com> References: <20261130-b4-enic-sriov-v2-vf-receive-control-v4-2-5858d5a9ecb1@cisco.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 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