From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F013F182D6 for ; Sat, 27 Jun 2026 01:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782522402; cv=none; b=sx+AY+N9zuWifpKCusvbaK3VqkBitkChIph8jkm1gQLEw9nAt18ljf6PJEasR3d43PCgCAwma2Q63rXnqF8vYqRXNhRqLQFhMM+4qIRB6rOBFIoCen2lEwL0sLiw0EKo0gqP7flpPvY9yWnWW7ZUzRnuUbzWkUSCLzg1yXmg3mY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782522402; c=relaxed/simple; bh=vFEyTnysSdvZxqXt37fKujvwvG2EucQHpFyuZVEWEK8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eZuhSxHnpYG8tzzecpHxR0etEwN7OEcdjYt0OeW4tVtoOQDnHeXvO7zLyGhhpCEVaFg2ki9E6gg2ckpRD6RjL7NWnWTHCxe0DJ/jIQh7ojfEWC9NMb4iiGjdzEQHqIsGC94lo3DUJa189aCVkremOGoBiPQ+BICjFwI8lXGHc9M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mpxR3NB7; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mpxR3NB7" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-37d46e0d246so778760a91.2 for ; Fri, 26 Jun 2026 18:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782522400; x=1783127200; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=z/CmrupfxEbqvdymOr0KYrLCg1DOvL9/cDXxDowDgHc=; b=mpxR3NB7vPQqfuQlKKrcih0QMBQuvHiytaEmsGQ7RcjeSZ3Ir+p2Koufl6gbqK1SOa oO1oqPRDdNM1pZQua5UPYXX7zmEPMDFiOtqTECJF/dW5KWw6c77WOY31ZrLItJLazy5e WMvJS4LN3/hhaJS1NMu+G1r11of2J6agTY7nXN3AKpabBDp0pheudgjl1xf7WjZChHj+ ynvhWHWIJfE/XdBj/UU3rl2VKzUoxqwLcch9ppF+/PCEDuWdU+R63itvAPrfrdD/fjw3 EYdKbQgCw4NJ9QjuxboI680AGq2od32/YS+BZ/NThzlqySvU58P1bkyfu9UxoZV+Mg6M I2aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782522400; x=1783127200; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=z/CmrupfxEbqvdymOr0KYrLCg1DOvL9/cDXxDowDgHc=; b=leeWvdsYPpnpiRbcY8bWPBDf1Voujwkygas6GnHU1s7B3KLeL+Zm3gqdT51bulys77 ibhwEUfRpNy/oFXTAG2dpkVYfoV3buLFUZjmeAQ9Srx7QYpoHaf841r6+Eixynjl0iTg vQwvU7ekETE3hPAUToCbano7BJtyjqb+wDjw35Zqqqk4+6+Z8mje6u7PBa0EDLQC/2SC nHv7xSJsou8FF1OHPsdXDhch5W2TrHMw0VjArp4vgtAhPMT1vC048pZUzgwfxqh0WVFh EA+G3Sn2FnpEAuSFxGnTUtM9BQDNGw4AB4L6Scy3P9uz8l0lVHZKGfg5DlMcsffTSSpc uDQg== X-Forwarded-Encrypted: i=1; AHgh+RpzImSPwOb4vmO/EoOwfyaYc8l7iuCdtnnHa6FC01y9m8JWwQaZ3P33r4zC6a0va8Gi9EcnbvLMyln9vuk=@vger.kernel.org X-Gm-Message-State: AOJu0YwTnTf5RDmBbBpmOr2a+yBdxDBxjYEh90gkl3j0EgjqiQ5XlaC1 HHKLApJ/i8MReb/011lfMPBgfvDWqw4k1K9SGIDq6oUxGYsJBzEdkoLELoibj9HAZ9o= X-Gm-Gg: AfdE7cm+wGDkW9WqekpyutLUHJoJ64xUGnOquhOutWVkDR8XST+wZ/+I+BlegRT8Fwx y9Kyuhx0kzd1D9dEQm49A4H8+ClfIb99fH6fRyhnXFvEqKHRsS1Wt0lKVM4ooAAxFDhu42ZWGQe YXu8+akrJwK2lvHXYZDBgI1hJWmHbgY9N8cnv9AksWA9LyS6vfIelplsGL+qWq4gZin8szj5g3A HfsU72DSmlxaIxCkzaQnN2j8y8ycyfy8yTfUIsTKH6zMtiBkX+mlK3QpIJEI5NrmWbJp48955h+ qkfDdaXJAqsbdm860zyb7WsB5+A5J4LSXcfL5CNJij0sXcyFBpYQgfAT2uNUljJgx0ZG3ZWgewD bhaIoaSUw+Pjb+Kyjz27c9X2hscFkXmawStychs+IgZKq1mtcqdFEv1F/Uk7bmEUvf7psZNhhSy gEe64psh988XAw2IY= X-Received: by 2002:a17:90b:270b:b0:37d:edb2:830d with SMTP id 98e67ed59e1d1-37dfa1f3e14mr7957053a91.9.1782522400035; Fri, 26 Jun 2026 18:06:40 -0700 (PDT) Received: from n232-175-066.byted.org ([240e:83:200::354]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c7f63b27dasm48028825ad.45.2026.06.26.18.06.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 18:06:39 -0700 (PDT) From: guzebing To: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Guzebing Subject: [PATCH] nvme: make firmware activation poll interval configurable Date: Sat, 27 Jun 2026 09:06:10 +0800 Message-Id: <20260627010610.47768-1-guzebing1612@gmail.com> X-Mailer: git-send-email 2.20.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Guzebing nvme_fw_act_work() polls the controller processing-paused status every 100 ms while firmware activation is pending. Some devices can complete online activation in only a few hundred milliseconds, so the fixed interval can add noticeable latency before the driver observes completion. Add an nvme_core.fw_act_poll_interval_ms module parameter to make the poll interval tunable. Keep the default at 100 ms to preserve existing behavior, and accept values from 10 ms to 100 ms so systems that need faster completion detection can opt in to a shorter interval. Signed-off-by: Guzebing --- We recently observed this issue while performing online firmware updates for Gen5 NVMe SSDs in a production environment. During firmware activation, the kernel quiesces I/O. Detecting the end of firmware activation earlier lets the driver unquiesce I/O earlier, which is important for the long-tail I/O latency of production workloads. Operation steps: nvme fw-download /dev/nvme13n1 \ -f ./Inventec_G238B_NVME_LDD5902Q_MZWL61T9HFLT-00B07.bin nvme fw-commit /dev/nvme13n1 -s 0 -a 3 nvme fw-log /dev/nvme13n1 Operation device: Samsung PM9D3a Gen5 NVMe SSD, model MZWL67T6HBLC-00B07 Firmware update: LDD5702Q -> LDD5902Q Operation results: 100 ms polling interval: 3 polls, 311 ms 10 ms polling interval: 24 polls, 266 ms drivers/nvme/host/core.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 3b7a8f7a35426..784da06fee559 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -58,6 +58,21 @@ module_param_named(io_timeout, nvme_io_timeout, uint, 0644); MODULE_PARM_DESC(io_timeout, "timeout in seconds for I/O"); EXPORT_SYMBOL_GPL(nvme_io_timeout); +#define NVME_FW_ACT_POLL_INTERVAL_MIN_MS 10 +#define NVME_FW_ACT_POLL_INTERVAL_MAX_MS 100 +static int fw_act_poll_interval_ms_set(const char *val, + const struct kernel_param *kp); +static const struct kernel_param_ops fw_act_poll_interval_ms_ops = { + .set = fw_act_poll_interval_ms_set, + .get = param_get_uint, +}; + +static unsigned int fw_act_poll_interval_ms = 100; +module_param_cb(fw_act_poll_interval_ms, &fw_act_poll_interval_ms_ops, + &fw_act_poll_interval_ms, 0644); +MODULE_PARM_DESC(fw_act_poll_interval_ms, + "firmware activation polling interval in ms (10-100)"); + static unsigned char shutdown_timeout = 5; module_param(shutdown_timeout, byte, 0644); MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown"); @@ -106,6 +121,13 @@ module_param(disable_pi_offsets, bool, 0444); MODULE_PARM_DESC(disable_pi_offsets, "disable protection information if it has an offset"); +static int fw_act_poll_interval_ms_set(const char *val, + const struct kernel_param *kp) +{ + return param_set_uint_minmax(val, kp, NVME_FW_ACT_POLL_INTERVAL_MIN_MS, + NVME_FW_ACT_POLL_INTERVAL_MAX_MS); +} + /* * nvme_wq - hosts nvme related works that are not reset or delete * nvme_reset_wq - hosts nvme reset works @@ -4798,7 +4820,7 @@ static void nvme_fw_act_work(struct work_struct *work) nvme_try_sched_reset(ctrl); return; } - msleep(100); + msleep(READ_ONCE(fw_act_poll_interval_ms)); } if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) || -- 2.20.1