Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2021 03:24:22 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fa81f3731d1a - main - nvme: start qpair in state RECOVERY_WAITING
Message-ID:  <202109290324.18T3OMpt075528@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=fa81f3731d1a2984a28ae44e60d12a0659b8fd2f

commit fa81f3731d1a2984a28ae44e60d12a0659b8fd2f
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-09-29 03:09:45 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-09-29 03:16:19 +0000

    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
---
 sys/dev/nvme/nvme_qpair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109290324.18T3OMpt075528>