From e4e94c383b5ce89c5afa26f15f41037be81ad556 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Tue, 21 Sep 2021 14:46:56 +0200 Subject: [PATCH] nvme: print ERRLOGs when init fails due to CSTS read failure When the controller initialization is failed due to not being able to read the CSTS register, an ERRLOG is now printed instead of DEBUGLOG. It should make it easier to debug initialization failures. Signed-off-by: Konrad Sztyber Change-Id: I42602bd08e263faf2e87fe4a68abcc82ddec11ba Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9556 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk --- lib/nvme/nvme_ctrlr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 59d769d21c..4f011b5c55 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -3530,11 +3530,12 @@ nvme_ctrlr_process_init_wait_for_ready_1(void *ctx, uint64_t value, const struct /* While a device is resetting, it may be unable to service MMIO reads * temporarily. Allow for this case. */ - NVME_CTRLR_DEBUGLOG(ctrlr, "Failed to read the CSTS register\n"); if (!ctrlr->is_failed && ctrlr->state_timeout_tsc != NVME_TIMEOUT_INFINITE) { + NVME_CTRLR_DEBUGLOG(ctrlr, "Failed to read the CSTS register\n"); nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_DISABLE_WAIT_FOR_READY_1, NVME_TIMEOUT_KEEP_EXISTING); } else { + NVME_CTRLR_ERRLOG(ctrlr, "Failed to read the CSTS register\n"); nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_ERROR, NVME_TIMEOUT_INFINITE); } @@ -3563,11 +3564,12 @@ nvme_ctrlr_process_init_wait_for_ready_0(void *ctx, uint64_t value, const struct /* While a device is resetting, it may be unable to service MMIO reads * temporarily. Allow for this case. */ - NVME_CTRLR_DEBUGLOG(ctrlr, "Failed to read the CSTS register\n"); if (!ctrlr->is_failed && ctrlr->state_timeout_tsc != NVME_TIMEOUT_INFINITE) { + NVME_CTRLR_DEBUGLOG(ctrlr, "Failed to read the CSTS register\n"); nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_DISABLE_WAIT_FOR_READY_0, NVME_TIMEOUT_KEEP_EXISTING); } else { + NVME_CTRLR_ERRLOG(ctrlr, "Failed to read the CSTS register\n"); nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_ERROR, NVME_TIMEOUT_INFINITE); }