* [PATCH] RDMA/irdma: Fix PBLE_LEVEL_2 FRWR generation
@ 2026-10-16 18:09 Jacob Moroni
2026-10-16 18:17 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Jacob Moroni @ 2026-10-16 18:09 UTC (permalink / raw)
To: tatyana.e.nikolova, jgg, leon; +Cc: linux-rdma, metze, Jacob Moroni
When an FRWR is posted with only 1 page mapped, it uses a
direct mapping, with the page-aligned DMA address provided
in the WQE (reg_addr_pa). This address is obtained by reading
it from the PBLE that was previously populated during ib_map_mr_sg(),
but it did not account for whether the original allocation was
PBLE_LEVEL_1 or PBLE_LEVEL_2 and just assumed it was always level 1.
As a result, it would program incorrect addresses if the MR was
originally allocated as PBLE_LEVEL_2.
Additionally, multi-page PBLE_LEVEL_2 FRWRs were also broken
because it was using the wrong chunk_size.
Fix these issues by correctly populating the stag_info fields
depending on whether it's a PBLE_LEVEL_1 or PBLE_LEVEL_2 MR and
whether more than 1 page has been mapped or not.
Tested with NFS over RDMA running various fio scenarios, with
and without a modified kernel to force it to take the PBLE_LEVEL_2
path.
Fixes: 137d264c6f63 ("RDMA/irdma: Add 2 level PBLE support for FMR")
Suggested-by: Stefan Metzmacher <metze@samba.org>
Link: https://lore.kernel.org/linux-rdma/20261012161135.494544-1-metze@samba.org/
Signed-off-by: Jacob Moroni <jmoroni@google.com>
---
drivers/infiniband/hw/irdma/verbs.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 71d7ae7baa47..2178fb344e4d 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -4286,11 +4286,23 @@ static int irdma_post_send(struct ib_qp *ibqp,
stag_info.wr_id = ib_wr->wr_id;
stag_info.va = iwmr->ibmr.iova;
stag_info.total_len = iwmr->ibmr.length;
- stag_info.reg_addr_pa = *palloc->level1.addr;
- stag_info.first_pm_pbl_index = palloc->level1.idx;
stag_info.local_fence = true;
- if (iwmr->npages > IRDMA_MIN_PAGES_PER_FMR)
- stag_info.chunk_size = 1;
+ if (iwmr->npages > IRDMA_MIN_PAGES_PER_FMR) {
+ if (palloc->level == PBLE_LEVEL_1) {
+ stag_info.first_pm_pbl_index =
+ palloc->level1.idx;
+ stag_info.chunk_size = 1;
+ } else {
+ stag_info.first_pm_pbl_index =
+ palloc->level2.root.idx;
+ stag_info.chunk_size = 3;
+ }
+ } else {
+ stag_info.reg_addr_pa =
+ (palloc->level == PBLE_LEVEL_1) ?
+ *palloc->level1.addr :
+ *palloc->level2.leaf->addr;
+ }
err = irdma_sc_mr_fast_register(&iwqp->sc_qp,
&stag_info);
break;
--
2.56.0.176.g3575e65682-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/irdma: Fix PBLE_LEVEL_2 FRWR generation
2026-10-16 18:09 [PATCH] RDMA/irdma: Fix PBLE_LEVEL_2 FRWR generation Jacob Moroni
@ 2026-10-16 18:17 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-16 18:17 UTC (permalink / raw)
To: Jacob Moroni; +Cc: linux-rdma
> When an FRWR is posted with only 1 page mapped, it uses a
> direct mapping, with the page-aligned DMA address provided
> in the WQE (reg_addr_pa). This address is obtained by reading
> it from the PBLE that was previously populated during ib_map_mr_sg(),
> but it did not account for whether the original allocation was
> PBLE_LEVEL_1 or PBLE_LEVEL_2 and just assumed it was always level 1.
>
> As a result, it would program incorrect addresses if the MR was
> originally allocated as PBLE_LEVEL_2.
>
> Additionally, multi-page PBLE_LEVEL_2 FRWRs were also broken
> because it was using the wrong chunk_size.
>
> Fix these issues by correctly populating the stag_info fields
> depending on whether it's a PBLE_LEVEL_1 or PBLE_LEVEL_2 MR and
> whether more than 1 page has been mapped or not.
>
> Tested with NFS over RDMA running various fio scenarios, with
> and without a modified kernel to force it to take the PBLE_LEVEL_2
> path.
>
> Fixes: 137d264c6f63 ("RDMA/irdma: Add 2 level PBLE support for FMR")
> Suggested-by: Stefan Metzmacher <metze@samba.org>
> Link: https://lore.kernel.org/linux-rdma/20261012161135.494544-1-metze@samba.org/
> Signed-off-by: Jacob Moroni <jmoroni@google.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016180901.3292775-1-jmoroni@google.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-16 18:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16 18:09 [PATCH] RDMA/irdma: Fix PBLE_LEVEL_2 FRWR generation Jacob Moroni
2026-10-16 18:17 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox