From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795960383; b=z7ecXcsUzIqH8aTsr+1iFj3zl6wxFW6mH8AnwokGE4IvOi4NbKPnZqOcxNeGeRwbHu3H 9wRTU4BewmOCJ7UB73ixvBL6IMGU9CCuDgzuRnCTcV+S4oYaUsYovnqR8E5wwUal35W9c CuECiEpROL/qAmbBwcmvT1FNxgpjF69afTvTjaG1ji5TgdqJUL9iq53NToH64ilnhNB5J 9hLDNV3AuIY/GApHQG3quKuuSIAIr9VY8f5YVVdb/cBiE8gB88vLEsRkik1P4KjIDDoVn vN813zMzjtEQR//C0LexmkrL8KH86liqi6Qu+AK4lLz3npeGJbVVrBDEPpZIXbkUKrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795960383; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=3CvyVVdbDdEsnPILUCl/hUEPkUhbilg0nsWMGfr4owU=; b=u9FbR9Ipd2tRSZBFCFRLo/W1ZUCygWUh1vamfeyTOBDmm8S9GcCHM6x1ySIcsXH34FXr UrG7BS9Bbgl9s+8blomRRxwRy9+LJcxf4u/wTZuPBLA+IDWb+xp0ocC6OB/gf5pYyO85/ XyVSVM02LUqZdbtN/1dV8FZxHmRghijvNi62ReyESM9xFwYBZoHWaov2jSOGozYEMwOKO gEsSOLSDIlyQDkHQLs+dFp6DyeX4QATrDrV7K08rztifffJWlwWfmsJSwwWBoncX4v+Pf A05CCKRlkq5RWuqRr/BxgIPgjbKDAYP+N0cMsaY6v4NQ2q2vSG3XxV0vRF18PySOrGQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=stellman-greene.com; spf=none smtp.mailfrom=stellman-greene.com; dkim=pass header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=HjxjYMHr; arc=none smtp.remote-ip=209.85.160.179 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (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 84625606A32A for ; Sun, 29 Nov 2026 13:53:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 84625606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=HjxjYMHr Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-55c48582654so107913311cf.0 for ; Sun, 29 Nov 2026 05:53:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stellman-greene-com.20260707.gappssmtp.com; s=20260707; t=1795960382; x=1796565182; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=3CvyVVdbDdEsnPILUCl/hUEPkUhbilg0nsWMGfr4owU=; b=HjxjYMHrGOOo1Xppyb1BsCgtPVm7ufBweMHo52gJ12ZN07EkqxwplGZ16Vd1IgrHTL XF3SiyvbEMjD8nIhsw/iepkg/BbLeH0u2g090hijIOsJNxokxiy/Vs76DvSaK5zCm28K CDePHYpRCJ72EUgyo/FZT5dXUscfcvMRESwPuMkjqZ7f97iMN0niTlG3yGQ0LgA89GKD h+mOR3DT8RA3SR8w4XkJa3GW9k61ApU5MbIvsLfPVUnF//m8ecmA3qn0XiQmk99YjYWW VEu76D6ObIfuDMxxx4dLmo6H0dgo2U1UZyV1QKtVaEN6JEuWDxD83642zyk9IPy5iUqR ZwSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795960382; x=1796565182; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3CvyVVdbDdEsnPILUCl/hUEPkUhbilg0nsWMGfr4owU=; b=wSQ0pTr1AaR7Y4cL3fUK46uM6t1oGtS51GIg14a8cpDspIML2KjKVrCYstMMTuG1zS NFkI+4fPKrdz7FZLFcEGASH3zYHkJXeBdbJ2VDTPIr0JuUCBvzLj7IcEZtL1zCHMsr7x I7evc4T6ZtJyXM1ecGfLN9yKRe0ozXeQG8SsMSjQZHSLZHCQjWwPdzMXLQIHnwq5Okji G+Tkeu2dZUvVrDXE4tSa04B8dXmZqM31sYuFyhBlWKZArr2YddK54uc41oyGu/xJQVU9 k9eX1WXdjFMZTx0gCZ6h1yw3Q7MdNgzSXRV0fMbMRLvhws8PnDXcT5UlFvdlSHSSN92K 9CUw== X-Forwarded-Encrypted: i=1; AL+hErEmEzKh6P01RUbJ3pFrG80g3tkj38BynsDkJbMq8tvBmKVequ+sSYAX5BpyFAlW0NF/O5BQdzlyvthWK4k=@vger.kernel.org X-Gm-Message-State: APuU4Z9t63cGUHiO5UxnT8kJ8M+yWsP1OdxdDXns6gF7iGU9gO6k0uht Lty62DdT4Y/dFInjhoEl2XuRmQtt2c+BcLfyHYDv/B8zSd1EMev5/Nrolec8YtSSYz9L862QHb+ zfxoOwBw= X-Gm-Gg: AZFdTZd9af1t0fSfscOJ4538mKZcrT9vFeZIz/uooZ9K5m1vwydYG5g5THToXVCVSV5 FENRNf6v4eK7M8IOFzwtYqX5BoFqw2J+DCWX7R8f/FvZRQioikwNW6sSAvRudgNCSlHzNheM76b IXiOjdwRLRuYqRqYhfFf50U7heg2ft4gA4UNtfXvB8NHjQm8K8yH6ley9WCneJdmQR4aUWaLrs4 YS4BUjuZOIuc4HRYPCMNbwL5JnICwHL1TA5K+6ZjcfGqhYkZ/fFCgf+dDHGm1K3C2cf2XEhhaos mOBfNdVaXVIoAztRPzHfVyeBlvsTzkLllYu9Rsq6ur6WzxHsl+Xk4OxRAUWvIJXIBrjIs5nXGEF UvRuckw7qU5y7wFYHSI9mqGO8h0k1wAPibw7yKcIWdkjrjxWZ6YGPtbyLckQ7qF6IEejIXLSKVS uJF95b/M0DwtlrXJPzmn1OIYVtC3xac9CyU8Wlguggd+6PbtRbGwWOSnXSiG6yJCAcTHWteLWxF MPMI7yV0fthNDz6RhAQmxK98yYzWlPtj+OyfL6auFyfuDsXXGrosBCK1JGV+i8ID/8obmmhfCRo vsaBXpaaYODgPtzkNMn4LmP4z5TR9cMuedLvlIR85ekOUfGpmZZ8ha6v8VCgYzvfg1pytKNd008 Gpg== X-Received: by 2002:a05:622a:2592:b0:536:3fa7:2c39 with SMTP id d75a77b69052e-55d76a6e9cdmr545963341cf.20.1795960382559; Sun, 29 Nov 2026 05:53:02 -0800 (PST) Received: from Mac.mynetworksettings.com ([2600:4041:5c28:200:3c29:a645:a023:b4a7]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-9217c38f19csm120833956d6.26.2026.11.29.05.53.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 29 Nov 2026 05:53:02 -0800 (PST) From: Andrew Stellman To: Bernard Metzler Cc: Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH rdma-rc] RDMA/siw: Flush the ORQ when CLOSING or TERMINATE moves to ERROR Date: Sun, 29 Nov 2026 08:53:01 -0500 Message-ID: <20261129135301.80788-1-bugs@stellman-greene.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; -- 2.53.0