Skip to contentSkip to conversation

RDMA/mlx5: Make sure that UMR page is aligned to PAGE_SIZE

PATCH Applied Leon Romanovsky 3 participants 5 messages Jul 22 – Aug 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mlx5: Make sure that UMR page is aligned to PAGE_SIZE

From: Leon Romanovsky <[email protected]>

The UMR XLT buffer needs to be aligned to PAGE_SIZE.

Fixes b2022068dea0 ("RDMA/mlx5: use kmalloc() for UMR translation buffers")
---
 drivers/infiniband/hw/mlx5/umr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/umr.c +1 -1
index 80d0d190b26c..951de1d85632 100644
@@ -518,7 +518,7 @@ static void *mlx5r_umr_alloc_xlt(size_t *nents, size_t ent_size, gfp_t gfp_mask)
 	size = min_t(size_t, ent_size * ALIGN(*nents, xlt_chunk_align),
 		     MLX5_MAX_UMR_CHUNK);
 	*nents = size / ent_size;
-	res = kmalloc(size, gfp_mask | __GFP_NOWARN);
+	res = kmalloc(PAGE_ALIGN(size), gfp_mask | __GFP_NOWARN);
 	if (res)
 		return res;
 

---
base-commit: 0e8e94c15091041ea8910cbfcade5a9c7cfe3f90
change-id: 20260722-fix-get-order-alignment-b35d7958832d

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>
#1 lore raw
Quoted 3 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

The UMR XLT buffer needs to be aligned to PAGE_SIZE.

Why? It goes into a sgl? The device certainly does not work on PAGE_SIZE, so if there is some alignment here it should be the MLX5 adaptor alignment

Jason

#2 lore raw
Quoted 8 lines · Jason Gunthorpe
Quoted 3 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

The UMR XLT buffer needs to be aligned to PAGE_SIZE.

Why? It goes into a sgl? The device certainly does not work on PAGE_SIZE, so if there is some alignment here it should be the MLX5 adaptor alignment

We need an alignment to 2Kb as a minimum here.

In our case, we got the following assert:
‘mlx5_post_send_umr: assertion failed (MLX5_GET64(umr_pointer_desc_argument, data, address) & 0×7ff == 0)’

Thanks

Quoted 3 lines

Jason

#3 lore raw
Quoted 6 lines · Leon Romanovsky
Quoted 5 lines · Jason Gunthorpe
Quoted 3 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

The UMR XLT buffer needs to be aligned to PAGE_SIZE.

Quoted 8 lines
Quoted 3 lines

Why? It goes into a sgl? The device certainly does not work on PAGE_SIZE, so if there is some alignment here it should be the MLX5 adaptor alignment

We need an alignment to 2Kb as a minimum here.

In our case, we got the following assert:
‘mlx5_post_send_umr: assertion failed (MLX5_GET64(umr_pointer_desc_argument, data, address) & 0×7ff == 0)’

So use that value, or the adaptor page size

There is no reason to align this to 64k if we need a 2k only.

Jason