Skip to contentSkip to conversation

RDMA/rxe: Remove redundant page presence check

PATCH Superseded Daisuke Matsuda 1 participant 2 messages Jun 8, 2025

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/rxe: Remove redundant page presence check

hmm_pfn_to_page() does not return NULL. ib_umem_odp_map_dma_and_lock() should return an error in case the target pages cannot be mapped until timeout, so these checks can safely be removed.

---
 drivers/infiniband/sw/rxe/rxe_odp.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_odp.c +0 -4
index dbc5a5600eb7..fb88f2901c58 100644
@@ -203,8 +203,6 @@ static int __rxe_odp_mr_copy(struct rxe_mr *mr, u64 iova, void *addr,
 
 		page = hmm_pfn_to_page(umem_odp->map.pfn_list[idx]);
 		user_va = kmap_local_page(page);
-		if (!user_va)
-			return -EFAULT;
 
 		src = (dir == RXE_TO_MR_OBJ) ? addr : user_va;
 		dest = (dir == RXE_TO_MR_OBJ) ? user_va : addr;
@@ -286,8 +284,6 @@ static enum resp_states rxe_odp_do_atomic_op(struct rxe_mr *mr, u64 iova,
 	idx = rxe_odp_iova_to_index(umem_odp, iova);
 	page_offset = rxe_odp_iova_to_page_offset(umem_odp, iova);
 	page = hmm_pfn_to_page(umem_odp->map.pfn_list[idx]);
-	if (!page)
-		return RESPST_ERR_RKEY_VIOLATION;
 
 	if (unlikely(page_offset & 0x7)) {
 		rxe_dbg_mr(mr, "iova not aligned\n");
Signature · 1 line
2.43.0
#1 lore raw

Sorry, I mistakenly sent an intermediate work. Please ignore this one and see v2.

Quoted 31 lines · Daisuke Matsuda

hmm_pfn_to_page() does not return NULL. ib_umem_odp_map_dma_and_lock() should return an error in case the target pages cannot be mapped until timeout, so these checks can safely be removed.

---
  drivers/infiniband/sw/rxe/rxe_odp.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_odp.c +0 -4
index dbc5a5600eb7..fb88f2901c58 100644
@@ -203,8 +203,6 @@ static int __rxe_odp_mr_copy(struct rxe_mr *mr, u64 iova, void *addr,
 
  		page = hmm_pfn_to_page(umem_odp->map.pfn_list[idx]);
  		user_va = kmap_local_page(page);
-		if (!user_va)
-			return -EFAULT;
 
  		src = (dir == RXE_TO_MR_OBJ) ? addr : user_va;
  		dest = (dir == RXE_TO_MR_OBJ) ? user_va : addr;
@@ -286,8 +284,6 @@ static enum resp_states rxe_odp_do_atomic_op(struct rxe_mr *mr, u64 iova,
  	idx = rxe_odp_iova_to_index(umem_odp, iova);
  	page_offset = rxe_odp_iova_to_page_offset(umem_odp, iova);
  	page = hmm_pfn_to_page(umem_odp->map.pfn_list[idx]);
-	if (!page)
-		return RESPST_ERR_RKEY_VIOLATION;
 
  	if (unlikely(page_offset & 0x7)) {
  		rxe_dbg_mr(mr, "iova not aligned\n");