From nobody Fri Jan 21 02:26:51 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BCCB21968DD2; Fri, 21 Jan 2022 02:26:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jg3DF6N9Cz4ntD; Fri, 21 Jan 2022 02:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642732014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f0RrtfRoj7mdsHrRea23+EF6A92+PXuhjCycDUQ+Tro=; b=cQOUcoaMFcttwB1PDtwo+JElfK40hdjavn42RKsNol6MgdZ5Z6VXu2jbUA/tHu0l1yBnum Cq28uPr0twA9UFeacLDuPkktNzXrQXmhL456R3VPklGLuoiV17XTT7uNhG+DLghXVNrzmj HAq/vRuEP/JIeB7g+0v85xfz8wVCZEHdAA3Q2uXTrmMB3rjsHH5YJLH32pLRI4ZGSAfaKS 7WsCuDIyp9RpSltIhnlIk/phPnPA/tOAAmHFdm3R5a09+H+nueBw0VnIYuWE5qlKiaIvUg ahhKn+XYMa0IzOBA+4s6eBcXtZX4ZM6L2e5tPXkgoYx2pEmZ35Vnq9YgXeeJGA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E51713CAE; Fri, 21 Jan 2022 02:26:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20L2Qpnf001210; Fri, 21 Jan 2022 02:26:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20L2QpZO001209; Fri, 21 Jan 2022 02:26:51 GMT (envelope-from git) Date: Fri, 21 Jan 2022 02:26:51 GMT Message-Id: <202201210226.20L2QpZO001209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: e8f693131c65 - stable/13 - nvme: start qpair in state RECOVERY_WAITING List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e8f693131c65cd29ff23086865e87e974563861f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642732014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f0RrtfRoj7mdsHrRea23+EF6A92+PXuhjCycDUQ+Tro=; b=XHnIKZA4GUK8En6A6EA9W8CjuXv7FXOQdf6ANj2peL50rpOZmLxIxBrWamtOhoBg8GfgJY vCulNa6io0GUNEOzdChogwoe7KuAnwAaRHRT+tlSmnQi6vIrozG6oaWYw6+N8YD6QCiB5A 14HdzT7AMQXz4OpjUE66ugdBF4z0TS1CC/XO/g77zUOnNp+RwXsA1U0C16QgSQb1knqc8d oMYXSrGfgpV5AYiLWbymJZhl1OOh0KeHLSqhJb+WLgFbNCkbcbX/9MtLNx7y/slXbihu3w HiH6v98bjmXLcXw+769Np4EMJ7M8asZVCASd+2bsOaq+6Yx4HdeeR6aRgi6fLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642732014; a=rsa-sha256; cv=none; b=T9hpI19xDejnh6ayPuvOEicYw2tntp4iHoWRaW89zddhzah3PIaLF2FQ1shrqJnyo8EQIQ nx+FjBtgzIDYi4dKm4HNjims8apQ2wwjy08WAfOldZLhDUQrRyepARD6Ebhp7HTUheAa7o 8rEv4cPxipPbpPMly0SB+fcT2s4lGsxU0sOSII7EBLFbA4dZXrgv500crVGoKIVy5U96QH dzjHKzTI+wzW0lsbKm/1Cs3BwOnduvP6RtqltMozUk7T0fXo/vPA9YgL8aFbp3dd2P2P56 j31ar/hSu8SY8+blElhdOhCsHGq2drIoIIpg6P5Y9cdMNWGRp5RVsQcLjhiEng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e8f693131c65cd29ff23086865e87e974563861f commit e8f693131c65cd29ff23086865e87e974563861f Author: Warner Losh AuthorDate: 2021-09-29 03:09:45 +0000 Commit: Alexander Motin CommitDate: 2022-01-21 02:07:30 +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 (cherry picked from commit fa81f3731d1a2984a28ae44e60d12a0659b8fd2f) --- 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