diff options
author | Andy Lutomirski <luto@kernel.org> | 2017-04-21 16:19:23 -0700 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-24 22:03:46 -0600 |
commit | fb0dc3993b537e12ce63511d535ff86efff13c8f (patch) | |
tree | 9bbaaa8f5b683dc2a84bfedb1bbb5f92bc9f0c20 | |
parent | 76e4ad09a30cfb589eb436ad067f4abecb82cc04 (diff) | |
download | blackbird-op-linux-fb0dc3993b537e12ce63511d535ff86efff13c8f.tar.gz blackbird-op-linux-fb0dc3993b537e12ce63511d535ff86efff13c8f.zip |
nvme: Display raw APST configuration via DYNAMIC_DEBUG
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/nvme/host/core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 30446e29dbd9..3c9547b94541 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1336,6 +1336,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; /* @@ -1357,6 +1359,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; @@ -1406,9 +1409,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, |