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 04/10] net/mlx5e: Drain pending hardware event work before freeing IPsec SA
Date: Fri, 27 Nov 2026 22:32:10 +0000 [thread overview]
Message-ID: <179581873075.3135.16762994208019735596@kernel.org> (raw)
In-Reply-To: <20261126215614.792598-5-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 leaves out a second change to IPsec init and
teardown ordering.
--
net/mlx5e: Drain pending hardware event work before freeing IPsec SA
The IPsec hardware event work item now lives in struct
mlx5e_ipsec_sa_entry instead of being allocated for each event. This lets
mlx5e_xfrm_free_state() call mlx5_eq_synchronize_async_irq() and then
cancel_work_sync() on it before the SA is freed. The patch also moves the
mlx5 notifier registration out of the ASO helpers and into
mlx5e_ipsec_init() and mlx5e_ipsec_cleanup().
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> index a549851c83827..ea7a1ae2056fa 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
[ ... ]
> @@ -1022,18 +1031,22 @@ void mlx5e_ipsec_init(struct mlx5e_priv *priv)
> if (!ipsec->wq)
> goto err_wq;
>
> - if (mlx5_ipsec_device_caps(priv->mdev) &
> - MLX5_IPSEC_CAP_PACKET_OFFLOAD) {
> + if (pkt_offload) {
> ret = mlx5e_ipsec_aso_init(ipsec);
> if (ret)
> goto err_aso;
> +
> + ipsec->nb.notifier_call = mlx5e_ipsec_event;
> + ret = mlx5_notifier_register(priv->mdev, &ipsec->nb);
> + if (ret)
> + goto clear_aso;
> }
[ ... ]
> @@ -1073,8 +1089,10 @@ void mlx5e_ipsec_cleanup(struct mlx5e_priv *priv)
> ipsec->netevent_nb.notifier_call = NULL;
> }
> if (ipsec->aso)
> - mlx5e_ipsec_aso_cleanup(ipsec);
> + mlx5_notifier_unregister(ipsec->mdev, &ipsec->nb);
> destroy_workqueue(ipsec->wq);
> + if (ipsec->aso)
> + mlx5e_ipsec_aso_cleanup(ipsec);
> kfree(ipsec);
> priv->ipsec = NULL;
> }
[Severity: Low]
Could the commit message also describe this init and teardown change?
Right now it only covers embedding event_work in sa_entry and cancelling
it in mlx5e_xfrm_free_state().
The patch also makes these changes:
- mlx5_notifier_register() and mlx5_notifier_unregister() for ipsec->nb
move out of mlx5e_ipsec_aso_init() and mlx5e_ipsec_aso_cleanup() in
ipsec_offload.c. They now live in mlx5e_ipsec_init() and
mlx5e_ipsec_cleanup().
- mlx5e_ipsec_init() now checks the return value of
mlx5_notifier_register(), which was ignored before. It also gains a
new err_notifier unwind label.
- mlx5e_ipsec_cleanup() now calls destroy_workqueue() before
mlx5e_ipsec_aso_cleanup(), where it used to call it after.
The reorder looks like a fix for a separate lifetime problem. Before this
patch, event work still pending on ipsec->wq could run this path after the
ASO had been freed and ipsec->aso set to NULL:
mlx5e_ipsec_handle_event()->mlx5e_ipsec_aso_query()
The new ordering looks correct. Without a note in the changelog, though,
someone backporting this may not see that the ordering change is needed.
Would it make sense to add a sentence explaining why the workqueue has to
be drained before the ASO is torn down?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126215614.792598-1-tariqt%40nvidia.com
next prev parent reply other threads:[~2026-11-27 22:32 UTC|newest]
Thread overview: 17+ 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 22:32 ` netdev-bot+sashiko
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 [this message]
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 22:32 ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 07/10] net/mlx5e: Copy back only replay_esn after an IPsec ESN update Tariq Toukan
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 09/10] net/mlx5e: Serialize IPsec netevent MAC snapshots Tariq Toukan
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
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=179581873075.3135.16762994208019735596@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