From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D55F2EA730; Thu, 3 Jul 2025 14:59:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751554740; cv=none; b=uX5HyH04zisgVAR9gg4KRYKgUWroni5104v8rskRXkp6Azr9nOMXyK3bWkmNPQ3z+W21uWvB3UFwj14eFLgYOycW+fESMCnjaFP1yB5grAq9KFVWGje1ObxYMcwfzb+NzVCILYHPZ5TgkQza//Z13Frs1Yqp5DtZZhltJrX2RcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751554740; c=relaxed/simple; bh=v4fQIofaMohXzAqqcQgCBPe8l4uPqonybAMojSPjwww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sI1tI4IAJ9dQWPfhyKnj8DkLmfKWEILod92clSOwfX3I/+WvV48Hkjxvq6F9ujCa3laP0/UDJ2NIny//llWMRoapAS2tsDhZCWJRXH9SXkeCObwywy6NHrXqGU+1rpJFYeLqaOrlu9seEkR359jwRLXYFqaQR2GuPCt9kNrutO4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UjIx/cuf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UjIx/cuf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92958C4CEE3; Thu, 3 Jul 2025 14:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751554739; bh=v4fQIofaMohXzAqqcQgCBPe8l4uPqonybAMojSPjwww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UjIx/cufbbW8S3GGoxActLSw9/tLN1nFypDprgO3Ukvztc8pU5BnI6jpkaqxEVGQs FcoWunl93XJ/vG9osxjLVpRtCA/F/9lLxu/VFduzRfNg+mi9AwfeYGNJf7aJWy6o9e lB7i8xc7LVLzt9PSjp/fRe6tof9Q1wEzy4y4hDoQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hannes Reinecke , Chris Leech , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 6.15 033/263] nvme-tcp: fix I/O stalls on congested sockets Date: Thu, 3 Jul 2025 16:39:13 +0200 Message-ID: <20250703144005.625740301@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250703144004.276210867@linuxfoundation.org> References: <20250703144004.276210867@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hannes Reinecke [ Upstream commit f42d4796ee100fade86086d1cf98537fb4d326c8 ] When the socket is busy processing nvme_tcp_try_recv() might return -EAGAIN, but this doesn't automatically imply that the sending side is blocked, too. So check if there are pending requests once nvme_tcp_try_recv() returns -EAGAIN and continue with the sending loop to avoid I/O stalls. Signed-off-by: Hannes Reinecke Acked-by: Chris Leech Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/tcp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 947fac9128b30..9f4f6464dee04 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1348,7 +1348,7 @@ static int nvme_tcp_try_recv(struct nvme_tcp_queue *queue) queue->nr_cqe = 0; consumed = sock->ops->read_sock(sk, &rd_desc, nvme_tcp_recv_skb); release_sock(sk); - return consumed; + return consumed == -EAGAIN ? 0 : consumed; } static void nvme_tcp_io_work(struct work_struct *w) @@ -1376,6 +1376,11 @@ static void nvme_tcp_io_work(struct work_struct *w) else if (unlikely(result < 0)) return; + /* did we get some space after spending time in recv? */ + if (nvme_tcp_queue_has_pending(queue) && + sk_stream_is_writeable(queue->sock->sk)) + pending = true; + if (!pending || !queue->rd_enabled) return; -- 2.39.5