]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/umem: Fix ib_umem_find_best_pgsz() for mappings that cross a page boundary
authorJason Gunthorpe <jgg@nvidia.com>
Fri, 4 Sep 2020 22:41:42 +0000 (19:41 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:54 +0000 (10:07 +0100)
commit59f07434b297e2268f5d5c567db5b09145245cf1
tree8c1768dddae50e409a5904f761cbd923f3a25509
parent7ac277a01f9017fcde4f3f81670c995992945433
RDMA/umem: Fix ib_umem_find_best_pgsz() for mappings that cross a page boundary

[ Upstream commit a40c20dabdf9045270767c75918feb67f0727c89 ]

It is possible for a single SGL to span an aligned boundary, eg if the SGL
is

  61440 -> 90112

Then the length is 28672, which currently limits the block size to
32k. With a 32k page size the two covering blocks will be:

  32768->65536 and 65536->98304

However, the correct answer is a 128K block size which will span the whole
28672 bytes in a single block.

Instead of limiting based on length figure out which high IOVA bits don't
change between the start and end addresses. That is the highest useful
page size.

Fixes: 4a35339958f1 ("RDMA/umem: Add API to find best driver supported page size in an MR")
Link: https://lore.kernel.org/r/1-v2-270386b7e60b+28f4-umem_1_jgg@nvidia.com
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/umem.c