* [PATCH rdma-next 09/15] vfio/mlx5: Enable relaxed ordering on the live migration data mkey
[not found] <20260726092943.2880176-1-michaelgur@nvidia.com>
@ 2026-07-26 9:29 ` Michael Gur
0 siblings, 0 replies; only message in thread
From: Michael Gur @ 2026-07-26 9:29 UTC (permalink / raw)
To: jgg, leon
Cc: linux-rdma, netdev, Edward Srouji, Yishai Hadas, Michael Gur,
Shameer Kolothum, Kevin Tian, Alex Williamson,
open list:VFIO MLX5 PCI DRIVER, open list
As firmware guarantees that all device-issued data writes complete before
posting of CQE, there is no need for strong ordering of memory accesses
on the live migration data mkey.
Enable relaxed ordering on the mkey via the mlx5_core RO setter.
This allows better performance and supporting vfio live migration on HW
that restricts memory registration with strict ordering.
Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Michael Gur <michaelgur@nvidia.com>
---
drivers/vfio/pci/mlx5/cmd.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/pci/mlx5/cmd.c b/drivers/vfio/pci/mlx5/cmd.c
index 5fe0621b5fbd..f534c27597bc 100644
--- a/drivers/vfio/pci/mlx5/cmd.c
+++ b/drivers/vfio/pci/mlx5/cmd.c
@@ -320,7 +320,7 @@ static int mlx5vf_cmd_get_vhca_id(struct mlx5_core_dev *mdev, u16 function_id,
return ret;
}
-static u32 *alloc_mkey_in(u32 npages, u32 pdn)
+static u32 *alloc_mkey_in(struct mlx5_core_dev *mdev, u32 npages, u32 pdn)
{
int inlen;
void *mkc;
@@ -348,6 +348,7 @@ static u32 *alloc_mkey_in(u32 npages, u32 pdn)
MLX5_SET(mkc, mkc, log_page_size, PAGE_SHIFT);
MLX5_SET(mkc, mkc, translations_octword_size, DIV_ROUND_UP(npages, 2));
MLX5_SET64(mkc, mkc, len, npages * PAGE_SIZE);
+ mlx5_core_mkey_set_relaxed_ordering(mdev, mkc);
return in;
}
@@ -439,7 +440,7 @@ static int mlx5vf_dma_data_buffer(struct mlx5_vhca_data_buffer *buf)
if (buf->mkey_in || !buf->npages)
return -EINVAL;
- buf->mkey_in = alloc_mkey_in(buf->npages, buf->migf->pdn);
+ buf->mkey_in = alloc_mkey_in(mdev, buf->npages, buf->migf->pdn);
if (!buf->mkey_in)
return -ENOMEM;
@@ -1439,7 +1440,7 @@ static int mlx5vf_alloc_qp_recv_resources(struct mlx5_core_dev *mdev,
recv_buf->npages = npages;
- recv_buf->mkey_in = alloc_mkey_in(npages, pdn);
+ recv_buf->mkey_in = alloc_mkey_in(mdev, npages, pdn);
if (!recv_buf->mkey_in) {
err = -ENOMEM;
goto end;
--
2.52.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-26 9:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260726092943.2880176-1-michaelgur@nvidia.com>
2026-07-26 9:29 ` [PATCH rdma-next 09/15] vfio/mlx5: Enable relaxed ordering on the live migration data mkey Michael Gur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox