aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/nvme
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2019-03-09 01:18:16 +0000
committerWarner Losh <imp@FreeBSD.org>2019-03-09 01:18:16 +0000
commit2ffd6fce5b099a7ac6800aaf2ecf93d75567385c (patch)
tree8d6338c4a95795838c3c1b3f10eadec0863399f5 /sys/dev/nvme
parentb25d74e06c0c15679da0de6ec4a0fac32e9e917f (diff)
downloadsrc-2ffd6fce5b099a7ac6800aaf2ecf93d75567385c.tar.gz
src-2ffd6fce5b099a7ac6800aaf2ecf93d75567385c.zip
Don't print all the I/O we abort on a reset, unless we're out of
retries. When resetting the controller, we abort I/O. Prior to this fix, we printed a ton of abort messages for I/O that we're going to retry. This imparts no useful information. Stop printing them unless our retry count is exhausted. Clarify code for when we don't retry, and remove useless arg to a routine that's always called with it as 'true'. All the other debug is still printed (including multiple reset messages if we have multiple timeouts before the taskqueue runs the actual reset) so that we know when we reset. Reviewed by: jimharris@, chuck@ Differential Revision: https://reviews.freebsd.org/D19431
Notes
Notes: svn path=/head/; revision=344955
Diffstat (limited to 'sys/dev/nvme')
-rw-r--r--sys/dev/nvme/nvme_ctrlr.c2
-rw-r--r--sys/dev/nvme/nvme_private.h3
-rw-r--r--sys/dev/nvme/nvme_qpair.c33
3 files changed, 20 insertions, 18 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 8d8f794629ff..24da26edee46 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -237,7 +237,7 @@ nvme_ctrlr_fail_req_task(void *arg, int pending)
STAILQ_REMOVE_HEAD(&ctrlr->fail_req, stailq);
mtx_unlock(&ctrlr->lock);
nvme_qpair_manual_complete_request(req->qpair, req,
- NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, TRUE);
+ NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST);
mtx_lock(&ctrlr->lock);
}
mtx_unlock(&ctrlr->lock);
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
index 3d0a97f9081b..f68ebbe75899 100644
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -417,8 +417,7 @@ void nvme_qpair_reset(struct nvme_qpair *qpair);
void nvme_qpair_fail(struct nvme_qpair *qpair);
void nvme_qpair_manual_complete_request(struct nvme_qpair *qpair,
struct nvme_request *req,
- uint32_t sct, uint32_t sc,
- boolean_t print_on_error);
+ uint32_t sct, uint32_t sc);
void nvme_admin_qpair_enable(struct nvme_qpair *qpair);
void nvme_admin_qpair_disable(struct nvme_qpair *qpair);
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index 5c46e247ccf1..bc99ac95f1c3 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$");
#include "nvme_private.h"
+typedef enum error_print { ERROR_PRINT_NONE, ERROR_PRINT_NO_RETRY, ERROR_PRINT_ALL } error_print_t;
+#define DO_NOT_RETRY 1
+
static void _nvme_qpair_submit_request(struct nvme_qpair *qpair,
struct nvme_request *req);
static void nvme_qpair_destroy(struct nvme_qpair *qpair);
@@ -325,7 +328,7 @@ nvme_completion_is_retry(const struct nvme_completion *cpl)
sct = NVME_STATUS_GET_SCT(cpl->status);
sc = NVME_STATUS_GET_SC(cpl->status);
- dnr = NVME_STATUS_GET_DNR(cpl->status);
+ dnr = NVME_STATUS_GET_DNR(cpl->status); /* Do Not Retry Bit */
/*
* TODO: spec is not clear how commands that are aborted due
@@ -369,7 +372,7 @@ nvme_completion_is_retry(const struct nvme_completion *cpl)
static void
nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr,
- struct nvme_completion *cpl, boolean_t print_on_error)
+ struct nvme_completion *cpl, error_print_t print_on_error)
{
struct nvme_request *req;
boolean_t retry, error;
@@ -379,7 +382,8 @@ nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr,
retry = error && nvme_completion_is_retry(cpl) &&
req->retries < nvme_retry_count;
- if (error && print_on_error) {
+ if (error && (print_on_error == ERROR_PRINT_ALL ||
+ (!retry && print_on_error == ERROR_PRINT_NO_RETRY))) {
nvme_qpair_print_command(qpair, &req->cmd);
nvme_qpair_print_completion(qpair, cpl);
}
@@ -431,7 +435,7 @@ nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr,
static void
nvme_qpair_manual_complete_tracker(struct nvme_qpair *qpair,
struct nvme_tracker *tr, uint32_t sct, uint32_t sc, uint32_t dnr,
- boolean_t print_on_error)
+ error_print_t print_on_error)
{
struct nvme_completion cpl;
@@ -446,8 +450,7 @@ nvme_qpair_manual_complete_tracker(struct nvme_qpair *qpair,
void
nvme_qpair_manual_complete_request(struct nvme_qpair *qpair,
- struct nvme_request *req, uint32_t sct, uint32_t sc,
- boolean_t print_on_error)
+ struct nvme_request *req, uint32_t sct, uint32_t sc)
{
struct nvme_completion cpl;
boolean_t error;
@@ -459,7 +462,7 @@ nvme_qpair_manual_complete_request(struct nvme_qpair *qpair,
error = nvme_completion_is_error(&cpl);
- if (error && print_on_error) {
+ if (error) {
nvme_qpair_print_command(qpair, &req->cmd);
nvme_qpair_print_completion(qpair, &cpl);
}
@@ -502,7 +505,7 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair)
tr = qpair->act_tr[cpl.cid];
if (tr != NULL) {
- nvme_qpair_complete_tracker(qpair, tr, &cpl, TRUE);
+ nvme_qpair_complete_tracker(qpair, tr, &cpl, ERROR_PRINT_ALL);
qpair->sq_head = cpl.sqhd;
done++;
} else {
@@ -728,7 +731,7 @@ nvme_admin_qpair_abort_aers(struct nvme_qpair *qpair)
if (tr->req->cmd.opc == NVME_OPC_ASYNC_EVENT_REQUEST) {
nvme_qpair_manual_complete_tracker(qpair, tr,
NVME_SCT_GENERIC, NVME_SC_ABORTED_SQ_DELETION, 0,
- FALSE);
+ ERROR_PRINT_NONE);
tr = TAILQ_FIRST(&qpair->outstanding_tr);
} else {
tr = TAILQ_NEXT(tr, tailq);
@@ -771,7 +774,7 @@ nvme_abort_complete(void *arg, const struct nvme_completion *status)
nvme_printf(tr->qpair->ctrlr,
"abort command failed, aborting command manually\n");
nvme_qpair_manual_complete_tracker(tr->qpair, tr,
- NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 0, TRUE);
+ NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_ALL);
}
}
@@ -989,7 +992,7 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
*/
mtx_unlock(&qpair->lock);
nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
- NVME_SC_DATA_TRANSFER_ERROR, 1 /* do not retry */, TRUE);
+ NVME_SC_DATA_TRANSFER_ERROR, DO_NOT_RETRY, ERROR_PRINT_ALL);
mtx_lock(&qpair->lock);
}
}
@@ -1047,7 +1050,7 @@ nvme_admin_qpair_enable(struct nvme_qpair *qpair)
nvme_printf(qpair->ctrlr,
"aborting outstanding admin command\n");
nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
- NVME_SC_ABORTED_BY_REQUEST, 1 /* do not retry */, TRUE);
+ NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL);
}
nvme_qpair_enable(qpair);
@@ -1069,7 +1072,7 @@ nvme_io_qpair_enable(struct nvme_qpair *qpair)
TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) {
nvme_printf(qpair->ctrlr, "aborting outstanding i/o\n");
nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
- NVME_SC_ABORTED_BY_REQUEST, 0, TRUE);
+ NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_NO_RETRY);
}
mtx_lock(&qpair->lock);
@@ -1134,7 +1137,7 @@ nvme_qpair_fail(struct nvme_qpair *qpair)
nvme_printf(qpair->ctrlr, "failing queued i/o\n");
mtx_unlock(&qpair->lock);
nvme_qpair_manual_complete_request(qpair, req, NVME_SCT_GENERIC,
- NVME_SC_ABORTED_BY_REQUEST, TRUE);
+ NVME_SC_ABORTED_BY_REQUEST);
mtx_lock(&qpair->lock);
}
@@ -1148,7 +1151,7 @@ nvme_qpair_fail(struct nvme_qpair *qpair)
nvme_printf(qpair->ctrlr, "failing outstanding i/o\n");
mtx_unlock(&qpair->lock);
nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
- NVME_SC_ABORTED_BY_REQUEST, 1 /* do not retry */, TRUE);
+ NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL);
mtx_lock(&qpair->lock);
}