From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.81 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796070360; b=ogkXPslOYXIuZ/nyFa+UhJga+/b++S4qjj73i7jnQNbM/ORsMnRZAN+b/xZeLlI2GDkw fSRhUj5HSRzRbiDZhLtWb1IdrtumnE9iZe7QLD725LYyVcQN8rZ3d8UmSqgBd0mB/5Ey2 8GTS3LzFk6t07KdIkIQdkwAPchHK7/LTWi81HAlx71oOCXf69r1EuZvEXbp0DGIb3Staf pPQq1RgQ+CZgOjKHldaw77AdP30mfN8akA7MDEQ8JNwIPuCfph2YIs/KF+IjKL9L2kCeq ++ICR06fQjjBtTyO04YAVrR1cVCOUwCrfiALc3U2y49ejR15RWnwjC2751AgsrCh1IQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796070360; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=KG8bK418yVi0ip8ZvxB4qyIRc2rabL9t+keJMuOLXzs=; b=3lVXpspzRr7wL9VfS1s6lSPsJBj6kohSsXzJ4adbCFulsk8jSgPkv6nazwDCM/JJlDlR v6/u2vnm98FhQbMKT4DMTppjFYkPTPvkYSuTqEPLR68pRarrWfHVuCNUW1mV1BxxYPoTn ZTKrN45SapqxEclDk8GcGFMdUPMSb/KoEBEOERexzr/V2Olj8YR9UzZUQh6Sktb5S6b9o MFSFDd3bT8LHdMuccgqavdF4mN4R3gjoYZYScuqE8iwDX/bSQAfj5aeVCJocXx4EiKTpz DBpFgd1GeWkkyy/QVCFAd3oAbfGlom5n+MMqf7rXEvPXy4pzj6qj7eN15eFABEDYMWg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=eC5mXYZP; arc=none smtp.remote-ip=91.218.175.81 Received: from mta0.migadu.com (out-81.mta0.migadu.com [91.218.175.81]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B703E606A33B for ; Mon, 30 Nov 2026 20:25:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B703E606A33B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=eC5mXYZP X-Envelope-To: linux-rdma@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=lPxnq/qmP9KiuraHTCLE3Wt6CzlNWNIxXiuPUFX9yzg=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796070356; v=1; x=1796675156; b=eC5mXYZPzlMj8y+KyI3wih+n/IqGcgrp+YOrK0aGMUdYKg3vWEhrQrJCRHTzq+0lGLjd5XZw BXxHCUOphuLLqNdIFkCPxgxvmPTaWATsDs+Z5zTYq73IL1gFPfh49GzRehyP40A5k9OSW3wr3tm NZ9SVVRfLWJX6Nv1o3Qxze1s= X-Envelope-To: linux-rdma@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id e95ad3512945b9e2; Mon, 30 Nov 2026 20:25:56 +0000 X-Mizu-Trace-ID: e95ad3512945b9e2 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Mon, 30 Nov 2026 21:25:55 +0100 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH rdma-rc] RDMA/siw: Flush the ORQ when CLOSING or TERMINATE moves to ERROR To: Andrew Stellman Cc: Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261129135301.80788-1-bugs@stellman-greene.com> From: Bernard Metzler In-Reply-To: <20261129135301.80788-1-bugs@stellman-greene.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 29.11.2026 14:53, Andrew Stellman wrote: > From: Andrew Stellman > > 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 > --- > 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; Thanks Andrew, looks good to me! Acked-by: Bernard Metzler