Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jason Gunthorpe" <jgg@nvidia.com>
Cc: kvm@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH v5 10/10] vfio: selftests: mlx5 driver - add send_msi support
Date: Thu, 10 Sep 2026 23:58:33 +0000	[thread overview]
Message-ID: <20260910235833.E4F0C1F00898@smtp.kernel.org> (raw)
In-Reply-To: <10-v5-4cacb99249f6+1b4-mlx5st_jgg@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Invalid hardware initialization and teardown ordering with MSI-X vectors causes firmware command failures and IOMMU faults.
--

commit a10ddcc560d82fed1bf7785eb0d238998106b1d7
Author: Jason Gunthorpe <jgg@ziepe.ca>

vfio: selftests: mlx5 driver - add send_msi support

Wire an MSI-X vector to a dedicated EQ so the mlx5 driver supports
send_msi(). Each EQ can be linked to an MSI-X vector, and the CQ can be
set up to deliver an event to the EQ.

> diff --git a/tools/testing/selftests/vfio/lib/drivers/mlx5/mlx5.c b/tools/testing/selftests/vfio/lib/drivers/mlx5/mlx5.c
> index e5e75adb25316..c8388aabb8c67 100644
> --- a/tools/testing/selftests/vfio/lib/drivers/mlx5/mlx5.c
> +++ b/tools/testing/selftests/vfio/lib/drivers/mlx5/mlx5.c
[ ... ]
> @@ -1721,8 +1869,13 @@ static void mlx5st_init(struct vfio_pci_device *device)
>  	mlx5st_alloc_pd(dev);
>  	mlx5st_create_mkey(dev);
>  
> +	/* MSI EQ must be created before CQ so CQ can reference its eqn */
> +	mlx5st_create_msi_eq(dev);
>  	mlx5st_setup_datapath(dev);
>  
> +	vfio_pci_msix_enable(device, MSI_VECTOR, 1);
> +	device->driver.msi = MSI_VECTOR;
> +

[Severity: High]
Does this sequence result in the firmware rejecting the CREATE_EQ command?

In mlx5st_init(), mlx5st_create_msi_eq() sends the CREATE_EQ command with
intr = MSI_VECTOR. Because vfio_pci_msix_enable() hasn't been called yet,
the MSI-X vectors aren't allocated on the device via VFIO. Will the Mellanox
firmware validate the interrupt vector index against currently allocated
MSI-X vectors and reject this command?

[ ... ]
> @@ -1733,8 +1886,14 @@ static void mlx5st_remove(struct vfio_pci_device *device)
>  {
>  	struct mlx5st_device *dev = to_mlx5st(device);
>  
> +	vfio_pci_msix_disable(device);
>  	mlx5st_teardown_datapath(dev);
>  
> +	if (dev->have_msi_eq) {
> +		mlx5st_destroy_msi_eq(dev);
> +		dev->have_msi_eq = false;
> +	}
> +

[Severity: High]
Can disabling MSI-X before tearing down the datapath and MSI EQ lead to host
IOMMU faults?

In mlx5st_remove(), vfio_pci_msix_disable() is called while the queues are
still active in hardware. If delayed CQE or EQE completions attempt MSI-X
memory writes after the host IRTE is torn down, will this result in DMAR
faults on the host system? Should the datapath and MSI EQ be destroyed
before disabling MSI-X?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/0-v5-4cacb99249f6+1b4-mlx5st_jgg@nvidia.com?part=10

      reply	other threads:[~2026-09-10 23:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 23:57 [PATCH v5 00/10] mlx5 support for VFIO self test Jason Gunthorpe
2026-09-09 23:57 ` [PATCH v5 01/10] net/mlx5: Add IFC structures for CQE and WQE Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 02/10] net/mlx5: Move HW constant groups from device.h/cq.h to mlx5_ifc.h Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 03/10] net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 04/10] net/mlx5: Add ONCE and MMIO accessor variants to mlx5_ifc_macros.h Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 05/10] selftests: Add additional kernel functions to tools/include/ Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 06/10] vfio: selftests: Allow drivers to specify required region size Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 07/10] vfio: selftests: Add dev_dbg Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 08/10] vfio: selftests: Add mlx5 driver - HW init and command interface Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 09/10] vfio: selftests: Add mlx5 driver - data path and memcpy ops Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot
2026-09-09 23:57 ` [PATCH v5 10/10] vfio: selftests: mlx5 driver - add send_msi support Jason Gunthorpe
2026-09-10 23:58   ` sashiko-bot [this message]

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=20260910235833.E4F0C1F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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