RDMA/irdma: Fix erroneous -ENOMEM for large MR registration
Subsystems (2)
PATCH 1/1 RDMA/irdma: Fix erroneous -ENOMEM for large MR registration
Commit cc8997c94bf3 ("RDMA/irdma: Refactor PBLE functions") replaced the explicit level1_only boolean with a bit mask but did not properly convert the "if (level1_only)" check in irdma_get_pble() to be "lvl == PBLE_LEVEL_1" and instead left it as "if (lvl)".
User MR registration passes "lvl = PBLE_LEVEL_1 | PBLE_LEVEL_2" so this check always evaluates to true and causes the loop to bail after grabbing a single SD even if the region actually requires more than one SD (as is the case for regions larger than 1 GiB with 4k pages). As a result, these registrations can fail with -ENOMEM even if there are sufficient PBLE resources.
--- drivers/infiniband/hw/irdma/pble.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/irdma/pble.c +1 -1
@@ -482,7 +482,7 @@ int irdma_get_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, status =get_lvl1_lvl2_pble (pble_rsrc, palloc, lvl);/* if level1_only, only go through it once */ -if (!status || lvl) +if (!status || lvl ==PBLE_LEVEL_1 )break ; }
Signature · 1 line
2.55.0.1032.g73a4cd73de-goog
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 14 lines
Commit
cc8997c94bf3("RDMA/irdma: Refactor PBLE functions") replaced the explicitlevel1_onlyboolean with a bit mask but did not properly convert the "if (level1_only)" check inirdma_get_pble()to be "lvl ==PBLE_LEVEL_1" and instead left it as "if (lvl)".User MR registration passes "lvl =
PBLE_LEVEL_1|PBLE_LEVEL_2" so this check always evaluates to true and causes the loop to bail after grabbing a single SD even if the region actually requires more than one SD (as is the case for regions larger than 1 GiB with 4k pages). As a result, these registrations can fail with-ENOMEMeven if there are sufficient PBLE resources.
Quoted 2 lines
Fixes cc8997c94bf3 ("RDMA/irdma: Refactor PBLE functions")Signed-off-by Jacob Moroni <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Leon Romanovsky
AppliedQuoted 14 lines · Jacob Moroni
Commit
cc8997c94bf3("RDMA/irdma: Refactor PBLE functions") replaced the explicitlevel1_onlyboolean with a bit mask but did not properly convert the "if (level1_only)" check inirdma_get_pble()to be "lvl ==PBLE_LEVEL_1" and instead left it as "if (lvl)".User MR registration passes "lvl =
PBLE_LEVEL_1|PBLE_LEVEL_2" so this check always evaluates to true and causes the loop to bail after grabbing a single SD even if the region actually requires more than one SD (as is the case for regions larger than 1 GiB with 4k pages). As a result, these registrations can fail with-ENOMEMeven if there are sufficient PBLE resources.
Quoted 1 line
[...]
Applied, thanks!
[1/1] RDMA/irdma: Fix erroneous -ENOMEM for large MR registration
https://git.kernel.org/rdma/rdma/c/5bb710151753fe
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>