Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626943

[PATCH 2/5] nvme: Display raw APST configuration via DYNAMIC_DEBUG

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 2/5] nvme: Display raw APST configuration via DYNAMIC_DEBUG
Date 2017-04-20 05:10 +0200
Message-ID <tyaDM-3Au-17@gated-at.bofh.it> (permalink)
References <tyaDL-3Au-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Debugging APST is currently a bit of a pain.  This gives optional
simple log messages that describe the APST state.

The easiest way to use this is probably with the nvme_core.dyndbg=+p
module parameter.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 drivers/nvme/host/core.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4fc58866640e..52b4e52b85a2 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1278,6 +1278,8 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl)
 
 	unsigned apste;
 	struct nvme_feat_auto_pst *table;
+	u64 max_lat_us = 0;
+	int max_ps = -1;
 	int ret;
 
 	/*
@@ -1299,6 +1301,7 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl)
 	if (ctrl->ps_max_latency_us == 0) {
 		/* Turn off APST. */
 		apste = 0;
+		dev_dbg(ctrl->device, "APST disabled\n");
 	} else {
 		__le64 target = cpu_to_le64(0);
 		int state;
@@ -1340,9 +1343,22 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl)
 
 			target = cpu_to_le64((state << 3) |
 					     (transition_ms << 8));
+
+			if (max_ps == -1)
+				max_ps = state;
+
+			if (total_latency_us > max_lat_us)
+				max_lat_us = total_latency_us;
 		}
 
 		apste = 1;
+
+		if (max_ps == -1) {
+			dev_dbg(ctrl->device, "APST enabled but no non-operational states are available\n");
+		} else {
+			dev_dbg(ctrl->device, "APST enabled: max PS = %d, max round-trip latency = %lluus, table = %*phN\n",
+				max_ps, max_lat_us, (int)sizeof(*table), table);
+		}
 	}
 
 	ret = nvme_set_features(ctrl, NVME_FEAT_AUTO_PST, apste,
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  Re: [PATCH 4/5] nvme: Adjust the Samsung APST quirk Jens Axboe <axboe@kernel.dk> - 2017-04-20 05:10 +0200
    Re: [PATCH 4/5] nvme: Adjust the Samsung APST quirk Andy Lutomirski <luto@kernel.org> - 2017-04-20 06:00 +0200
      RE: [PATCH 4/5] nvme: Adjust the Samsung APST quirk Judy Brock <judy.brock@samsung.com> - 2017-04-20 06:50 +0200
  [PATCH 2/5] nvme: Display raw APST configuration via DYNAMIC_DEBUG Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 4/5] nvme: Adjust the Samsung APST quirk Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 5/5] nvme: Quirk APST off on "THNSF5256GPUK TOSHIBA" Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 1/5] nvme: Fix APST comment Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  [PATCH 3/5] nvme: Add nvme_core.force_apst to ignore the NO_APST quirk Andy Lutomirski <luto@kernel.org> - 2017-04-20 05:10 +0200
  Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Jens Axboe <axboe@kernel.dk> - 2017-04-20 05:20 +0200
    Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@kernel.org> - 2017-04-20 06:00 +0200
      Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@amacapital.net> - 2017-04-20 07:00 +0200
        Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Christoph Hellwig <hch@lst.de> - 2017-04-20 07:20 +0200
          Re: [PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski <luto@kernel.org> - 2017-04-20 18:10 +0200

csiph-web