aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mpr/mpr.c
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2018-02-18 16:41:34 +0000
committerScott Long <scottl@FreeBSD.org>2018-02-18 16:41:34 +0000
commitf0779b0452b4d8e78ae784d0c8a417fd385365c7 (patch)
tree284893c2429d4c6e9d287a6d76f9f0735658d641 /sys/dev/mpr/mpr.c
parent2fb9a51077f9725388548a7bffe986ea41389b1e (diff)
downloadsrc-f0779b0452b4d8e78ae784d0c8a417fd385365c7.tar.gz
src-f0779b0452b4d8e78ae784d0c8a417fd385365c7.zip
Improve command lifecycle debugging and detection of problems.
Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=329522
Diffstat (limited to 'sys/dev/mpr/mpr.c')
-rw-r--r--sys/dev/mpr/mpr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c
index b0bbffa34e26..bdf50376f818 100644
--- a/sys/dev/mpr/mpr.c
+++ b/sys/dev/mpr/mpr.c
@@ -1135,6 +1135,9 @@ mpr_enqueue_request(struct mpr_softc *sc, struct mpr_command *cm)
if (++sc->io_cmds_active > sc->io_cmds_highwater)
sc->io_cmds_highwater++;
+ KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, ("command not busy\n"));
+ cm->cm_state = MPR_CM_STATE_INQUEUE;
+
if (sc->atomic_desc_capable) {
rd.u.low = cm->cm_desc.Words.Low;
mpr_regwrite(sc, MPI26_ATOMIC_REQUEST_DESCRIPTOR_POST_OFFSET,
@@ -1554,6 +1557,7 @@ mpr_alloc_requests(struct mpr_softc *sc)
cm->cm_sense_busaddr = sc->sense_busaddr + i * MPR_SENSE_LEN;
cm->cm_desc.Default.SMID = i;
cm->cm_sc = sc;
+ cm->cm_state = MPR_CM_STATE_BUSY;
TAILQ_INIT(&cm->cm_chain_list);
TAILQ_INIT(&cm->cm_prp_page_list);
callout_init_mtx(&cm->cm_callout, &sc->mpr_mtx, 0);
@@ -2444,6 +2448,9 @@ mpr_intr_locked(void *data)
case MPI25_RPY_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO_SUCCESS:
case MPI26_RPY_DESCRIPT_FLAGS_PCIE_ENCAPSULATED_SUCCESS:
cm = &sc->commands[le16toh(desc->SCSIIOSuccess.SMID)];
+ KASSERT(cm->cm_state == MPR_CM_STATE_INQUEUE,
+ ("command not inqueue\n"));
+ cm->cm_state = MPR_CM_STATE_BUSY;
cm->cm_reply = NULL;
break;
case MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY:
@@ -2513,6 +2520,9 @@ mpr_intr_locked(void *data)
} else {
cm = &sc->commands[
le16toh(desc->AddressReply.SMID)];
+ KASSERT(cm->cm_state == MPR_CM_STATE_INQUEUE,
+ ("command not inqueue\n"));
+ cm->cm_state = MPR_CM_STATE_BUSY;
cm->cm_reply = reply;
cm->cm_reply_data =
le32toh(desc->AddressReply.
@@ -2543,8 +2553,7 @@ mpr_intr_locked(void *data)
}
if (pq != sc->replypostindex) {
- mpr_dprint(sc, MPR_TRACE,
- "%s sc %p writing postindex %d\n",
+ mpr_dprint(sc, MPR_TRACE, "%s sc %p writing postindex %d\n",
__func__, sc, sc->replypostindex);
mpr_regwrite(sc, MPI2_REPLY_POST_HOST_INDEX_OFFSET,
sc->replypostindex);