aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-09-29 03:09:45 +0000
committerAlexander Motin <mav@FreeBSD.org>2022-01-21 02:07:30 +0000
commite8f693131c65cd29ff23086865e87e974563861f (patch)
tree6512ce055eccb70f4a82524801311ba63c37cb0f
parent9bbd0a7ca9996d3eee2162ab01ad81d4b15071d8 (diff)
downloadsrc-e8f693131c65cd29ff23086865e87e974563861f.tar.gz
src-e8f693131c65cd29ff23086865e87e974563861f.zip
nvme: start qpair in state RECOVERY_WAITING
An interrupt happens on the admin queue right away after the reset, so as soon as we enable interrupts, we'll get a call to our interrupt handler. It is safe to ignore this interrupt if we're not yet initialized, or to process it if we are. If we are initialized, we'll see there's no completion records and return. If we're not, we'll process no completion records and return. Either way, nothing is processed and nothing is lost. Until we've completely setup the qpair, we need to avoid processing completion records. Start the qpair in the waiting recovery state so we return immediately when we try to process completions. The code already sets it to 'NONE' when we're initialization is complete. It's safe to defer completion processing here because we don't send any commands before the initialization of the software state of the qpair is complete. And even if we were to somehow send a command prior to that completing, the completion record for that command would be processed when we send commands to the admin qpair after we've setup the software state. There's no good central point to add an assert for this last condition. This fixes an KASSERT "received completion for unknown cmd" panic on boot. Fixes: 502dc84a8b6703e7c0626739179a3cdffdd22d81 Sponsored by: Netflix Reviewed by: mav, cperciva, gallatin Differential Revision: https://reviews.freebsd.org/D32210 (cherry picked from commit fa81f3731d1a2984a28ae44e60d12a0659b8fd2f)
-rw-r--r--sys/dev/nvme/nvme_qpair.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index 7a17a057f319..6ee5fa9d4c30 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -740,7 +740,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair,
callout_init(&qpair->timer, 1);
qpair->timer_armed = false;
- qpair->recovery_state = RECOVERY_NONE;
+ qpair->recovery_state = RECOVERY_WAITING;
/*
* Calcuate the stride of the doorbell register. Many emulators set this