Article View: linux.kernel.netdev
Article #17251Re: [PATCH V1 rdma-next 08/24] RDMA/mlx5: Derive mlx5_ib_adversarial_mode global from mlx5_core adversarial API
From: Leon Romanovsky
Date: Mon, 16 Nov 2026 14:21
Date: Mon, 16 Nov 2026 14:21
50 lines
9851 bytes
9851 bytes
On Mon, Nov 16, 2026 at 04:12:55PM +0200, Yishai Hadas wrote:
> On 16/11/2026 10:57, Leon Romanovsky wrote:
> > On Tue, Nov 10, 2026 at 03:43:04PM +0200, Yishai Hadas wrote:
> > > Cache mlx5_is_adversarial() in a driver-wide mlx5_ib_adversarial_mode
> > > in mlx5_ib_init(), shared through mlx5_ib.h. The mode is the same for
> > > all devices, so a global avoids reading it through every mlx5_ib_dev
> > > and keeps the checks at the call sites simple.
> >
> > This patch and description makes no sense. The mlx5_is_adversarial() is
> > simple static pre-compiled branch "cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)".
> >
>
> cc_platform_has() is a function call, not a static branch.
Please check how it is implemented.
> The wrapper keeps the policy of when mlx5 runs in adversarial mode in one place,
> used by both mlx5_core and mlx5_ib. Anyway, in V2 mlx5_ib calls it once
> per device at init, see below.
>
> > >
> > > Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
> > > ---
> > > drivers/infiniband/hw/mlx5/main.c | 3 +++
> > > drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 +
> > > 2 files changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> > > index 65455aedd559..f4f2ad80e76c 100644
> > > --- a/drivers/infiniband/hw/mlx5/main.c
> > > +++ b/drivers/infiniband/hw/mlx5/main.c
> > > @@ -76,6 +76,7 @@ enum {
> > > MLX5_ATOMIC_SIZE_QP_8BYTES = 1 << 3,
> > > };
> > > +bool mlx5_ib_adversarial_mode;
> >
> > It is not kernel style to throw random global values to cache existing
> > in-kernel API functions.
> >
>
> OK. In V2 there is no global flag in mlx5_ib anymore. This patch is
> replaced by one that sets ib_device::adversarial_mode once per device,
> and the checks read that field. Patch #24, which set it at the end of
> the series, is folded into it.
You shouldn't cache simple function call to an existing API.
>
> Yishai
Technical Details
Message-ID:
<20261116142138.GT11319@unreal>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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-364439-linux-kernel-netdev=dewy.ruReferences:
<20261110134320.34408-1-yishaih@nvidia.com> <20261110134320.34408-9-yishaih@nvidia.com> <20261116085701.GA11319@unreal> <759c8f05-a018-4040-a791-fef794eb6933@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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-364439-linux-kernel-netdev=dewy.ru From: leon@kernel.org (Leon Romanovsky) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH V1 rdma-next 08/24] RDMA/mlx5: Derive mlx5_ib_adversarial_mode global from mlx5_core adversarial API Date: Mon, 16 Nov 2026 16:21:38 +0200 Organization: Usenet Network Message-ID: <20261116142138.GT11319@unreal> References: <20261110134320.34408-1-yishaih@nvidia.com> <20261110134320.34408-9-yishaih@nvidia.com> <20261116085701.GA11319@unreal> <759c8f05-a018-4040-a791-fef794eb6933@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2084934"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:kMDqIhN1qyoTuKIT6mx2GkkKPkU= sha256:DJoskSPX+9DU9ndXbAaep/iFKIHcZiYudfplg1WAEto= sha1:Mlzur5vVzLldoHncee6iPLHEv3w= sha256:dfE76+I7jgUcx37Yqi6bVEms5DD2fooVpD6iq1NO2gQ= Content-Disposition: inline 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 E690E114C75; Mon, 16 Nov 2026 17:22:08 +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 T59G-yBv9lJ8; Mon, 16 Nov 2026 17:22:05 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364439-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 454D5114C6F; Mon, 16 Nov 2026 17:21:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id AAA382B757; Mon, 16 Nov 2026 14:21:49 +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=1794838907; b=t4xsCA5AkvCwFO9wC8RUxc10V6ebvTKkgdYKhdNofI8xQtj7A4T6phNbbDSRYJBgtxf7 DoF+gZDyP+hy6/3q31xy5AAQAFPtiQaEVkCyKWJf2/p6pdOVHbLK9GR7y1d912KyGOoc0 4EQM54OtiW3CH9v9PKC3Juqy0bJ6rhldvn7GgMP5M3bz02wYhTeNI9hmB7WjSg8VLw43+ By2aUwZq7B/taRiauBCcFAmaQjwTH/3nKXmlC2i6ZIJXIYQHiFgJgigmu5acyyVQAV1Jh vdPYrxqMKHH/3bAagmZx7H0ZFlSuwbZe7CIZ5/ukcq2XV32DuBTsQ1xzhm2hB5PFrUg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794838907; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Y0rdAK14A9QxWLhf2/bZaFf5ckFBWBa/4SrRIbcp79k=; b=tpOK5T31kOhZk9CSYJF1DFMkilTClzoi1WXpYQWBEAtl+t5dTTwkHCebTnoTRPPZAfVP mIFkWG52k0BmX5dxTWJ5rJMe9ZBwD6k7UVa51gUMkugaGGk7aruIdMqs6MinJG4U+yKl5 6Rox6u25auJTF8rupcINpTB07el7wAXRW5IY7K2rD4+Y3YEibMvuf/lTi0IVeWagOX1sp KxDaePAZA7wUfPIhB0DDr5+//8LxynSxZo8Fg4zmaTHtsrl9fCGYqXgCtepDtYbTsa/wY FgTW1dHHrhQQiwzWJO9++h8H7kG3HjpHamjrA9vY5NqqH87tfn667sqThM/RupqxE9g== 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=PWgpGfo0; 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 9BF02606A32A; Mon, 16 Nov 2026 14:21:47 +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=PWgpGfo0 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=1794838901; b=WMXcJkfx72K4u+Q4Txfu/MCx1XdG/LGH+ZjUpWOvX42UAz0q5SR/NE46+ofQtNjzwhyy M9rG4nfbaztAdN4ZmOb051rETIawWD+O8uZqi3BdJFt0uoEueD0iYMbal5hO1CyDRehBX JuEkwLCh3MwUbRPoWBZ9Cv0QWA4vTBSl5XtEweBhQSDATOsc7epCQQMyLLW8abjs2zD13 cFlresQ5dAQ5zOEyh9Q7hAqfZltdIobT+iWdIzrmvy+Enb8wwGB77aG6kpc04Kc9tCuHU gX4ElJg634UbdT9UdBQNdg8okGYG82r3Q0lL3PtYl8TAO5Vf80sHX+baGQOrZvB3Mow== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794838901; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Y0rdAK14A9QxWLhf2/bZaFf5ckFBWBa/4SrRIbcp79k=; b=Rf/Z8UtsFhVbIPGSXwZ5JEqT0FQc9852uJjxmSUlfCVbqPTg4w5qZQmow9htEeSWKlgE yAXUQy4a0/3oNRcxYhazZ0cB1f7seuh7+C5NSD71+M9cmOPjUI0qqwinEvnJtDfqDjY87 KQocQ2faodemu88suG4b+xrHAMZxJdcom4SoKSM67bc2FM/TXgmT2uiHpzTrYOM1ppWF/ chd4JT2BEdtbyw/Rgf0839LpFpFOO9WECUyuBDA2ALVCIkhUeKhMpzSevjmHv72N7zUg0 C7FrC18P15fxFygugCXuhpNygDo8A8TOVxTQLQi29qBGPpaWduPYba0TmPQNjkzeGnQ== 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=PWgpGfo0; 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 BB63C606A32C; Mon, 16 Nov 2026 14:21:41 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C702A1F000CD; Mon, 16 Nov 2026 14:21:40 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794838901; bh=Y0rdAK14A9QxWLhf2/bZaFf5ckFBWBa/4SrRIbcp79k=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=PWgpGfo0zBhHUU+7HzLzeXkBUP/sWrAXkdzEkVPZhb6PaFREO9wBL735/Ow0sXXpD 1KNKsFD+EMzAKyB3QJ77pdeENjS4vytW+MovH5g1/PmGus8JoK0TtHc+3bYOGFhlcU 6Sjaw06KNgKJAiApdOBDYm+esipkdmSdrQuQllcif0xhwCG3Euvsly8wy9IbJ4BJXA kzSKnmNGejStbcmpq/IdCDydID2QZEuVyVRckYNR/PXqdUlQAXaa3fX70CeC/LYOWw AreCkPbfqvZeuAYziZlYEXqy9yvd7ZsWKfpSNkfmOR70pWLH+6rdAT74qTwPaEF0Sy 9QiiPkTaKSseA== X-Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, davem@davemloft.net, andrew+netdev@lunn.ch, dtatulea@nvidia.com, moshe@nvidia.com, maorg@nvidia.com 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 X-In-Reply-To: <759c8f05-a018-4040-a791-fef794eb6933@nvidia.com>