Message ID | 3d4be7ca2155bf239dd8c00a2d25974a92c26ab8.1689757344.git.leon@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [rdma-rc] RDMA/umem: Set iova in ODP flow | expand |
On Wed, 19 Jul 2023 12:02:41 +0300, Leon Romanovsky wrote: > Fixing the ODP registration flow to set the iova correctly. > The calculation in ib_umem_num_dma_blocks() function assumes the iova of > the umem is set correctly. > > When iova is not set, the calculation in ib_umem_num_dma_blocks() is > equivalent to length/page_size, which is true only when memory is aligned. > For unaligned memory, iova must be set for the ALIGN() in the > ib_umem_num_dma_blocks() to take effect and return a correct value. > > [...] Applied, thanks! [1/1] RDMA/umem: Set iova in ODP flow https://git.kernel.org/rdma/rdma/c/186b169cf1e4be Best regards,
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 755a9c57db6f..f9ab671c8eda 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -85,6 +85,8 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem, dma_addr_t mask; int i; + umem->iova = va = virt; + if (umem->is_odp) { unsigned int page_size = BIT(to_ib_umem_odp(umem)->page_shift); @@ -100,7 +102,6 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem, */ pgsz_bitmap &= GENMASK(BITS_PER_LONG - 1, PAGE_SHIFT); - umem->iova = va = virt; /* The best result is the smallest page size that results in the minimum * number of required pages. Compute the largest page size that could * work based on VA address bits that don't change.