* [PATCH rdma-rc] RDMA/siw: Flush the ORQ when CLOSING or TERMINATE moves to ERROR
@ 2026-11-29 13:53 Andrew Stellman
2026-11-29 13:58 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Stellman @ 2026-11-29 13:53 UTC (permalink / raw)
To: Bernard Metzler
Cc: Jason Gunthorpe, Leon Romanovsky, linux-rdma, linux-kernel
From: Andrew Stellman <astellman@stellman-greene.com>
A sent RDMA READ stays in the ORQ until its Read Response arrives,
while its TX WQE goes back to SIW_WR_IDLE. On the move to ERROR,
siw_qp_nextstate_from_close() and siw_qp_nextstate_from_term() call
siw_sq_flush() only if the TX WQE is not idle. That guard treats an
idle TX WQE as nothing to flush and ignores the ORQ, so the READ gets
no flush completion from that transition.
Call siw_sq_flush() unconditionally in both paths, as the RTS to ERROR
path already does. siw_sq_flush() flushes the ORQ first and skips an
idle TX WQE. From reading the source (not tested), it then also
flushes any SQ entries not yet sent and raises IB_EVENT_SQ_DRAINED if
there were any, which these two paths skipped when the TX WQE was
idle.
On v7.4-rc4 with KASAN in arm64 QEMU, with a test-only two-second
delay before the responder sends the Read Response, an unprivileged
client posted one READ and moved its QP to SQD or SQE (CLOSING or
TERMINATE in siw), then to ERR. Without this change, no CQE arrived
in a one-second poll after the move to ERR. With it, one WR_FLUSH_ERR
CQE arrived. A READ without a state change completed normally on both
kernels.
The issue was found by Claude Opus 5.5 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: f29dd55b0236 ("rdma/siw: queue pair methods")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
The test-only delay was an msleep(2000) in siw_qp_sq_proc_tx() before
a queued Read Response is sent. It is not part of this patch.
This applies with or without Cygnus Qiu's pending "RDMA/siw: don't
complete a fenced READ twice on flush" (v2), which changes the TX WQE
branch of siw_sq_flush(). From reading the source, that branch isn't
reached in these two paths when the TX WQE is idle.
A reproducer is available on request.
drivers/infiniband/sw/siw/siw_qp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c
index bb780e3904a21..9bf4e81d86636 100644
--- a/drivers/infiniband/sw/siw/siw_qp.c
+++ b/drivers/infiniband/sw/siw/siw_qp.c
@@ -740,8 +740,7 @@ static void siw_qp_nextstate_from_term(struct siw_qp *qp,
siw_rq_flush(qp);
qp->attrs.state = SIW_QP_STATE_ERROR;
- if (tx_wqe(qp)->wr_status != SIW_WR_IDLE)
- siw_sq_flush(qp);
+ siw_sq_flush(qp);
break;
default:
@@ -774,8 +773,7 @@ static int siw_qp_nextstate_from_close(struct siw_qp *qp,
*/
qp->attrs.state = SIW_QP_STATE_ERROR;
- if (tx_wqe(qp)->wr_status != SIW_WR_IDLE)
- siw_sq_flush(qp);
+ siw_sq_flush(qp);
siw_rq_flush(qp);
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH rdma-rc] RDMA/siw: Flush the ORQ when CLOSING or TERMINATE moves to ERROR
2026-11-29 13:53 [PATCH rdma-rc] RDMA/siw: Flush the ORQ when CLOSING or TERMINATE moves to ERROR Andrew Stellman
@ 2026-11-29 13:58 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-29 13:58 UTC (permalink / raw)
To: Andrew Stellman; +Cc: linux-rdma
> From: Andrew Stellman <astellman@stellman-greene.com>
>
> A sent RDMA READ stays in the ORQ until its Read Response arrives,
> while its TX WQE goes back to SIW_WR_IDLE. On the move to ERROR,
> siw_qp_nextstate_from_close() and siw_qp_nextstate_from_term() call
> siw_sq_flush() only if the TX WQE is not idle. That guard treats an
> idle TX WQE as nothing to flush and ignores the ORQ, so the READ gets
> no flush completion from that transition.
>
> Call siw_sq_flush() unconditionally in both paths, as the RTS to ERROR
> path already does. siw_sq_flush() flushes the ORQ first and skips an
> idle TX WQE. From reading the source (not tested), it then also
> flushes any SQ entries not yet sent and raises IB_EVENT_SQ_DRAINED if
> there were any, which these two paths skipped when the TX WQE was
> idle.
> [ ... ]
> The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
> Claude Opus 5.5, and both were reviewed by me.
>
> Fixes: f29dd55b0236 ("rdma/siw: queue pair methods")
> Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261129135301.80788-1-bugs@stellman-greene.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-29 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 13:53 [PATCH rdma-rc] RDMA/siw: Flush the ORQ when CLOSING or TERMINATE moves to ERROR Andrew Stellman
2026-11-29 13:58 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox