]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
nvme: Display raw APST configuration via DYNAMIC_DEBUG
authorAndy Lutomirski <luto@kernel.org>
Thu, 29 Jun 2017 09:59:19 +0000 (17:59 +0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 14 Jul 2017 13:24:17 +0000 (10:24 -0300)
BugLink: https://bugs.launchpad.net/bugs/1699004
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>
(cherry picked from commit fb0dc3993b537e12ce63511d535ff86efff13c8f)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/nvme/host/core.c

index 0b81bbf635a646e6ab2774d4de9fb53bcdea6589..0acb533e50691d2e17275bdb9129f26929c11694 100644 (file)
@@ -1222,6 +1222,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;
 
        /*
@@ -1243,6 +1245,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;
@@ -1292,9 +1295,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,