From owner-svn-src-all@freebsd.org Thu Jul 18 21:58:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4668B2A1F; Thu, 18 Jul 2019 21:58:53 +0000 (UTC) (envelope-from imp@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80ABB738D8; Thu, 18 Jul 2019 21:58:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 089B7E8C6; Thu, 18 Jul 2019 21:58:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ILwqwe038776; Thu, 18 Jul 2019 21:58:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ILwqm8038772; Thu, 18 Jul 2019 21:58:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907182158.x6ILwqm8038772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 18 Jul 2019 21:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350118 - in head: share/man/man4 sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/nvme X-SVN-Commit-Revision: 350118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 80ABB738D8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jul 2019 21:58:53 -0000 Author: imp Date: Thu Jul 18 21:58:51 2019 New Revision: 350118 URL: https://svnweb.freebsd.org/changeset/base/350118 Log: Provide new tunable hw.nvme.verbose_cmd_dump The nvme drive dumps only the most relevant details about a command when it fails. However, there are times this is not sufficient (such as debugging weird issues for a new drive with a vendor). Setting hw.nvme.verbose_cmd_dump=1 in loader.conf will enable more complete debugging information about each command that fails. Reviewed by: rpokala Sponsored by: Netflix Differential Version: https://reviews.freebsd.org/D20988 Modified: head/share/man/man4/nvme.4 head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_qpair.c Modified: head/share/man/man4/nvme.4 ============================================================================== --- head/share/man/man4/nvme.4 Thu Jul 18 21:37:50 2019 (r350117) +++ head/share/man/man4/nvme.4 Thu Jul 18 21:58:51 2019 (r350118) @@ -151,6 +151,17 @@ This value may also be set in the kernel config file w .Bd -literal -offset indent .Cd options NVME_USE_NVD=0 .Ed +.Pp +When there is an error, +.Nm +prints only the most relevant information about the command by default. +To enable dumping of all information about the command, set the following tunable +value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.nvme.verbose_cmd_dump=1 +.Ed +.Pp .Sh SYSCTL VARIABLES The following controller-level sysctls are currently implemented: .Bl -tag -width indent Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Thu Jul 18 21:37:50 2019 (r350117) +++ head/sys/dev/nvme/nvme.c Thu Jul 18 21:58:51 2019 (r350118) @@ -54,6 +54,9 @@ struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS] uma_zone_t nvme_request_zone; int32_t nvme_retry_count; +int nvme_verbose_cmd_dump; + +TUNABLE_INT("hw.nvme.verbose_cmd_dump", &nvme_verbose_cmd_dump); MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations"); Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Thu Jul 18 21:37:50 2019 (r350117) +++ head/sys/dev/nvme/nvme_private.h Thu Jul 18 21:58:51 2019 (r350118) @@ -114,6 +114,7 @@ MALLOC_DECLARE(M_NVME); extern uma_zone_t nvme_request_zone; extern int32_t nvme_retry_count; +extern int32_t nvme_verbose_cmd_dump; struct nvme_completion_poll_status { Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Thu Jul 18 21:37:50 2019 (r350117) +++ head/sys/dev/nvme/nvme_qpair.c Thu Jul 18 21:58:51 2019 (r350118) @@ -178,6 +178,16 @@ nvme_qpair_print_command(struct nvme_qpair *qpair, str nvme_admin_qpair_print_command(qpair, cmd); else nvme_io_qpair_print_command(qpair, cmd); + if (nvme_verbose_cmd_dump) { + nvme_printf(qpair->ctrlr, + "nsid:%#x rsvd2:%#x rsvd3:%#x mptr:%#jx prp1:%#jx prp2:%#jx\n", + cmd->nsid, cmd->rsvd2, cmd->rsvd3, (uintmax_t)cmd->mptr, + (uintmax_t)cmd->prp1, (uintmax_t)cmd->prp2); + nvme_printf(qpair->ctrlr, + "cdw10: %#x cdw11:%#x cdw12:%#x cdw13:%#x cdw14:%#x cdw15:%#x\n", + cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, + cmd->cdw15); + } } struct nvme_status_string {