RDMA/rxe: Release responder MR on receive CQ overflow
Subsystems (2)
PATCH 1/1 RDMA/rxe: Release responder MR on receive CQ overflow
From: Andrew Stellman <[email protected]>
When rxe_cq_post() fails in do_complete() because the receive CQ is full, rxe_receiver() goes from RESPST_ERR_CQ_OVERFLOW straight to RESPST_ERROR and skips cleanup(). For an RDMA WRITE with immediate data, qp->resp.mr keeps its reference, so deregistering the MR while the QP still exists waits for the pool timeout and then warns:
rxe0: cq#4 rxe_cq_post: queue full
------------[ cut here ]------------ WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup+0x230/0x2bc, CPU#4: cq_overflow_rep/371 Modules linked in: CPU: 4 UID: 1000 PID: 371 Comm: cq_overflow_rep Not tainted 7.4.0-rc4-g7cd8495c0f16 #18 PREEMPT(full) Hardware name: linux,dummy-virt (DT) pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) pc : __rxe_cleanup+0x230/0x2bc lr : __rxe_cleanup+0x22c/0x2bc sp : ffff8000827f7680 x29: ffff8000827f7680 x28: 0000000000000000 x27: 0000000000000000 x26: ffff8000827f7a20 x25: 1ffff000104feeda x24: 0000000000000000 x23: ffff0000c1898c10 x22: 0000000000000001 x21: ffff0000e0b8cf48 x20: ffff0000c1898c28 x19: ffff0000c1898c00 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: ffffb8805418cf00 x14: ffff00029d6ba300 x13: 0000000000000006 x12: ffff600018313187 x11: 1fffe00018313186 x10: ffff600018313186 x9 : dfff800000000000 x8 : ffff0000c1898c30 x7 : 0000000000000001 x6 : ffff600018313186 x5 : ffff0000c1898c30 x4 : ffff600018313187 x3 : 1ffff000104feeb2 x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000 Call trace: __rxe_cleanup+0x230/0x2bc (P) rxe_dereg_mr+0x6c/0x1d4 ib_dereg_mr_user+0xdc/0x220 uverbs_free_mr+0x38/0x60 destroy_hw_idr_uobject+0x6c/0xc8 uverbs_destroy_uobject+0xc4/0x5e0 uobj_destroy+0x64/0x110 ib_uverbs_cmd_verbs+0xa5c/0x31a0 ib_uverbs_ioctl+0x184/0x2a4 __arm64_sys_ioctl+0x128/0x1a8 invoke_syscall+0x74/0x2c0 el0_svc_common.constprop.0+0xac/0x230 do_el0_svc+0x40/0x58 el0_svc+0x38/0xa0 el0t_64_sync_handler+0xa0/0xe4 el0t_64_sync+0x198/0x19c ---[ end trace 0000000000000000 ]--- rxe0: mr#4 rxe_dereg_mr: cleanup failed, err = -110
Set goto_error and go to RESPST_CLEANUP instead, so cleanup() releases the packet and the MR reference and RESPST_DONE then moves the QP to ERROR.
As an unprivileged user, ibv_dereg_mr() after a receive CQ overflow took 51.534 seconds before this change and 0.000 seconds after it. An ordinary WRITE with immediate data completed normally on both builds.
The issue was found by Claude Fable 5.2 running Quality Playbook, an LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with Claude Opus 5.5, and both were reviewed by me.
---
Tested in QEMU (arm64, KASAN) on mainline 7cd8495c0f16; with the change reverted, the deregistration took 50.531 seconds again. The patch applies to rdma wip/leon-for-next 211a4cfd857d and for-next 94e81a1f3ffa (git apply --check only; not run on those trees).
A reproducer is available on request.
drivers/infiniband/sw/rxe/rxe_resp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_resp.c +2 -1
@@ -1740,7 +1740,8 @@ int rxe_receiver(struct rxe_qp *qp)case RESPST_ERR_CQ_OVERFLOW :/* All - Class G */ - state =RESPST_ERROR ; + qp->resp.goto_error =1 ; + state =RESPST_CLEANUP ;break ;case RESPST_DONE :
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 15 lines
From: Andrew Stellman <[email protected]>
When
rxe_cq_post()fails indo_complete()because the receive CQ is full,rxe_receiver()goes fromRESPST_ERR_CQ_OVERFLOWstraight toRESPST_ERRORand skipscleanup(). For an RDMA WRITE with immediate data,qp->resp.mrkeeps its reference, so deregistering the MR while the QP still exists waits for the pool timeout and then warns:rxe0: cq#4
rxe_cq_post: queue full------------[ cut here ]------------ WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup+0x230/0x2bc, CPU#4: cq_overflow_rep/371 Modules linked in: CPU: 4 UID: 1000 PID: 371 Comm: cq_overflow_rep Not tainted 7.4.0-rc4-g7cd8495c0f16 #18 PREEMPT(full) Hardware name: linux,dummy-virt (DT) pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
Quoted 6 lines
[ ... ]
The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with Claude Opus 5.5, and both were reviewed by me.Fixes 8700e3e7c485 ("Soft RoCE driver")Signed-off-by Andrew Stellman <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Leon Romanovsky
AppliedQuoted 46 lines · Andrew Stellman
When
rxe_cq_post()fails indo_complete()because the receive CQ is full,rxe_receiver()goes fromRESPST_ERR_CQ_OVERFLOWstraight toRESPST_ERRORand skipscleanup(). For an RDMA WRITE with immediate data,qp->resp.mrkeeps its reference, so deregistering the MR while the QP still exists waits for the pool timeout and then warns:rxe0: cq#4
rxe_cq_post: queue full------------[ cut here ]------------ WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup+0x230/0x2bc, CPU#4: cq_overflow_rep/371 Modules linked in: CPU: 4 UID: 1000 PID: 371 Comm: cq_overflow_rep Not tainted 7.4.0-rc4-g7cd8495c0f16 #18 PREEMPT(full) Hardware name: linux,dummy-virt (DT) pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) pc : __rxe_cleanup+0x230/0x2bc lr : __rxe_cleanup+0x22c/0x2bc sp : ffff8000827f7680 x29: ffff8000827f7680 x28: 0000000000000000 x27: 0000000000000000 x26: ffff8000827f7a20 x25: 1ffff000104feeda x24: 0000000000000000 x23: ffff0000c1898c10 x22: 0000000000000001 x21: ffff0000e0b8cf48 x20: ffff0000c1898c28 x19: ffff0000c1898c00 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: ffffb8805418cf00 x14: ffff00029d6ba300 x13: 0000000000000006 x12: ffff600018313187 x11: 1fffe00018313186 x10: ffff600018313186 x9 : dfff800000000000 x8 : ffff0000c1898c30 x7 : 0000000000000001 x6 : ffff600018313186 x5 : ffff0000c1898c30 x4 : ffff600018313187 x3 : 1ffff000104feeb2 x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000 Call trace: __rxe_cleanup+0x230/0x2bc (P) rxe_dereg_mr+0x6c/0x1d4 ib_dereg_mr_user+0xdc/0x220 uverbs_free_mr+0x38/0x60 destroy_hw_idr_uobject+0x6c/0xc8 uverbs_destroy_uobject+0xc4/0x5e0 uobj_destroy+0x64/0x110 ib_uverbs_cmd_verbs+0xa5c/0x31a0 ib_uverbs_ioctl+0x184/0x2a4 __arm64_sys_ioctl+0x128/0x1a8 invoke_syscall+0x74/0x2c0 el0_svc_common.constprop.0+0xac/0x230 do_el0_svc+0x40/0x58 el0_svc+0x38/0xa0 el0t_64_sync_handler+0xa0/0xe4 el0t_64_sync+0x198/0x19c ---[ end trace 0000000000000000 ]--- rxe0: mr#4 rxe_dereg_mr: cleanup failed, err = -110
Quoted 1 line
[...]
Applied, thanks!
[1/1] RDMA/rxe: Release responder MR on receive CQ overflow
https://git.kernel.org/rdma/rdma/c/a8671ee9bde181
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>