RDMA/rxe: Break endless pagefault loop for RO pages
Subsystems (2)
PATCH 1/1 RDMA/rxe: Break endless pagefault loop for RO pages
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
--- drivers/infiniband/sw/rxe/rxe_odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_odp.c +1 -1
@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp,while (addr < iova + length) { idx = (addr -ib_umem_start (umem_odp)) >> umem_odp->page_shift; -if (!(umem_odp->map.pfn_list[idx] & perm)) { +if (!(umem_odp->map.pfn_list[idx] &HMM_PFN_VALID )) { need_fault = true;break ; }
Signature · 1 line
2.49.0
Quoted 10 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Fixes eedd5b1276e7 ("RDMA/umem: Store ODP access mask information in PFN")Reported-by Daisuke Matsuda <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>
Thank you!
This change fixes one of the two issues I reported.
The kernel module does not get stuck in rxe_ib_invalidate_range() anymore.
The remaining one is the stuck issue in uverbs_destroy_ufile_hw(). cf. https://lore.kernel.org/all/[email protected]/
The issue occurs with test_odp_async_prefetch_rc_traffic, which is not yet enabled in rxe. It might indicate that the root cause lies in ib_uverbs layer. I will take a closer look anyway.
Thanks,
Daisuke
Quoted 17 lines
--- drivers/infiniband/sw/rxe/rxe_odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_odp.c +1
-1@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp,while (addr < iova + length) { idx = (addr -ib_umem_start (umem_odp)) >> umem_odp->page_shift; -if (!(umem_odp->map.pfn_list[idx] & perm)) { +if (!(umem_odp->map.pfn_list[idx] &HMM_PFN_VALID )) { need_fault = true;break ; }
Quoted 15 lines · Daisuke Matsuda
Quoted 10 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Fixes eedd5b1276e7 ("RDMA/umem: Store ODP access mask information in PFN")Reported-by Daisuke Matsuda <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>Tested-by Daisuke Matsuda <[email protected]>
Quoted 7 lines
Thank you!
This change fixes one of the two issues I reported.
The kernel module does not get stuck inrxe_ib_invalidate_range()anymore.The remaining one is the stuck issue in
uverbs_destroy_ufile_hw(). cf. https://lore.kernel.org/all/[email protected]/
Thanks, I updated the link to point to https://lore.kernel.org/all/[email protected]/
Quoted 3 lines
The issue occurs with
test_odp_async_prefetch_rc_traffic, which is not yet enabled in rxe. It might indicate that the root cause lies inib_uverbslayer.
Unlikely, up till now, it indicated that driver didn't release some uverb object.
Quoted 23 lines
I will take a closer look anyway.
Thanks,
DaisukeQuoted 16 lines
--- drivers/infiniband/sw/rxe/rxe_odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_odp.c +1
-1@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp,while (addr < iova + length) { idx = (addr -ib_umem_start (umem_odp)) >> umem_odp->page_shift; -if (!(umem_odp->map.pfn_list[idx] & perm)) { +if (!(umem_odp->map.pfn_list[idx] &HMM_PFN_VALID )) { need_fault = true;break ; }
Quoted 24 lines · Leon Romanovsky
Quoted 15 lines · Daisuke Matsuda
Quoted 10 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Fixes eedd5b1276e7 ("RDMA/umem: Store ODP access mask information in PFN")Reported-by Daisuke Matsuda <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>Tested-by Daisuke Matsuda <[email protected]>Quoted 7 lines
Thank you!
This change fixes one of the two issues I reported.
The kernel module does not get stuck inrxe_ib_invalidate_range()anymore.The remaining one is the stuck issue in
uverbs_destroy_ufile_hw(). cf. https://lore.kernel.org/all/[email protected]/
Quoted 8 lines
Thanks, I updated the link to point to https://lore.kernel.org/all/[email protected]/
Quoted 3 lines
The issue occurs with
test_odp_async_prefetch_rc_traffic, which is not yet enabled in rxe. It might indicate that the root cause lies inib_uverbslayer.Unlikely, up till now, it indicated that driver didn't release some uverb object.
BTW, all places in RXE driver which do the following:
page = hmm_pfn_to_page(umem_odp->map.pfn_list[index]); if (!page) {
...
are incorrect, hmm_pfn_to_page() will always return something.
Thanks
Quoted 8 lines · Daisuke Matsuda
Quoted 6 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Quoted 6 lines
Quoted 4 lines
Fixes eedd5b1276e7 ("RDMA/umem: Store ODP access mask information in PFN")Reported-by Daisuke Matsuda <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>Tested-by Daisuke Matsuda <[email protected]>
In the bug report mail, you mentioned
"
After these two patches are merged to the for-next tree, RXE ODP test always hangs:
RDMA/core: Convert UMEM ODP DMA mapping to caching IOVA and page linkage RDMA/umem: Store ODP access mask information in PFN
"
After this commit is applied, which of the two previous commits is innocent, and which one causes the "stuck issue in uverbs_destroy_ufile_hw"?
Best Regards,
Yanjun.Zhu
Quoted 35 lines
Thank you!
This change fixes one of the two issues I reported.
The kernel module does not get stuck inrxe_ib_invalidate_range()anymore.The remaining one is the stuck issue in
uverbs_destroy_ufile_hw(). cf. https://lore.kernel.org/all/[email protected]/The issue occurs with
test_odp_async_prefetch_rc_traffic, which is not yet enabled in rxe. It might indicate that the root cause lies inib_uverbslayer. I will take a closer look anyway.Thanks,
DaisukeQuoted 17 lines
---
drivers/infiniband/sw/rxe/rxe_odp.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_odp.c +1
-1@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp, while (addr < iova + length) { idx = (addr - ib_umem_start(umem_odp)) >> umem_odp->page_shift; - if (!(umem_odp->map.pfn_list[idx] & perm)) { + if (!(umem_odp->map.pfn_list[idx] & HMM_PFN_VALID)) { need_fault = true; break; }
Quoted 16 lines · Zhu Yanjun
Quoted 8 lines · Daisuke Matsuda
Quoted 6 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Quoted 6 lines
Quoted 4 lines
Fixes eedd5b1276e7 ("RDMA/umem: Store ODP access mask information in PFN")Reported-by Daisuke Matsuda <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>Tested-by Daisuke Matsuda <[email protected]>
Quoted 8 lines
In the bug report mail, you mentioned
"
After these two patches are merged to the for-next tree, RXE ODP test always hangs:
RDMA/core: Convert UMEM ODP DMA mapping to caching IOVA and page linkage RDMA/umem: Store ODP access mask information in PFN
"After this commit is applied, which of the two previous commits is innocent, and which one causes the "stuck issue in
uverbs_destroy_ufile_hw"?
The issue caused by "RDMA/umem: Store ODP access mask information in PFN" has been resolved, and after applying "RDMA/core: Convert UMEM ODP DMA mapping to caching IOVA and page linkage", the stuck issue in uverbs_destroy_ufile_hw() emerges.
I have added some details to the bug report. I am going post a fix though I am not sure people like changing hmm.c to fix this one.
Thanks,
Daisuke
Quoted 39 lines
Best Regards,
Yanjun.ZhuQuoted 34 lines
Thank you!
This change fixes one of the two issues I reported.
The kernel module does not get stuck inrxe_ib_invalidate_range()anymore.The remaining one is the stuck issue in
uverbs_destroy_ufile_hw(). cf. https://lore.kernel.org/all/[email protected]/The issue occurs with
test_odp_async_prefetch_rc_traffic, which is not yet enabled in rxe. It might indicate that the root cause lies inib_uverbslayer. I will take a closer look anyway.Thanks,
DaisukeQuoted 16 lines
---
drivers/infiniband/sw/rxe/rxe_odp.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_odp.c +1
-1@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp, while (addr < iova + length) { idx = (addr - ib_umem_start(umem_odp)) >> umem_odp->page_shift; - if (!(umem_odp->map.pfn_list[idx] & perm)) { + if (!(umem_odp->map.pfn_list[idx] & HMM_PFN_VALID)) { need_fault = true; break; }
Leon Romanovsky
AppliedQuoted 5 lines · Leon Romanovsky
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Applied, thanks!
[1/1] RDMA/rxe: Break endless pagefault loop for RO pages
https://git.kernel.org/rdma/rdma/c/01ec1d8feaf938
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>
Quoted 19 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Fixes eedd5b1276e7 ("RDMA/umem: Store ODP access mask information in PFN")Reported-by Daisuke Matsuda <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- drivers/infiniband/sw/rxe/rxe_odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/rxe/rxe_odp.c +0
-0
drivers/infiniband/sw/rxe/rxe_odp.c static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp, · line 140
Quoted 5 lines
drivers/infiniband/sw/rxe/rxe_odp.c +1
-1@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp,while (addr < iova + length) { idx = (addr -ib_umem_start (umem_odp)) >> umem_odp->page_shift; -if (!(umem_odp->map.pfn_list[idx] & perm)) { +if (!(umem_odp->map.pfn_list[idx] &HMM_PFN_VALID )) {
Because perm is not used, it is not necessary to calculate and pass perm to rxe_check_pagefault. The cleanup is as below:
drivers/infiniband/sw/rxe/rxe_odp.c +1 -1
@@ -125,7 +125,7 @@ int rxe_odp_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, }static inline bool rxe_check_pagefault (struct ib_umem_odp *umem_odp, -u64 iova,int length,u32 perm) +u64 iova,int length) {bool need_fault = false;u64 addr;
@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp,while (addr < iova + length) { idx = (addr - ib_umem_start(umem_odp)) >>
umem_odp->page_shift;
- if (!(umem_odp->dma_list[idx] & perm)) {
+ if (!(umem_odp->dma_list[idx] & HMM_PFN_VALID)) {
need_fault = true;
break;
}
@@ -151,19 +151,14 @@ static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, int length, u
{
struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
bool need_fault;
- u64 perm;
int err;
if (unlikely(length < 1))
return -EINVAL;- perm = ODP_READ_ALLOWED_BIT;
- if (!(flags & RXE_PAGEFAULT_RDONLY))
- perm |= ODP_WRITE_ALLOWED_BIT;
-
mutex_lock(&umem_odp->umem_mutex);
- need_fault = rxe_check_pagefault(umem_odp, iova, length, perm);
+ need_fault = rxe_check_pagefault(umem_odp, iova, length);
if (need_fault) {
mutex_unlock(&umem_odp->umem_mutex);@@ -173,7 +168,7 @@ static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, int length, u
if (err < 0)
return err;- need_fault = rxe_check_pagefault(umem_odp, iova, length, perm);
+ need_fault = rxe_check_pagefault(umem_odp, iova, length);
if (need_fault)
return -EFAULT;
}Zhu Yanjun
Quoted 3 lines
drivers/infiniband/sw/rxe/rxe_odp.c +0
-0need_fault = true;break ; }
Quoted 15 lines · Zhu Yanjun
Quoted 14 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
RO pages has "perm" equal to 0, that caused to the situation where such pages were marked as needed to have fault and caused to infinite loop.
Fixes eedd5b1276e7 ("RDMA/umem: Store ODP access mask information in PFN")Reported-by Daisuke Matsuda <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- drivers/infiniband/sw/rxe/rxe_odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
drivers/infiniband/sw/rxe/rxe_odp.c static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp, · line 139
Quoted 9 lines
drivers/infiniband/sw/rxe/rxe_odp.c +1
-1@@ -137,7 +137,7 @@ static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp,while (addr < iova + length) { idx = (addr -ib_umem_start (umem_odp)) >> umem_odp->page_shift; -if (!(umem_odp->map.pfn_list[idx] & perm)) { +if (!(umem_odp->map.pfn_list[idx] &HMM_PFN_VALID )) {Because perm is not used, it is not necessary to calculate and pass perm to
rxe_check_pagefault. The cleanup is as below:
Thanks a lot, I folded this cleanup to the fix.