Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 2019 18:53:53 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r350934 - in stable/12: share/man/man4 sys/dev/nvme
Message-ID:  <201908121853.x7CIrrpp064969@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Aug 12 18:53:53 2019
New Revision: 350934
URL: https://svnweb.freebsd.org/changeset/base/350934

Log:
  MFC r350118 (by imp): 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.

Modified:
  stable/12/share/man/man4/nvme.4
  stable/12/sys/dev/nvme/nvme.c
  stable/12/sys/dev/nvme/nvme_private.h
  stable/12/sys/dev/nvme/nvme_qpair.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/nvme.4
==============================================================================
--- stable/12/share/man/man4/nvme.4	Mon Aug 12 18:53:01 2019	(r350933)
+++ stable/12/share/man/man4/nvme.4	Mon Aug 12 18:53:53 2019	(r350934)
@@ -117,6 +117,17 @@ hw.nvme.force_intx=1
 .Ed
 .Pp
 Note that use of INTx implies disabling of per-CPU I/O queue pairs.
+.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: stable/12/sys/dev/nvme/nvme.c
==============================================================================
--- stable/12/sys/dev/nvme/nvme.c	Mon Aug 12 18:53:01 2019	(r350933)
+++ stable/12/sys/dev/nvme/nvme.c	Mon Aug 12 18:53:53 2019	(r350934)
@@ -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: stable/12/sys/dev/nvme/nvme_private.h
==============================================================================
--- stable/12/sys/dev/nvme/nvme_private.h	Mon Aug 12 18:53:01 2019	(r350933)
+++ stable/12/sys/dev/nvme/nvme_private.h	Mon Aug 12 18:53:53 2019	(r350934)
@@ -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: stable/12/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- stable/12/sys/dev/nvme/nvme_qpair.c	Mon Aug 12 18:53:01 2019	(r350933)
+++ stable/12/sys/dev/nvme/nvme_qpair.c	Mon Aug 12 18:53:53 2019	(r350934)
@@ -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 {



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