Skip to content

nvme: Fix command timeouts

Alexey Charkov u-boot 1 version In review

Get series with b4
b4 am [email protected] change-id 20261113-nvme-fixes-920d0fdfe289

Versions newest first

  1. v1 Latest3 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3nvme: Wait for commands in seconds, not tenths of secondsdrivers/nvme/nvme.c+4 -32 replies
2/3nvme: Consume completion queue entries in one placedrivers/nvme/nvme.c+16 -202 replies
3/3nvme: Drop late completions of commands that timed outdrivers/nvme/nvme.c+16 -23 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchNeil ArmstrongBin Meng
1/3R-b R-b
2/3R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] nvme: Fix command timeouts

A Rock 5B with a Kingston NV-series disk does not boot from it, because the disk takes up to 3.2s to complete its first read after power-on.

The driver means to wait 30s for I/O commands, as Linux does, but scales the timeout by tenths of a second, so it gives up after 3s and the GPT probe fails. The completion then posted for the timed-out read is mistaken for the completion of the next command, the DOS probe of the same sector, which then sees the protective MBR and records the disk as a single DOS partition of type 0xee. From then on, every command gets the completion of the one before it.

The first patch makes the timeouts the seconds they were meant to be. The second moves consuming a completion queue entry into a helper, which the third then uses to discard a late completion instead of handing it to the next command, so a command that does time out no longer desynchronises the queue.

Tested on a Rock 5B: with this series applied, the disk is detected as GPT and the EFI bootflow boots from it.

CI for this series: https://git.u-boot-project.org/u-boot/contributors/alchark/u-boot/-/pipelines/2016

---
Alexey Charkov (3):
nvme: Wait for commands in seconds, not tenths of seconds
nvme: Consume completion queue entries in one place
nvme: Drop late completions of commands that timed out

 drivers/nvme/nvme.c | 59 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 24 deletions(-)

---
base-commit: ff8a9bc41e4e5bdd3406932af5abb4c18064e539
change-id: 20261113-nvme-fixes-920d0fdfe289

Best regards,

Signature · 1 line
Alexey Charkov <[email protected]>