Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: tariqt@nvidia.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
	willemb@google.com, parri.andrea@gmail.com, borisp@nvidia.com,
	cratiu@nvidia.com, eedmunds@nvidia.com, gal@nvidia.com,
	jmassar@nvidia.com, jianbol@nvidia.com, kuniyu@google.com,
	leon@kernel.org, linux-rdma@vger.kernel.org, mbloch@nvidia.com,
	phaddad@nvidia.com, raeds@nvidia.com, saeedm@nvidia.com,
	horms@kernel.org, sridhar.samudrala@intel.com,
	steffen.klassert@secunet.com
Subject: Re: [PATCH net 01/10] net/mlx5e: Initialize IPsec XArrays with XA_FLAGS_LOCK_BH
Date: Fri, 27 Nov 2026 22:32:03 +0000	[thread overview]
Message-ID: <179581872338.3135.9809199278681466764@kernel.org> (raw)
In-Reply-To: <20261126215614.792598-2-tariqt@nvidia.com>

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 overstates what the change to
  `ipsec_obj_id_map` fixes.

--

net/mlx5e: Initialize IPsec XArrays with XA_FLAGS_LOCK_BH

This commit adds XA_FLAGS_LOCK_BH when ipsec->sadb and
ipsec->ipsec_obj_id_map are initialized, because every mutation of
these arrays uses the _bh xarray accessors. The commit message says the
mismatch leaves bottom halves disabled while __xas_nomem() allocates a
node. It carries Fixes tags for both 403b383a3ce3 and 91bafc638ed4.

> Node insertion drops+reacquires the lock with the lock variants
> corresponding to the configured type. Using the wrong type therefore
> leaves bottom halves disabled during the allocation.

[ ... ]

> Fixes: 403b383a3ce3 ("net/mlx5e: Store all XFRM SAs in Xarray")
> Fixes: 91bafc638ed4 ("net/mlx5e: Handle IPsec offload for RX datapath in switchdev mode")

[ ... ]

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
> index 5c69e89b13a72..502d89a18f9ec 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
> @@ -2804,7 +2804,8 @@ int mlx5e_accel_ipsec_fs_init(struct mlx5e_ipsec *ipsec,
>  		mutex_init(&ipsec->tx_esw->ft.mutex);
>  		mutex_init(&ipsec->rx_esw->ft.mutex);
>  		ipsec->tx_esw->ns = ns_esw;
> -		xa_init_flags(&ipsec->ipsec_obj_id_map, XA_FLAGS_ALLOC1);
> +		xa_init_flags(&ipsec->ipsec_obj_id_map,
> +			      XA_FLAGS_ALLOC1 | XA_FLAGS_LOCK_BH);

[Severity: Low]
Is the Fixes: 91bafc638ed4 tag accurate for this hunk?

The description fits sadb. In mlx5e_xfrm_add_state(), xa_insert_bh() on
sadb is called with GFP_KERNEL, so __xas_nomem() drops and retakes the
lock using the configured lock type.

For ipsec_obj_id_map, the only call that allocates passes gfp == 0:

drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c:mlx5_esw_ipsec_rx_setup_modify_header() {
    ...
	err = xa_alloc_bh(&ipsec->ipsec_obj_id_map, &mapped_id,
			  xa_mk_value(sa_entry->ipsec_obj_id),
			  XA_LIMIT(1, ESW_IPSEC_RX_MAPPED_ID_MASK), 0);
    ...
}

With gfp == 0, gfpflags_allow_blocking() returns false. __xas_nomem()
then allocates with the lock still held and never calls
xas_unlock_type() or xas_lock_type():

lib/xarray.c:__xas_nomem() {
    ...
	if (gfpflags_allow_blocking(gfp)) {
		xas_unlock_type(xas, lock_type);
		xas->xa_alloc = kmem_cache_alloc_lru(radix_tree_node_cachep, xas->xa_lru, gfp);
		xas_lock_type(xas, lock_type);
	} else {
		xas->xa_alloc = kmem_cache_alloc_lru(radix_tree_node_cachep, xas->xa_lru, gfp);
	}
    ...
}

The other users of this array are xa_erase_bh() and xa_load(), and
neither of them allocates. The gfp was already 0 when 91bafc638ed4
added this code.

That would make this hunk a harmless consistency change rather than a
fix. Could the commit message say that the ipsec_obj_id_map change is
only for consistency? Alternatively, could the second Fixes tag be
dropped, so backporters don't assume 91bafc638ed4 had a live
sleep-in-atomic bug?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126215614.792598-1-tariqt%40nvidia.com

  parent reply	other threads:[~2026-11-27 22:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 21:56 [PATCH net 00/10] net/mlx5e: Fix IPsec SA races and neighbour handling Tariq Toukan
2026-11-26 21:56 ` [PATCH net 01/10] net/mlx5e: Initialize IPsec XArrays with XA_FLAGS_LOCK_BH Tariq Toukan
2026-11-27 21:58   ` sashiko-bot
2026-11-27 22:32   ` netdev-bot+sashiko [this message]
2026-11-26 21:56 ` [PATCH net 02/10] net/mlx5e: Stop counting packets dropped by IPsec RX SA rules Tariq Toukan
2026-11-27 22:32   ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 03/10] net/mlx5e: Fix IPsec SA modify/stats update race Tariq Toukan
2026-11-27 22:32   ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 04/10] net/mlx5e: Drain pending hardware event work before freeing IPsec SA Tariq Toukan
2026-11-27 22:32   ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 05/10] net/mlx5e: Drop IPsec tunnel traffic if the neigh cannot be created Tariq Toukan
2026-11-27 21:58   ` sashiko-bot
2026-11-27 22:32   ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 08/10] net/mlx5e: Validate neighbour events before updating IPsec SAs Tariq Toukan
2026-11-27 22:32   ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 10/10] net/mlx5e: Create IPsec flow counters once per SA Tariq Toukan
2026-11-27 22:32   ` netdev-bot+sashiko
2026-11-27 21:58 ` [PATCH net 00/10] net/mlx5e: Fix IPsec SA races and neighbour handling sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179581872338.3135.9809199278681466764@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=borisp@nvidia.com \
    --cc=cratiu@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eedmunds@nvidia.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=jianbol@nvidia.com \
    --cc=jmassar@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parri.andrea@gmail.com \
    --cc=phaddad@nvidia.com \
    --cc=raeds@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=sridhar.samudrala@intel.com \
    --cc=steffen.klassert@secunet.com \
    --cc=tariqt@nvidia.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox