Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Andrew Stellman <bugs@stellman-greene.com>
To: Zhu Yanjun <zyjzyj2000@gmail.com>
Cc: Zhu Yanjun <yanjun.zhu@linux.dev>, Jason Gunthorpe <jgg@ziepe.ca>,
	Leon Romanovsky <leon@kernel.org>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH rdma-next] RDMA/rxe: Release responder MR on receive CQ overflow
Date: Sat, 28 Nov 2026 14:17:32 -0500	[thread overview]
Message-ID: <20261128191732.30232-1-bugs@stellman-greene.com> (raw)

From: Andrew Stellman <astellman@stellman-greene.com>

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.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
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(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 1b7f3173722599..687ae4d0ff801c 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -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:
-- 
2.53.0


             reply	other threads:[~2026-11-28 19:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 19:17 Andrew Stellman [this message]
2026-11-28 19:22 ` [PATCH rdma-next] RDMA/rxe: Release responder MR on receive CQ overflow sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128191732.30232-1-bugs@stellman-greene.com \
    --to=bugs@stellman-greene.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yanjun.zhu@linux.dev \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox