mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Christian Berry <christiankbberry@gmail.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH] nvme: check for readiness more quickly to speed up boot
Date: Mon, 28 Sep 2026 08:08:30 -0400	[thread overview]
Message-ID: <CAH86aduF9cF54ew=75XAj=Wp1dScS5FMDWRSpF-FDaiEsg8mSQ@mail.gmail.com> (raw)
In-Reply-To: <d8a1924f-a798-438d-aeeb-4cc5139b254b@pengutronix.de>

  On 9/28/26 10:19, Ahmad Fatoum wrote:
  > Nitpick: I'd prefer mdelay(1); but you don't need to resend just for this.

  Thanks for the response,

  I went with udelay(1000) intentionally, to mirror Linux's
  usleep_range(1000, 2000) in the equivalent NVMe readiness poll
  (commit 3e98c2443f5c). mdelay(1) would work too, and I did consider
  it over udelay(1000) but keeping the barebox and Linux implementations
  easy to compare side by side seemed worth it. Happy to switch if you
  feel strongly; otherwise, I'll leave it as-is per your note.

  Thanks again,
  Christian


On Mon, Sep 28, 2026 at 4:18 AM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>
> On 9/28/26 1:03 AM, Christian Berry via B4 Relay wrote:
> > From: Christian Berry <christiankbberry@gmail.com>
> >
> > nvme_wait_ready() polls the controller status every 100ms, although
> > the controller may become ready much sooner. Every probe then waits
> > at least 100ms longer than needed, and possibly twice, since both
> > nvme_disable_ctrl() and nvme_enable_ctrl() wait for readiness.
> >
> > Poll every millisecond instead, as Linux does since commit
> > 3e98c2443f5c ("nvme: Check for readiness more quickly, to speed up
> > boot time"). The overall timeout is still based on elapsed time, so
> > it is unaffected.
> >
> > Tested on an Arm64 SoC with a Samsung 980 SSD in a Gen3 x4
> > configuration, where PCIe + NVMe probe time dropped from 165 ms to
> > 65 ms.
> >
> > Signed-off-by: Christian Berry <christiankbberry@gmail.com>
>
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>
> > ---
> >  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 345707ecfe..9686268d44 100644
> > --- a/drivers/nvme/host/core.c
> > +++ b/drivers/nvme/host/core.c
> > @@ -173,7 +173,7 @@ static int nvme_wait_ready(struct nvme_ctrl *ctrl, u64 cap, bool enabled)
> >               if ((csts & NVME_CSTS_RDY) == bit)
> >                       break;
> >
> > -             mdelay(100);
> > +             udelay(1000);
>
> Nitpick: I'd prefer mdelay(1); but you don't need to resend just for this.
>
> Cheers,
> Ahmad
>
> >
> >               if (is_timeout(start, timeout)) {
> >                       dev_err(ctrl->dev,
> >
> > ---
> > base-commit: 983608b439b803f72f12d56d0ab10bd6ba29e536
> > change-id: 20260927-nvme-ready-poll-4bd640377bab
> >
> > Best regards,
>
> --
> Pengutronix e.K.                  |                             |
> Steuerwalder Str. 21              | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
>



  reply	other threads:[~2026-09-28 12:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 23:03 Christian Berry via B4 Relay
2026-09-28  8:19 ` Ahmad Fatoum
2026-09-28 12:08   ` Christian Berry [this message]
2026-09-28 12:09     ` Ahmad Fatoum

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='CAH86aduF9cF54ew=75XAj=Wp1dScS5FMDWRSpF-FDaiEsg8mSQ@mail.gmail.com' \
    --to=christiankbberry@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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