From nobody Sat Jul 20 02:59:13 2024 X-Original-To: dev-commits-src-all@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 4WQrq55T6rz5QxxL; Sat, 20 Jul 2024 02:59:13 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WQrq527CPz43Bt; Sat, 20 Jul 2024 02:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721444353; 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=rKOA/s6wibUUdwbmzaiepVSlmbCPQ0Q2RHHWUTVveuA=; b=sCjdU9nKJV6rj3CpXh18CX44DOnvqQWTSB6kyADMbt2bxY8vBjCU3mWjALbw4Q99J6gTxg OyB3+0tnaQlRjL0y0kR3BGZlv1HTJ8bT6xCnMq9vXzQX7E6LpM+QIV9y6m9Qe4UIjF3u7B jcEW7mFR3y1XfctkoetbqPdJToocjyujt4koTrwCslwTktYpHpxxzIV5v8+s6BDc3Y2ctt 365GHETeK+uX3JWfDuNcxIBscatdKchjOqBhgxxSgDhBlM6Z2apMRnbrKCEFlKSr3FcgMJ teasXaG1l8r5iXYN7s2QPbC4vS9TaXIw1KSgSgR9Pmr2ZNosF0/injabHs2EYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721444353; a=rsa-sha256; cv=none; b=vO3xojcbXSStXdtYn2VszP5awGOAH4K0XnwFjcQRtN7FwY07is9BdkcedeDATJGANomZsa D0xvt69C1X+P2VMNGPteRbCwjCN/D11sVZZqZyD+mcQjepA4IIqA+9S73aDBQVMtuA2Pk3 u8J7Lr9Fzz/35+hNZxEdZAdZD4BXlrZDcHJjwhZM8w7fgVfWnR2g/tVRa5GYoOL6aDJvi5 6AGENgx6JdGHSL0Az7PWHSD1fBYvUJ+kVuxtyIpDXDBo0EPL5At/wHQpdCH08NA3bxtbfV J2PRAWXQ4ed8XIIrNVMFbGFRKHiIdhcPRSIBaqpxNGZAtNROLBQgXmHsZeG/JA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721444353; 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=rKOA/s6wibUUdwbmzaiepVSlmbCPQ0Q2RHHWUTVveuA=; b=iHBvFGkTTxI8SCQZbtsclfPwevKK+X3P4JEzqcMmitGReyPwI4ymu+0g1Pp7YNf3ec9OWp KWvRdjQDZeVWJumRQdj94pDeGScZzkqXBiLbrHMAWlj1AslP60NtiAB8vGWMqPu2IKIfeS z+0MGlj2FdNX2h1YB/v8gmVA8VMJplLAQZ5geDlt3xmqz8BZPhvblrAB8e7Igk0YuCll3J iZJ1QW2HovyrEPZUsZBqvgypWrcVjHn4pmzeLQpoY0jGNhO5bZ26OoEn8O9AnQ1S8RYReI Dy3TGju8CZDs6KCnLhOEGegW8fliLPWHnaGL1DDRBqdai/sTIbbnjBYS4WTnKA== 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 4WQrq513GgzykR; Sat, 20 Jul 2024 02:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46K2xD7s024705; Sat, 20 Jul 2024 02:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46K2xDPs024702; Sat, 20 Jul 2024 02:59:13 GMT (envelope-from git) Date: Sat, 20 Jul 2024 02:59:13 GMT Message-Id: <202407200259.46K2xDPs024702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 123e29068ecf - main - nvme: widen nvme_qpair_manual_complete_request for better errors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 123e29068ecf6d7c235061480967aadc153f68d4 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=123e29068ecf6d7c235061480967aadc153f68d4 commit 123e29068ecf6d7c235061480967aadc153f68d4 Author: Warner Losh AuthorDate: 2024-07-20 02:56:04 +0000 Commit: Warner Losh CommitDate: 2024-07-20 02:56:04 +0000 nvme: widen nvme_qpair_manual_complete_request for better errors Make nvme_qpair_manual_complete_request take dnr as well as a print_on_error action. Make the status word computation common between it and nvme_qpair_manual_complete_tracker. And print the error when we are cancelling the I/O on failure, but not when we're filtering the I/O after we've failed. Make it private again to nvme_qpair.c. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D46049 --- sys/dev/nvme/nvme_private.h | 3 --- sys/dev/nvme/nvme_qpair.c | 37 +++++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 8415819ca20b..ff08f6581db5 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -417,9 +417,6 @@ void nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req); 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); 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 9b3fe58c312c..755be993cee0 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -482,6 +482,20 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr, mtx_unlock(&qpair->lock); } +static uint32_t +nvme_qpair_make_status(uint32_t sct, uint32_t sc, uint32_t dnr) +{ + uint32_t status = 0; + + status |= NVMEF(NVME_STATUS_SCT, sct); + status |= NVMEF(NVME_STATUS_SC, sc); + status |= NVMEF(NVME_STATUS_DNR, dnr); + /* M=0 : this is artificial so no data in error log page */ + /* CRD=0 : this is artificial and no delayed retry support anyway */ + /* P=0 : phase not checked */ + return (status); +} + static void nvme_qpair_manual_complete_tracker( struct nvme_tracker *tr, uint32_t sct, uint32_t sc, uint32_t dnr, @@ -496,30 +510,24 @@ nvme_qpair_manual_complete_tracker( cpl.sqid = qpair->id; cpl.cid = tr->cid; - cpl.status |= NVMEF(NVME_STATUS_SCT, sct); - cpl.status |= NVMEF(NVME_STATUS_SC, sc); - cpl.status |= NVMEF(NVME_STATUS_DNR, dnr); - /* M=0 : this is artificial so no data in error log page */ - /* CRD=0 : this is artificial and no delayed retry support anyway */ - /* P=0 : phase not checked */ + cpl.status = nvme_qpair_make_status(sct, sc, dnr); nvme_qpair_complete_tracker(tr, &cpl, print_on_error); } -void +static void nvme_qpair_manual_complete_request(struct nvme_qpair *qpair, - struct nvme_request *req, uint32_t sct, uint32_t sc) + struct nvme_request *req, uint32_t sct, uint32_t sc, uint32_t dnr, + error_print_t print_on_error) { struct nvme_completion cpl; bool error; memset(&cpl, 0, sizeof(cpl)); cpl.sqid = qpair->id; - cpl.status |= NVMEF(NVME_STATUS_SCT, sct); - cpl.status |= NVMEF(NVME_STATUS_SC, sc); - + cpl.status = nvme_qpair_make_status(sct, sc, dnr); error = nvme_completion_is_error(&cpl); - if (error) { + if (error && print_on_error == ERROR_PRINT_ALL) { nvme_qpair_print_command(qpair, &req->cmd); nvme_qpair_print_completion(qpair, &cpl); } @@ -1277,7 +1285,8 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) */ if (qpair->ctrlr->is_failed) { nvme_qpair_manual_complete_request(qpair, req, - NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST); + NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 1, + ERROR_PRINT_NONE); return; } @@ -1512,7 +1521,7 @@ nvme_qpair_fail(struct nvme_qpair *qpair) STAILQ_REMOVE_HEAD(&qpair->queued_req, stailq); mtx_unlock(&qpair->lock); nvme_qpair_manual_complete_request(qpair, req, NVME_SCT_GENERIC, - NVME_SC_ABORTED_BY_REQUEST); + NVME_SC_ABORTED_BY_REQUEST, 1, ERROR_PRINT_ALL); mtx_lock(&qpair->lock); }