All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Check for readiness more quickly, to speed up boot time
@ 2020-02-29  2:52 ` Josh Triplett
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Triplett @ 2020-02-29  2:52 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
  Cc: linux-nvme, linux-kernel

After initialization, nvme_wait_ready checks for readiness every 100ms,
even though the drive may be ready far sooner than that. This delays
system boot by hundreds of milliseconds. Reduce the delay, checking for
readiness every millisecond instead.

Boot-time tests on an AWS c5.12xlarge:

Before:
[    0.546936] initcall nvme_init+0x0/0x5b returned 0 after 37 usecs
...
[    0.764178] nvme nvme0: 2/0/0 default/read/poll queues
[    0.768424]  nvme0n1: p1
[    0.774132] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Opts: (null)
[    0.774146] VFS: Mounted root (ext4 filesystem) on device 259:1.
...
[    0.788141] Run /sbin/init as init process

After:
[    0.537088] initcall nvme_init+0x0/0x5b returned 0 after 37 usecs
...
[    0.543457] nvme nvme0: 2/0/0 default/read/poll queues
[    0.548473]  nvme0n1: p1
[    0.554339] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Opts: (null)
[    0.554344] VFS: Mounted root (ext4 filesystem) on device 259:1.
...
[    0.567931] Run /sbin/init as init process

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index a4d8c90ee7cc..04174a40b9b0 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2074,7 +2074,7 @@ static int nvme_wait_ready(struct nvme_ctrl *ctrl, u64 cap, bool enabled)
 		if ((csts & NVME_CSTS_RDY) == bit)
 			break;
 
-		msleep(100);
+		usleep_range(1000, 2000);
 		if (fatal_signal_pending(current))
 			return -EINTR;
 		if (time_after(jiffies, timeout)) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-03-03 20:20 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-29  2:52 [PATCH] nvme: Check for readiness more quickly, to speed up boot time Josh Triplett
2020-02-29  2:52 ` Josh Triplett
2020-03-01  2:01 ` Chaitanya Kulkarni
2020-03-01  2:01   ` Chaitanya Kulkarni
2020-03-01  9:02   ` Josh Triplett
2020-03-01  9:02     ` Josh Triplett
2020-03-01 18:32 ` Keith Busch
2020-03-01 18:32   ` Keith Busch
2020-03-01 19:15   ` Josh Triplett
2020-03-01 19:15     ` Josh Triplett
2020-03-02 14:53     ` Keith Busch
2020-03-02 14:53       ` Keith Busch
2020-03-01 19:53   ` Chaitanya Kulkarni
2020-03-01 19:53     ` Chaitanya Kulkarni
2020-03-02 17:46 ` Sagi Grimberg
2020-03-02 17:46   ` Sagi Grimberg
2020-03-03 20:20   ` Keith Busch
2020-03-03 20:20     ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.