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=1796305282; b=qSXKLBRSTGtTaTQ9vRa9GRMtztIWXCPDWYkynOyNm6HGkL5FrK8X9C7n6eCOnj1DLjzi 2QmeHT5CAnkG2yvKKEPXtlqdQPOuL/DW5322NcXxcxbOf3HQRgXITGFVMrp0TyfvZgtzC SGKS/w1t697ltzzZseUDEZFxleH0FUKG5wciiaUALuPIdSmBAesZMv61qJiX2lR696V2v FC3JuKcEKMzKp0wVMVqjimTfI7zKV/zJ8Y95xGw1x8YvEXzR+2Agu9yGYL59orMijgnhi jHnjfkvjBOYoVYy/sBJWBmPVN2eN6VVJFYZVKrFebKkjyNf4XlGq/+7lJHN8b6eNdqQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796305282; 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=W/0n+q4Z26CJJmJuo21mOxoveNqdVDhW/pcDBAhwu6g=; b=wRsno+vwyiTdIi7TK53ukFdafU4n5PhdvbVKO+4N6Wy159G16FQziqE81/bgaj0G/0cD VNPUxj0Fgxz+RFa5pXviNKGNpvRe0/s9l6Z3/avf5riZHQ0O+vZwFZF1OJGu+fQ9egoH3 fwWwGOQHsmobnIoQrjvdNeN/JygFTM8tPXswUkLkp5ZpTOlU8y8wO2kBptAHscqvWypNw aqAEOnPXOSJtXiAWHlW4qjtCq2aMekjhu+L/6DSpe8vDXX1uJPc6U8xVwH+6p+ej6RYrr l5kFLkFuoMkLvqyDhwHnM7b50+f3I+uc8hl/QD2oOlQ0zLIhsHHKNCtvUQ4705RWyJA== 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=RZoGmkcG; 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 E539F606A33B; Thu, 3 Dec 2026 13:41:21 +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=RZoGmkcG Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD1561F000C1; Thu, 3 Dec 2026 13:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796305281; bh=W/0n+q4Z26CJJmJuo21mOxoveNqdVDhW/pcDBAhwu6g=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RZoGmkcGTZFjVx/m7Jr4Y6kB9nTThi1DiBaRyUgWN2oSqsgUUn416hnP7VWqyhMF4 NlBt+ga185PNWYgWL+O6arnCVyAlXrBqgfayOaMP1+yu9N+Psm8lp5T5DunaBcB+j2 6Uqbu5RbeMffeB9kKfmiLNRqxusywTE9tzLvb/nC+wCbve+/oZvDe1Ri7KMQfFHcoO wf+uenk97ux8VK7bWTaSOpOYmBZqkgOJSt1NQbbpuCNqr8ZZaf8WTUAnsvH/phHh3a PRJ1Yxhk2waQvrZJ6GalCHD6txJs/DhaboLZZMSrNsfHk662Ns0aQG8mFLprobX2hk b9JSigtuBjPEw== Subject: Re: [PATCH net 2/2] devlink: Restore parent -> nested instance locking order From: netdev-bot+sashiko@kernel.org To: cratiu@nvidia.com Cc: netdev@vger.kernel.org, jiri@resnulli.us, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, tariqt@nvidia.com, cjubran@nvidia.com, dlinkin@nvidia.com, vladbu@nvidia.com, linux-doc@vger.kernel.org Date: Thu, 03 Dec 2026 13:41:20 +0000 Message-ID: <179630528028.3146.17895833392875679757@kernel.org> In-Reply-To: <20261202133838.834971-3-cratiu@nvidia.com> References: <20261202133838.834971-3-cratiu@nvidia.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-doc@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] This patch restores a comment on devlink_rel_nested_in_notify() (net/devlink/core.c, lines 187-189). -- devlink: Restore parent -> nested instance locking order This commit restores the parent -> nested devlink instance locking order in the documentation and in the devlink_rel_nested_in_notify() comment. It also documents the shared instance lock as an exception that is always taken last, and updates devlink-shared.rst to match. > diff --git a/Documentation/networking/devlink/index.rst b/Documentation/networking/devlink/index.rst > index aebfa5c067519..2fc929bf55443 100644 > --- a/Documentation/networking/devlink/index.rst > +++ b/Documentation/networking/devlink/index.rst [ ... ] > @@ -48,10 +48,10 @@ attributes of devlink netlink. > > A shared devlink instance (see ``devlink_shd_get()``) is inherited at > register time by all instances nested in it, directly or indirectly, and > -can be obtained with ``devlink_shd()``. Devlink core may take the shared > -instance lock while holding a nested instance lock, without taking the > -locks of intermediate instances. Hence, the shared instance lock must not > -be held while waiting for any nested instance to be torn down. > +can be obtained with ``devlink_shd()``. As an exception to the rule above, > +the shared instance lock is taken last, after any other instance lock it > +may be nested with. Hence, it must not be held while taking another > +instance lock or while waiting for any nested instance to be torn down. > > Interface documentation > ----------------------- > diff --git a/net/devlink/core.c b/net/devlink/core.c > index 07b409198e41e..009df043d2531 100644 > --- a/net/devlink/core.c > +++ b/net/devlink/core.c > @@ -184,7 +184,9 @@ int devlink_rel_nested_in_add(u32 *rel_index, u32 devlink_index, > * a notification of a change of this object should be sent > * over netlink. The parent devlink instance lock needs to be > * taken during the notification preparation. > - * Since the parent may or may not be locked, 'work' is utilized. > + * However, since the devlink lock of nested instance is held here, > + * we would end with wrong devlink instance lock ordering and > + * deadlock. Therefore the work is utilized to avoid that. > */ > void devlink_rel_nested_in_notify(struct devlink *devlink) > { [Severity: Low] Does this restored comment still hold when the nested-in parent is the shared instance? The index.rst and devlink-shared.rst changes in this same patch say the shared instance lock is "taken last, after any other instance lock it may be nested with". In that case, taking the parent lock while holding the nested lock is the allowed order. mlx5_init_one() sets up exactly this case, with the shared instance as the nested_in parent of the PF: drivers/net/ethernet/mellanox/mlx5/core/main.c:mlx5_init_one() { ... devl_lock(devlink); if (dev->shd) { err = devl_nested_devlink_set(dev->shd, devlink); ... } In the same devl_register() call, core code already takes the shared lock directly while the PF lock is held. After that it calls devlink_rel_nested_in_notify(): devl_register() devlink_shd_inherit() devlink_rates_shd_move(devlink, shd) devl_assert_locked(devlink); ... devl_lock(shd); ... devlink_rel_nested_in_notify(devlink) For this parent, the comment says the direct order would be wrong and could deadlock, while the updated docs say it is the required order. Using the work is still correct, and it is still needed for non-shared parents such as a PF with SFs nested in its port functions. So this only affects the comment, not runtime behaviour. Could the comment be limited to non-shared parents, or could it mention the shared instance exception? -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202133838.834971-1-cratiu%40nvidia.com