mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Bommarito <michael.bommarito@gmail.com>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] nvme: log when APST skips a state due to latency cap
Date: Sat, 23 May 2026 07:45:52 -0400	[thread overview]
Message-ID: <20260523114552.101452-1-michael.bommarito@gmail.com> (raw)

nvme_configure_apst() silently skips any non-operational power state
whose exit_lat exceeds ctrl->ps_max_latency_us (set from the
default_ps_max_latency_us module parameter, default 100,000 us).

When the kernel skips a drive's deepest non-op state for this reason,
the user gets no signal that anything happened.  This is a frequent
gotcha on Intel platforms that depend on the drive reaching its
deepest power state to allow the PCIe root port to enter L1.x and the
PCH Southport to power-gate, which in turn is a prerequisite for the
platform reaching S0ix during s2idle suspend.

Add a dev_info_once() at the skip site that names the state, prints
the actual exit_lat versus the current cap, and points the user at
the module parameter to raise it.  Using _once keeps the line to a
single instance per controller; users that want to see every probe
event can still enable dev_dbg.

Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Mike Bommarito <michael.bommarito@gmail.com>
---
Build- and boot-tested on Framework Laptop 13 (Intel Core Ultra 5 125H)
running Linux 7.1-rc4 with this patch applied, across multiple boots
over three days.  No regressions observed in NVMe probe or APST
configuration with the installed WD Black SN850X (15b7:5030).

Design context: the conservative default cap and the per-device-quirk
mitigation were discussed in 2017 at

    https://lore.kernel.org/all/20170606095454.GA13569@infradead.org/

and retained.  This patch only adds observability for the silent-skip
case; behavior is unchanged.

 drivers/nvme/host/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c3032d6ad6b1..220e844e852c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2943,8 +2943,13 @@ static int nvme_configure_apst(struct nvme_ctrl *ctrl)
 			continue;
 
 		exit_latency_us = (u64)le32_to_cpu(ctrl->psd[state].exit_lat);
-		if (exit_latency_us > ctrl->ps_max_latency_us)
+		if (exit_latency_us > ctrl->ps_max_latency_us) {
+			dev_info_once(ctrl->device,
+				      "APST: skipping non-op PS%d (exit_lat %llu us > cap %llu us); raise nvme_core.default_ps_max_latency_us to enable\n",
+				      state, exit_latency_us,
+				      ctrl->ps_max_latency_us);
 			continue;
+		}
 
 		total_latency_us = exit_latency_us +
 			le32_to_cpu(ctrl->psd[state].entry_lat);
-- 
2.53.0


             reply	other threads:[~2026-05-23 11:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23 11:45 Mike Bommarito [this message]
2026-05-25  5:59 ` Christoph Hellwig
2026-05-25  9:24   ` Michael Bommarito
2026-05-26 13:47 ` Keith Busch
2026-05-26 13:53   ` Michael Bommarito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260523114552.101452-1-michael.bommarito@gmail.com \
    --to=michael.bommarito@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome