From: sashiko-bot@kernel.org
To: "Tariq Toukan" <tariqt@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next 08/10] net/mlx5e: Recreate netdev channels on data direct device unbind
Date: Fri, 09 Oct 2026 13:31:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-165642@kernel.org> (raw)
In-Reply-To: <20261008132815.654147-9-tariqt@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] net/mlx5e: unhandled mlx5e_safe_switch_params() failure leaves queues using unbound data direct device
- [High] net/mlx5e: missing devmem revoke hook causes IOMMU faults for dmabuf bindings on unbind
--
commit e6199c36bc278fa5fdfb415d4fa28dbdfc733a06
Author: Dragos Tatulea <dtatulea@nvidia.com>
Subject: net/mlx5e: Recreate netdev channels on data direct device unbind
This commit handles the unbinding of a data direct device by disabling
the data direct flag and triggering channel recreation for the affected
netdevs. It intends to stop queues from using data direct resources.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -6144,9 +6144,28 @@ static int mlx5e_data_direct_event(struct notifier_block *nb,
[ ... ]
> + new_params = priv->channels.params;
> + MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_DATA_DIRECT, false);
> + mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true);
[Severity: High]
Is it safe to ignore the return value of mlx5e_safe_switch_params() here?
If this function fails (for example, due to an allocation failure when setting
up the new channels), the parameter switch is aborted and the currently active
channels are left untouched. They will continue to run with the data direct
flag enabled.
Since the driver proceeds with the unbind process while the active queues
still reference the soon-to-be-destroyed data direct resources, could the
hardware access invalid resources and cause use-after-free or crashes?
[Severity: High]
Additionally, since the newly recreated channels inherit existing bindings
via rxq->mp_params, won't they continue to post DMA addresses mapped in
the unbound data direct IOMMU domain to the primary PF?
The commit message notes this will cause IOMMU faults because a devmem
revoke hook is needed to close those bindings before the switch. Does this
leave the automatic unbind path fundamentally broken when dmabuf bindings
are present?
> + netdev_info(priv->netdev,
> + "data_direct device unbound, disabled data_direct\n");
> +
> +out:
> + mutex_unlock(&priv->state_lock);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008132815.654147-1-tariqt@nvidia.com?part=8
next prev parent reply other threads:[~2026-10-09 13:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 13:28 [PATCH net-next 00/10] net/mlx5e: Add netdev support for data direct Tariq Toukan
2026-10-08 13:28 ` [PATCH net-next 01/10] net/mlx5: Log the data direct to PF device mapping Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 02/10] net/mlx5e: Register supported netdevs as data direct users Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 03/10] net/mlx5e: Pre-calculate UMR padding and entry size Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 04/10] net/mlx5e: Add data direct ethtool private flag Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 05/10] net/mlx5e: Add data direct RX infrastructure Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 06/10] net/mlx5e: Add data direct TX infrastructure Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 07/10] net/mlx5e: Use the correct DMA dev when data_direct pdev enabled Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 08/10] net/mlx5e: Recreate netdev channels on data direct device unbind Tariq Toukan
2026-10-09 13:31 ` sashiko-bot [this message]
2026-10-08 13:28 ` [PATCH net-next 09/10] net: devmem: add netdev_has_dmabuf_binding() helper Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-08 13:28 ` [PATCH net-next 10/10] net/mlx5e: Enable the data direct netdev feature Tariq Toukan
2026-10-09 13:31 ` sashiko-bot
2026-10-09 16:42 ` [PATCH net-next 00/10] net/mlx5e: Add netdev support for data direct Mina Almasry
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=sashiko-outbox-165642@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tariqt@nvidia.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