From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52029C55AB9 for ; Fri, 20 Feb 2026 12:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:content-type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=U8Jmm8NgKrq2V1FxKcC5M0vL+Dt9VEgp3yZspO9J36Y=; b=OlVwZKHfMnbJmLa+5kFhuppUI0 AuIw1zIdz254r51R9DOnHOKdKoUzksUHMHlRuUEB7hH0SV4jZYte2SN9ICRdVYePnt5CsY/otwWxT FJ57mGlQ4T33zGNerL6jauN+5sEZXDMb+lN8SMDm0tEplIm2ghQJYr5lqkwQ0IVqhPHFfdwV8yeeD jPYVZwrjzMlqAz6BkW/AuPsulkgE0fqWsyIz+fcOE7YjigCi3cnqcsWrTusrlDV4uuvN1wXueSSMt kaqk56RZIYOQ5yhGrPUMxohdCxe6E+j8NM1LdDAgXBeMIN9U2HkQRGpiNZpF/fZ9jLmmoQ0HO7xkK XtULEyOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vtPyu-0000000EVKo-2wHN; Fri, 20 Feb 2026 12:51:40 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vtPyr-0000000EVHc-2LpP for linux-nvme@lists.infradead.org; Fri, 20 Feb 2026 12:51:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771591896; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U8Jmm8NgKrq2V1FxKcC5M0vL+Dt9VEgp3yZspO9J36Y=; b=Rj7yeTKYFjeJwsl+KDpqghQVPgBgqKbu7vjd1LUH+cQ3m1Q5psl7Ogh2jSx3nPBqSh26n7 Wtr/2ah1ev85VQVTl8xE4RtKB2j7jlhJ+mFbF2lPhowLQCU8iSKH3A2mMBHc0VUoxwGROW B+8CETF1+G4MmZO2/AsrHnAyP/BGFf8= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-9-IvtHKtvcO3mxA0exNKlH6g-1; Fri, 20 Feb 2026 07:51:33 -0500 X-MC-Unique: IvtHKtvcO3mxA0exNKlH6g-1 X-Mimecast-MFC-AGG-ID: IvtHKtvcO3mxA0exNKlH6g_1771591892 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 655DE180049D; Fri, 20 Feb 2026 12:51:32 +0000 (UTC) Received: from mlombard-thinkpadt14gen4.rmtit.csb (unknown [10.45.224.125]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 97F471800352; Fri, 20 Feb 2026 12:51:29 +0000 (UTC) From: Maurizio Lombardi To: kbusch@kernel.org Cc: mheyne@amazon.de, emilne@redhat.com, jmeneghi@redhat.com, linux-nvme@lists.infradead.org, dwagner@suse.de, mlombard@arkamax.eu, mkhalfella@purestorage.com Subject: [PATCH V2 5/5] nvme: use per controller timeout waits over depending on global default Date: Fri, 20 Feb 2026 13:51:08 +0100 Message-ID: <20260220125108.483250-6-mlombard@redhat.com> In-Reply-To: <20260220125108.483250-1-mlombard@redhat.com> References: <20260220125108.483250-1-mlombard@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: OV-2MpeIBaf_v3ghfEgoNtvlTHedFQsJ_6_M4HmLr9o_1771591892 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260220_045137_674582_C0B447E2 X-CRM114-Status: GOOD ( 12.03 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org Instead of passing NVME_IO_TIMEOUT as a parameter with every call to nvme_wait_freeze_timeout, use the controller's preferred timeout. Reviewed-by: Mohamed Khalfella Signed-off-by: Maurizio Lombardi --- drivers/nvme/host/apple.c | 2 +- drivers/nvme/host/core.c | 5 +++-- drivers/nvme/host/nvme.h | 2 +- drivers/nvme/host/pci.c | 2 +- drivers/nvme/host/rdma.c | 2 +- drivers/nvme/host/tcp.c | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c index ed61b97fde59..1958f39484d9 100644 --- a/drivers/nvme/host/apple.c +++ b/drivers/nvme/host/apple.c @@ -858,7 +858,7 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown) * doing a safe shutdown. */ if (!dead && shutdown && freeze) - nvme_wait_freeze_timeout(&anv->ctrl, NVME_IO_TIMEOUT); + nvme_wait_freeze_timeout(&anv->ctrl); nvme_quiesce_io_queues(&anv->ctrl); diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index af0710c031e7..fbe47f9123ca 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -5216,8 +5216,9 @@ void nvme_unfreeze(struct nvme_ctrl *ctrl) } EXPORT_SYMBOL_GPL(nvme_unfreeze); -int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) +int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl) { + unsigned long timeout = ctrl->io_timeout; struct nvme_ns *ns; int srcu_idx; @@ -5225,7 +5226,7 @@ int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) list_for_each_entry_srcu(ns, &ctrl->namespaces, list, srcu_read_lock_held(&ctrl->srcu)) { timeout = blk_mq_freeze_queue_wait_timeout(ns->queue, timeout); - if (timeout <= 0) + if (!timeout) break; } srcu_read_unlock(&ctrl->srcu, srcu_idx); diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index ef390a020d8d..c59228895bf0 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -840,7 +840,7 @@ void nvme_sync_queues(struct nvme_ctrl *ctrl); void nvme_sync_io_queues(struct nvme_ctrl *ctrl); void nvme_unfreeze(struct nvme_ctrl *ctrl); void nvme_wait_freeze(struct nvme_ctrl *ctrl); -int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); +int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl); void nvme_start_freeze(struct nvme_ctrl *ctrl); static inline enum req_op nvme_req_op(struct nvme_command *cmd) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 2bceedadded2..290d6c748ac0 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3111,7 +3111,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) * if doing a safe shutdown. */ if (!dead && shutdown) - nvme_wait_freeze_timeout(&dev->ctrl, NVME_IO_TIMEOUT); + nvme_wait_freeze_timeout(&dev->ctrl); } nvme_quiesce_io_queues(&dev->ctrl); diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 35c0822edb2d..c8859367ffff 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -888,7 +888,7 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) if (!new) { nvme_start_freeze(&ctrl->ctrl); nvme_unquiesce_io_queues(&ctrl->ctrl); - if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) { + if (!nvme_wait_freeze_timeout(&ctrl->ctrl)) { /* * If we timed out waiting for freeze we are likely to * be stuck. Fail the controller initialization just diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 69cb04406b47..0f78fa8f1cbc 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2193,7 +2193,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) if (!new) { nvme_start_freeze(ctrl); nvme_unquiesce_io_queues(ctrl); - if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) { + if (!nvme_wait_freeze_timeout(ctrl)) { /* * If we timed out waiting for freeze we are likely to * be stuck. Fail the controller initialization just -- 2.53.0