Skip to contentSkip to conversation

RDMA/umem: Fix ib_umem_find_best_pgsz()

PATCH Applied Leon Romanovsky 3 participants 3 messages Jan 28, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/umem: Fix ib_umem_find_best_pgsz()

From: Artemy Kovalyov <[email protected]>

Except for the last entry, the ending iova alignment sets the maximum possible page size as the low bits of the iova must be zero when starting the next chunk.

Fixes 4a35339958f1 ("RDMA/umem: Add API to find best driver supported page size in an MR")
---
 drivers/infiniband/core/umem.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/infiniband/core/umem.c +6 -3
index 933dc1aeed5f..82455a1392f1 100644
@@ -166,10 +166,13 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,
 		 * for any address.
 		 */
 		mask |= (sg_dma_address(sg) + pgoff) ^ va;
-		if (i && i != (umem->nmap - 1))
-			/* restrict by length as well for interior SGEs */
-			mask |= sg_dma_len(sg);
 		va += sg_dma_len(sg) - pgoff;
+		/* Except for the last entry, the ending iova alignment sets
+		 * the maximum possible page size as the low bits of the iova
+		 * must be zero when starting the next chunk.
+		 */
+		if (i != (umem->nmap - 1))
+			mask |= va;
 		pgoff = 0;
 	}
 	best_pg_bit = rdma_find_pg_bit(mask, pgsz_bitmap);

--
2.24.1

Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Leon Romanovsky

From: Artemy Kovalyov <[email protected]>

Except for the last entry, the ending iova alignment sets the maximum possible page size as the low bits of the iova must be zero when starting the next chunk.

Fixes 4a35339958f1 ("RDMA/umem: Add API to find best driver supported page size in an MR")

This fixes the issue for EFA, thanks Leon.

#2 lore raw
In reply to Leon Romanovsky
Quoted 6 lines · Leon Romanovsky

From: Artemy Kovalyov <[email protected]>

Except for the last entry, the ending iova alignment sets the maximum possible page size as the low bits of the iova must be zero when starting the next chunk.

Quoted 7 lines
Fixes 4a35339958f1 ("RDMA/umem: Add API to find best driver supported page size in an MR")
---
 drivers/infiniband/core/umem.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Applied to for-next, thanks

Jason