Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp172257lqo; Tue, 7 May 2024 16:34:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDTjXetuhavGbbsOWA+jen/Juf1w8B5ZYhQ61YdqlahUl1K5ppasbXIua/mnP7V2MUUeAATchb4yHFL8SiQfCBjho8+fp3ofHwRE7GyA== X-Google-Smtp-Source: AGHT+IGOY/0dwASx0XTtY5rVWp/EsdtUaQjOmJwvZ/UxiWWxzhlsmjuzE5Z+uIr7+fG8QK/cDvSt X-Received: by 2002:ac2:42c1:0:b0:51d:1d32:c676 with SMTP id 2adb3069b0e04-5217c760719mr678136e87.37.1715124893393; Tue, 07 May 2024 16:34:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715124893; cv=pass; d=google.com; s=arc-20160816; b=DTYS6hmHsQQTTj8NyvKHp2VMWeXTqj4YS5cpdImeUBgz4wNlJwPmnusH1hRMBUhOpr 221gcbHzY+/Vt6eUZMwZwcqnCwc0p9T3XTyb2uk0mWeizQ2fKpiwjeuC6FtmNY4IqZpj MN3Q7GlJUnnnas0TVbc/wUmRLFMW8FIbWKviNcNY/y5AA6sGn4q9xrQ9PMttNk4J1W2s U3IggphFThCWVKp5VFpRESKEvBqc4RnhEszg8YXFbvNXD3Kot1R/Tz8Ld8IrBLTcUlEO Rd0kSAcoN/W7A557TOoQwbP2OFLmSia2fraqRXDQyTvNrmg3x96VW3dy2b/D/IHav773 8P1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1sv/bXg1ouqgC+DNAP3svGNCkJrurFoxOrDxvpdJEY4=; fh=sAEVA19l5j7U0vM/OzxEFt5KmKP8CJPZMqzCcGdm0p4=; b=lig4V/qHCjmxnYQ/l8YVZZWi5OmS2+cpLB+DJTNj/zC2JcDNgPkxT1nxukE0GlR6ls AOnUw65qKP3jdocbrvJPWkK2VchHs4eLr04KsKlCR3JtTCVVIM6NBGbP3HmOAaTE4DMd VHBy7eu9ih78GPk9ZKwt0QzQyI2+drmiHDW/XK/Ug357EOZ3wTUZstc6qvGVg/XG1Hkv zNUTT9BQo4vj/NcKbef9ecld62/xpx5msu/+UYdr+woxj6KhAnKrPcqgwt7B4wztZf9O IQa4jCw/78K5ESGOmbTwsZnwZpYHwbmDjULHWATIMfsNyALm7mWYpfKMBjHH+xTbfEES jDoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eBdHeOPp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lf10-20020a170906ae4a00b00a59ab50d0e8si4561417ejb.796.2024.05.07.16.34.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:34:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eBdHeOPp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 218A81F23336 for ; Tue, 7 May 2024 23:34:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C1AE78269; Tue, 7 May 2024 23:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eBdHeOPp" 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 AD84F147C9A; Tue, 7 May 2024 23:10:01 +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=1715123401; cv=none; b=l4WQo/b9MWac5PMqasYY13QOq8bIBNJkm7YK2YmIuORZxnNKmN56DXTM0Bpf6R6oBgGKaUKPRTK6UQNnE5YtFo3AML3oAk/86VimJslKivPCqmioY0zWylaRdsfJaFzUfHwg+Nlny995NwhHI5JB7gH+/hKCor8g5U7SSijEuOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123401; c=relaxed/simple; bh=eo1c5Avq+ijbEULoGJKldihoAOoaAEFxOcxVHPr11w0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BNFzFNeCxLAzWx/M9qBnSIwA0LciWg7nwEMcWVa9WM7+lD54UX9UDOGSKEVsxma1L38oFqDPBrr7c6rmff6hF/u2Vy53cMXAGEqc+LLjM37QKVutP9dKTlTiAJI59Ulfyhm2okIYcYiOg29ffukKFrz7iFEfrvRSbRE2DpEwlyw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eBdHeOPp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4A46C4AF17; Tue, 7 May 2024 23:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123401; bh=eo1c5Avq+ijbEULoGJKldihoAOoaAEFxOcxVHPr11w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eBdHeOPpT+Zf6ZyyvqF/BOykw7hJomq4KZ00JQVGUazh2/i0SpWFCqLP5OWZfZeuj UiYtkOp3/GP1+ywWtkWc+lzJU5qcvT89fLr2tNC+SNdeDjLqjZpNrPn49m9N+h6Sb9 O+VlEIu3k0dzT1QUDucED/dW4gTyfG3cFVZtssfN4/3M5/3RpljRlRKDphVi5tZfEL GlVjzYSFTdzx5NMjkwnAWlR+zkHcEt0wUkhngH0n2wrLJTtAb8uc/LX97lIWN9fFvz KU+6NCsyeNi6Y8bIuj7KJ4QemGqbK04DiZ93S0oT6lJ3tfnoI1FxYiF2qAG5sLI7Up 59F4N+8DsrNJg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hannes Reinecke , Sagi Grimberg , Keith Busch , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 6.8 51/52] nvme-tcp: strict pdu pacing to avoid send stalls on TLS Date: Tue, 7 May 2024 19:07:17 -0400 Message-ID: <20240507230800.392128-51-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507230800.392128-1-sashal@kernel.org> References: <20240507230800.392128-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.9 Content-Transfer-Encoding: 8bit From: Hannes Reinecke [ Upstream commit 50abcc179e0c9ca667feb223b26ea406d5c4c556 ] TLS requires a strict pdu pacing via MSG_EOR to signal the end of a record and subsequent encryption. If we do not set MSG_EOR at the end of a sequence the record won't be closed, encryption doesn't start, and we end up with a send stall as the message will never be passed on to the TCP layer. So do not check for the queue status when TLS is enabled but rather make the MSG_MORE setting dependent on the current request only. Signed-off-by: Hannes Reinecke Reviewed-by: Sagi Grimberg Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/tcp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index a6d596e056021..6eeb96578d1b4 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -352,12 +352,18 @@ static inline void nvme_tcp_send_all(struct nvme_tcp_queue *queue) } while (ret > 0); } -static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) +static inline bool nvme_tcp_queue_has_pending(struct nvme_tcp_queue *queue) { return !list_empty(&queue->send_list) || !llist_empty(&queue->req_list); } +static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) +{ + return !nvme_tcp_tls(&queue->ctrl->ctrl) && + nvme_tcp_queue_has_pending(queue); +} + static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, bool sync, bool last) { @@ -378,7 +384,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, mutex_unlock(&queue->send_mutex); } - if (last && nvme_tcp_queue_more(queue)) + if (last && nvme_tcp_queue_has_pending(queue)) queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); } -- 2.43.0