On Thu, Jun 13, 2024 at 09:01:42PM +0300, Leon Romanovsky wrote: > From: Chiara Meiohas <cmeiohas@xxxxxxxxxx> > > Set the mkey for dmabuf at PAGE_SIZE to support any SGL > after a move operation. > > ib_umem_find_best_pgsz returns 0 on error, so it is > incorrect to check the returned page_size against PAGE_SIZE This commit message is not clear enough for something that need to be backported: RDMA/mlx5: Support non-page size aligned DMABUF mkeys The mkey page size for DMABUF is fixed at PAGE_SIZE because we have to support a move operation that could change a large-sized page list into a small page-list and the mkey must be able to represent it. The test for this is not quite correct, instead of checking the output of mlx5_umem_find_best_pgsz() the call to ib_umem_find_best_pgsz should specify the exact HW/SW restriction - only PAGE_SIZE is accepted. Then the normal logic for dealing with leading/trailing sub page alignment works correctly and sub page size DMBUF mappings can be supported. This is particularly painful on 64K kernels. Jason