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 74F9A126BFF; Thu, 3 Jul 2025 14:46:53 +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=1751554013; cv=none; b=tDiVzMpRSEsgDEGEf3Ap6jTXdUBi5G1i6I6vMqG1B6P0mxTpg+GBGiUAf2Gm1e6DMYs6Z9jc6aQ11hYwTR7leiZypqiodeQ/FNVkf3ol1p7xIBYzAOaGaHAWQF/3k5HsNHG70Aab6ViRDRcM2a0wJypUn+el1tatJHPufe2m0RM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751554013; c=relaxed/simple; bh=Uxjpmhq2KWjblnDYGOR6Fuclf5nF1bHy0W9wDVV4T/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WldUJYB4/dJAcJeL4T07xAm6ecziE8IsgvH5c3J0vp2PuEzePLebro8cmIhJUZQHsGqnO2CeKC95ANWN8E1zZYQ6bf9hfg5ppAIW4spQHwEQqlRAPtYwpQieeC0sw1cpnePensapfUW2bs1FYEQrJB2E21fkrB8t2rbKDjm3Z80= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f2+U7znf; 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="f2+U7znf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D10B9C4CEED; Thu, 3 Jul 2025 14:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751554013; bh=Uxjpmhq2KWjblnDYGOR6Fuclf5nF1bHy0W9wDVV4T/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2+U7znfV8fp8cGWpR9rVwVtu1tFW7hSrkrxGOpiLph2V9enmrbO7mAqHHjnu9g44 IkZVL9oFjcvVPaoqrgxiyXyKICWWoQwp/sf5dssO/C0U/bDlihT7SLsoi/guGwgkmP pstzURZItZIFjbilaaJgwjFwfmUx+hikn10lXw6Q= 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.12 026/218] nvme-tcp: fix I/O stalls on congested sockets Date: Thu, 3 Jul 2025 16:39:34 +0200 Message-ID: <20250703143957.009582788@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250703143955.956569535@linuxfoundation.org> References: <20250703143955.956569535@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.12-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 4cc72be28c731..13ede6e309092 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1349,7 +1349,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) @@ -1377,6 +1377,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