[PATCH v2 1/6] drivers: nvme: Log I/O timeouts
Simon Glass
sjg at chromium.org
Fri May 29 11:56:43 CEST 2026
Hi Denis,
On 2026-05-29T03:44:35, None <dmukhin at ford.com> wrote:
> drivers: nvme: Log I/O timeouts
>
> Current code silently swallows any timed-out commands scheduled
> to NVMe. Log those to be able to debug any potential problems with
> the NVMe hardware/firmware.
>
> Signed-off-by: Denis Mukhin <dmukhin at ford.com>
> Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
>
> drivers/nvme/nvme.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> @@ -179,8 +179,10 @@ static int nvme_submit_sync_cmd(struct nvme_queue *nvmeq,
> if ((status & 0x01) == phase)
> break;
> if (timeout_us > 0 && (timer_get_us() - start_time)
> - >= timeout_us)
> + >= timeout_us) {
> + pr_warn("nvme: cmd %#x timed out\n", cmd->common.command_id);
> + return -ETIMEDOUT;
> + }
Reviewed-by: Simon Glass <sjg at chromium.org>
A few suggestions:
- command_id is just an incrementing sequence (see nvme_get_cmd_id()),
so on its own it tells you very little. How about logging
cmd->common.opcode as well - that identifies the command type and is
the useful bit for debugging.
- With multiple NVMe controllers this message won't say which one
stalled. Since nvmeq->dev->udev is to hand, dev_warn() would be more
informative than pr_warn(), and would drop the need for the 'nvme: '
prefix. Or you could use log_warning() and print out what you want
- The new line is ~85 columns; please wrap it.
Regards,
Simon
More information about the U-Boot
mailing list