...
...
12
nvme: Add warning for PST table memory allocation failure in
12
nvme: Add warning for PST table memory allocation failure in
13
nvme_configure_apst
13
nvme_configure_apst
14
nvme: add sysfs interface for APST table updates
14
nvme: add sysfs interface for APST table updates
15
nvme: add per-controller sysfs interface for APST configuration
15
nvme: add per-controller sysfs interface for APST configuration
16
16
17
Changes Since v1
17
Changes in v2
18
18
19
Add mutex_lock in nvme_set_latency_tolerance() for Potential competition
19
Add mutex_lock in nvme_set_latency_tolerance() for Potential competition
20
between nvme_set_latency_tolerance() and apst_update_store().
20
between nvme_set_latency_tolerance() and apst_update_store().
21
21
22
Changes in v3
23
In PACH nvme: add sysfs interface for APST table updates,Add why dynamic APST
24
updates are needed in the commit message, fix code formatting issues.
22
25
23
drivers/nvme/host/core.c | 24 ++++++++++------
26
drivers/nvme/host/core.c | 24 ++++++++++------
24
drivers/nvme/host/nvme.h | 6 ++++
27
drivers/nvme/host/nvme.h | 6 ++++
25
drivers/nvme/host/sysfs.c | 59 +++++++++++++++++++++++++++++++++++++++
28
drivers/nvme/host/sysfs.c | 59 +++++++++++++++++++++++++++++++++++++++
26
3 files changed, 81 insertions(+), 8 deletions(-)
29
3 files changed, 81 insertions(+), 8 deletions(-)
27
30
28
--
31
--
29
2.25.1
32
2.25.1
diff view generated by jsdifflib
1
From: Yaxiong Tian <tianyaxiong@kylinos.cn>
1
From: Yaxiong Tian <tianyaxiong@kylinos.cn>
2
2
3
Currently the function fails silently on PST table memory allocation failure.
3
Currently the function fails silently on PST table memory allocation failure.
4
Add warning messages to improve error visibility.
4
Add warning messages to improve error visibility.
5
5
6
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
6
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
7
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
7
---
8
---
8
drivers/nvme/host/core.c | 4 +++-
9
drivers/nvme/host/core.c | 4 +++-
9
1 file changed, 3 insertions(+), 1 deletion(-)
10
1 file changed, 3 insertions(+), 1 deletion(-)
10
11
...
...
diff view generated by jsdifflib
1
From: Yaxiong Tian <tianyaxiong@kylinos.cn>
1
From: Yaxiong Tian <tianyaxiong@kylinos.cn>
2
3
In desktop systems, users can choose between power-saving mode and
4
performance mode. These two modes involve different trade-offs between
5
NVMe performance and power efficiency, thus requiring dynamic updates to APST.
2
6
3
Currently, the APST (Autonomous Power State Transition) table can only be
7
Currently, the APST (Autonomous Power State Transition) table can only be
4
updated during module initialization via module parameters or indirectly
8
updated during module initialization via module parameters or indirectly
5
by setting QoS latency requirements. This patch adds a direct sysfs
9
by setting QoS latency requirements. This patch adds a direct sysfs
6
interface to allow dynamic updates to the APST table at runtime.
10
interface to allow dynamic updates to the APST table at runtime.
...
...
17
21
18
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
22
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
19
---
23
---
20
drivers/nvme/host/core.c | 9 +++++++--
24
drivers/nvme/host/core.c | 9 +++++++--
21
drivers/nvme/host/nvme.h | 2 ++
25
drivers/nvme/host/nvme.h | 2 ++
22
drivers/nvme/host/sysfs.c | 23 +++++++++++++++++++++++
26
drivers/nvme/host/sysfs.c | 24 ++++++++++++++++++++++++
23
3 files changed, 32 insertions(+), 2 deletions(-)
27
3 files changed, 33 insertions(+), 2 deletions(-)
24
28
25
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
29
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
26
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
27
--- a/drivers/nvme/host/core.c
31
--- a/drivers/nvme/host/core.c
28
+++ b/drivers/nvme/host/core.c
32
+++ b/drivers/nvme/host/core.c
...
...
87
91
88
+static ssize_t apst_update_store(struct device *dev,
92
+static ssize_t apst_update_store(struct device *dev,
89
+                     struct device_attribute *attr,
93
+                     struct device_attribute *attr,
90
+                     const char *buf, size_t size)
94
+                     const char *buf, size_t size)
91
+{
95
+{
96
+    struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
97
+    bool bool_data = false;
92
+    int err;
98
+    int err;
93
+    bool bool_data = false;
99
+
94
+    struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
95
+    err = kstrtobool(buf, &bool_data);
100
+    err = kstrtobool(buf, &bool_data);
96
+
101
+
97
+    if (err)
102
+    if (err)
98
+        return err;
103
+        return err;
99
+
104
+
...
...
diff view generated by jsdifflib
...
...
19
19
20
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
20
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
21
---
21
---
22
drivers/nvme/host/core.c | 16 ++++++++++------
22
drivers/nvme/host/core.c | 16 ++++++++++------
23
drivers/nvme/host/nvme.h | 4 ++++
23
drivers/nvme/host/nvme.h | 4 ++++
24
drivers/nvme/host/sysfs.c | 36 ++++++++++++++++++++++++++++++++++++
24
drivers/nvme/host/sysfs.c | 38 ++++++++++++++++++++++++++++++++++++++
25
3 files changed, 50 insertions(+), 6 deletions(-)
25
3 files changed, 52 insertions(+), 6 deletions(-)
26
26
27
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
27
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
28
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
29
--- a/drivers/nvme/host/core.c
29
--- a/drivers/nvme/host/core.c
30
+++ b/drivers/nvme/host/core.c
30
+++ b/drivers/nvme/host/core.c
...
...
102
+#define nvme_apst_show_and_store_function(field)                \
102
+#define nvme_apst_show_and_store_function(field)                \
103
+static ssize_t field##_show(struct device *dev,        \
103
+static ssize_t field##_show(struct device *dev,        \
104
+             struct device_attribute *attr, char *buf)    \
104
+             struct device_attribute *attr, char *buf)    \
105
+{                                    \
105
+{                                    \
106
+    struct nvme_ctrl *ctrl = dev_get_drvdata(dev);            \
106
+    struct nvme_ctrl *ctrl = dev_get_drvdata(dev);            \
107
+\
107
+    return sysfs_emit(buf, "%llu\n", ctrl->field);    \
108
+    return sysfs_emit(buf, "%llu\n", ctrl->field);    \
108
+}                                    \
109
+}                                    \
109
+                                    \
110
+                                    \
110
+static ssize_t field##_store(struct device *dev,        \
111
+static ssize_t field##_store(struct device *dev,        \
111
+             struct device_attribute *attr,        \
112
+             struct device_attribute *attr,        \
112
+             const char *buf, size_t size)        \
113
+             const char *buf, size_t size)        \
113
+{                                    \
114
+{                                    \
115
+    struct nvme_ctrl *ctrl = dev_get_drvdata(dev);            \
116
+    u64 data = 0;                    \
114
+    int err;                        \
117
+    int err;                        \
115
+    u64 data = 0;                    \
118
+\
116
+    struct nvme_ctrl *ctrl = dev_get_drvdata(dev);            \
117
+    err = kstrtou64(buf, 0, &data);        \
119
+    err = kstrtou64(buf, 0, &data);        \
118
+    if (err < 0)                        \
120
+    if (err < 0)                        \
119
+        return err;                        \
121
+        return err;                        \
120
+                            \
122
+                            \
121
+    mutex_lock(&ctrl->apst_lock);        \
123
+    mutex_lock(&ctrl->apst_lock);        \
...
...
diff view generated by jsdifflib