From patchwork Fri Jun 21 15:44:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 1950868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W5MBW6F9Nz1ydW for ; Sat, 22 Jun 2024 01:45:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sKgRz-0007QO-85; Fri, 21 Jun 2024 15:45:19 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sKgRx-0007Ot-Js for kernel-team@lists.ubuntu.com; Fri, 21 Jun 2024 15:45:17 +0000 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id B72A13FE1F for ; Fri, 21 Jun 2024 15:45:16 +0000 (UTC) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57d34e190d9so310190a12.2 for ; Fri, 21 Jun 2024 08:45:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718984712; x=1719589512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lmj228HxG+FJ6GqqmHZmKPmRmTWlfDLE/4SooBqR+wc=; b=jt8vodVrNEWbgdVuVLdk83HdWxB6c4WUqKX+up9mqjjiMTVEkA4JIQhVo9gCwMDyNA c59JULTVHwTynGuubIbaV15XUB2E1S77NJ1cAL5iH1rwntKKJoRRLvLltB21dcrstPHT isTIuz98hVR2gfNFCsYh+TOBTmqrKwJHp/FEvnvC5GBiQiIN7RmuLmNLicFrIRVyubC9 8yNL8/mZtjc5uCLcQOsEJos+IA1qVfHtigkNlT3mLYGYmQPQbhhdP4WCq8zdpseUqCF2 UAXFEq3f0kANTw6BQXxJOQf9B6f1OmTFkFLAZOvsui4cKi92Wyuwf6fYWZRiSbqnqjUr W4fQ== X-Gm-Message-State: AOJu0YxtybYdkUZSQtLM8IQ/3Okx19bq+b4v/G0hSz5bL+I1lrtjikLr pMYzjQdkmHtTU4g4Z++WbRgGxRGAx5yXGh6GavRkNUEOIn5DmcAH8OjgMppeCtrF2M60/BDECbM QkwhxeLRWcxIUlRCQV/2HGtx2VBFLIBTyT/fq5FdRABgDxNUOCMEQ6xoMoPwCodzRhOKJQ3InXp rgDtsBXDPARw== X-Received: by 2002:a17:906:81ca:b0:a6f:5eec:37d1 with SMTP id a640c23a62f3a-a6fab779166mr600087766b.62.1718984712494; Fri, 21 Jun 2024 08:45:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGujDhbwuSFBXSTYMayOX/ecxXqPzc+OxNgEy6+QM7M7Qyz03okwU9WsNHxg4pLohDh8wsXmg== X-Received: by 2002:a17:906:81ca:b0:a6f:5eec:37d1 with SMTP id a640c23a62f3a-a6fab779166mr600086966b.62.1718984712204; Fri, 21 Jun 2024 08:45:12 -0700 (PDT) Received: from amikhalitsyn.lan ([91.64.91.101]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6fcf56ef19sm96223266b.210.2024.06.21.08.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 08:45:11 -0700 (PDT) From: Alexander Mikhalitsyn To: kernel-team@lists.ubuntu.com Subject: [Oracular/Unstable][PATCH 4/4] UBUNTU: SAUCE: nvme-tcp: add recovery_delay to sysfs Date: Fri, 21 Jun 2024 17:44:42 +0200 Message-Id: <20240621154442.2004665-5-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240621154442.2004665-1-aleksandr.mikhalitsyn@canonical.com> References: <20240621154442.2004665-1-aleksandr.mikhalitsyn@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Daniel Wagner Allow userland to set the recovery delay value. Signed-off-by: Daniel Wagner Signed-off-by: Alexander Mikhalitsyn Tested-by: Julian Pelizäus --- drivers/nvme/host/fabrics.c | 13 +++++++++++++ drivers/nvme/host/fabrics.h | 3 +++ drivers/nvme/host/tcp.c | 6 +++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index ceb9c0ed3120..73ba3e1877c2 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -692,6 +692,7 @@ static const match_table_t opt_tokens = { #ifdef CONFIG_NVME_TCP_TLS { NVMF_OPT_TLS, "tls" }, #endif + { NVMF_OPT_RECOVERY_DELAY, "recovery_delay=%d" }, { NVMF_OPT_ERR, NULL } }; @@ -1038,6 +1039,18 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, } opts->tls = true; break; + case NVMF_OPT_RECOVERY_DELAY: + if (match_int(args, &token)) { + ret = -EINVAL; + goto out; + } + if (token <= 0) { + pr_err("Invalid recovery_delay %d\n", token); + ret = -EINVAL; + goto out; + } + opts->recovery_delay = token; + break; default: pr_warn("unknown parameter or missing value '%s' in ctrl creation request\n", p); diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h index 602135910ae9..1ac5a662dbba 100644 --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h @@ -66,6 +66,7 @@ enum { NVMF_OPT_TLS = 1 << 25, NVMF_OPT_KEYRING = 1 << 26, NVMF_OPT_TLS_KEY = 1 << 27, + NVMF_OPT_RECOVERY_DELAY = 1 << 28, }; /** @@ -92,6 +93,7 @@ enum { * @queue_size: Number of IO queue elements. * @nr_io_queues: Number of controller IO queues that will be established. * @reconnect_delay: Time between two consecutive reconnect attempts. + * @recovery_delay: Time before error recovery starts after error detection. * @discovery_nqn: indicates if the subsysnqn is the well-known discovery NQN. * @kato: Keep-alive timeout. * @host: Virtual NVMe host, contains the NQN and Host ID. @@ -121,6 +123,7 @@ struct nvmf_ctrl_options { size_t queue_size; unsigned int nr_io_queues; unsigned int reconnect_delay; + unsigned int recovery_delay; bool discovery_nqn; bool duplicate_connect; unsigned int kato; diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 35db9de22939..e0bfcbbc43ac 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -578,11 +578,15 @@ static void nvme_tcp_init_recv_ctx(struct nvme_tcp_queue *queue) */ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl) { - unsigned long delay = nvme_keep_alive_work_period(ctrl); + unsigned long delay; if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) return; + delay = ctrl->opts->recovery_delay * HZ; + if (!delay) + delay = nvme_keep_alive_work_period(ctrl); + dev_warn(ctrl->device, "starting error recovery in %lu seconds\n", delay / HZ); queue_delayed_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work, delay);