From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bsdbackstore.eu (128-116-240-228.dyn.eolo.it [128.116.240.228]) (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 C527A20C00C for ; Fri, 12 Dec 2025 14:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=128.116.240.228 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765550781; cv=none; b=IttylpOe0jHsGp7leg24Nr0yD2BzWXwMaBE6YguvxlDBj/OOY8uCWalOVI3SGmnuaBRWrh2nCchIifsU9B+Um/k0vw7r42WsdmVqSI9N1zlaA/hyqcz1qYuu1/smJb2P7/VK2owkCuQFK367LqQZYHfMEoBwQ7Bc/qzPmU/jzXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765550781; c=relaxed/simple; bh=tsLcQayfg4+SXj6znWEI6gYz1FQU0gcOExn2urZ+JsU=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=AXvt+lS7PRbJXRtxara5w4bGZDpnoq7YPR1XpEutSW9APZif0D2RO68grA6UGuAR+j2hgekxWmO2v32JvG5ZkTa/LMHU6AZrxXPCTVVEjU9BVmtiwmypA3MmFg5n5f6hV98uCBur9mYIjUmmU9fHwwpL2eK44PQtblmBR3Y0jTo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bsdbackstore.eu; spf=pass smtp.mailfrom=bsdbackstore.eu; arc=none smtp.client-ip=128.116.240.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bsdbackstore.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bsdbackstore.eu Received: from localhost ( [192.168.3.39]) by bsdbackstore.eu (OpenSMTPD) with ESMTPSA id 1ab4d11f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 12 Dec 2025 15:39:34 +0100 (CET) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 12 Dec 2025 15:39:34 +0100 Message-Id: Cc: "Jens Axboe" , "Christoph Hellwig" , "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] nvme: Let the blocklayer set timeouts for requests From: "Maurizio Lombardi" To: "Sagi Grimberg" , "Heyne, Maximilian" , "Keith Busch" X-Mailer: aerc References: <20251204-tests-bryce-8b3b2823@mheyne-amazon> <20251204-pause-lima-29ecb942@mheyne-amazon> <20251205-myopia-been-ed739f86@mheyne-amazon> <1b396ea8-8256-48bf-bee2-92e500f3ef80@grimberg.me> In-Reply-To: <1b396ea8-8256-48bf-bee2-92e500f3ef80@grimberg.me> On Fri Dec 12, 2025 at 2:43 PM CET, Sagi Grimberg wrote: > > Perhaps you can simply add admin_timeout sysfs file for the controller=20 > that would alter > the set->timeout and take the value from there in nvme_init_request Curiously, this is something I was looking at recently. Could it be done by calling blk_queue_rq_timeout() in sysfs and removing "req->timeout =3D NVME_ADMIN_TIMEOUT;" from nvme_init_request() ? >From 1a36c2fcafc2502298d25da64cf3740721560f30 Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Tue, 11 Nov 2025 09:13:58 +0100 Subject: [PATCH] nvme: add sysfs attribute to change admin timeout per nvme controller Currently, there is no method to adjust the timeout values on a per controller basis with nvme admin queues. Add an admin_timeout attribute to nvme so that different nvme controllers which may have different timeout requirements can have custom admin timeouts set. Signed-off-by: Maurizio Lombardi --- drivers/nvme/host/sysfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c index 29430949ce2f..da83b13d2cdd 100644 --- a/drivers/nvme/host/sysfs.c +++ b/drivers/nvme/host/sysfs.c @@ -601,6 +601,36 @@ static ssize_t dctype_show(struct device *dev, } static DEVICE_ATTR_RO(dctype); +static ssize_t nvme_admin_timeout_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct nvme_ctrl *ctrl =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%u\n", + jiffies_to_msecs(ctrl->admin_q->rq_timeout) / 1000); +} + +static ssize_t nvme_admin_timeout_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct nvme_ctrl *ctrl =3D dev_get_drvdata(dev); + u16 timeout; + int err; + + err =3D kstrtou16(buf, 10, &timeout); + if (err || !timeout) + return -EINVAL; + + blk_queue_rq_timeout(ctrl->admin_q, secs_to_jiffies(timeout)); + + return count; +} + +static struct device_attribute dev_attr_admin_timeout =3D \ + __ATTR(admin_timeout, S_IRUGO | S_IWUSR, \ + nvme_admin_timeout_show, nvme_admin_timeout_store); + #ifdef CONFIG_NVME_HOST_AUTH static ssize_t nvme_ctrl_dhchap_secret_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -742,6 +772,7 @@ static struct attribute *nvme_dev_attrs[] =3D { &dev_attr_kato.attr, &dev_attr_cntrltype.attr, &dev_attr_dctype.attr, + &dev_attr_admin_timeout.attr, #ifdef CONFIG_NVME_HOST_AUTH &dev_attr_dhchap_secret.attr, &dev_attr_dhchap_ctrl_secret.attr, -- 2.47.3