* [PATCH 0/3] nvme-cli: supplement and fixup for smart-log
@ 2017-06-21 5:09 Guan Junxiong
2017-06-21 5:09 ` [PATCH 1/3] nvme-cli: add thermal management fields " Guan Junxiong
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Guan Junxiong @ 2017-06-21 5:09 UTC (permalink / raw)
NVMe 1.3 introduces new thermal management temperature related
fields into the smart log page. The first patch adds those fields
into smart-log command.
Besides, next two patches address some fixup for smart-log such as
adding temperatature sensor fields in json_smart_log and synchronizing
the documenation for smart-log with the implementation of output-format
option.
Guan Junxiong (3):
nvme-cli: add thermal management fields for smart-log
nvme-cli: add temperature sensor fields in json_smart_log
nvme-cli: add output-format discription for smart-log documents
Documentation/nvme-smart-log.1 | 8 ++++++++
Documentation/nvme-smart-log.html | 12 ++++++++++++
Documentation/nvme-smart-log.txt | 5 +++++
linux/nvme.h | 6 +++++-
nvme-print.c | 24 ++++++++++++++++++++++++
5 files changed, 54 insertions(+), 1 deletion(-)
--
2.11.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] nvme-cli: add thermal management fields for smart-log
2017-06-21 5:09 [PATCH 0/3] nvme-cli: supplement and fixup for smart-log Guan Junxiong
@ 2017-06-21 5:09 ` Guan Junxiong
2017-06-21 5:09 ` [PATCH 2/3] nvme-cli: add temperature sensor fields in json_smart_log Guan Junxiong
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Guan Junxiong @ 2017-06-21 5:09 UTC (permalink / raw)
NVMe 1.3 introduce new thermal management temperature related
fields into the smart log page. Those fileds include
two temperature transition counts and two total time.
Signed-off-by: Guan Junxiong <guanjunxiong at huawei.com>
---
linux/nvme.h | 6 +++++-
nvme-print.c | 12 ++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/linux/nvme.h b/linux/nvme.h
index b2c8dbb..d5f89f9 100644
--- a/linux/nvme.h
+++ b/linux/nvme.h
@@ -327,7 +327,11 @@ struct nvme_smart_log {
__le32 warning_temp_time;
__le32 critical_comp_time;
__le16 temp_sensor[8];
- __u8 rsvd216[296];
+ __le32 thm_temp1_trans_count;
+ __le32 thm_temp2_trans_count;
+ __le32 thm_temp1_total_time;
+ __le32 thm_temp2_total_time;
+ __u8 rsvd232[280];
};
enum {
diff --git a/nvme-print.c b/nvme-print.c
index 2da5acd..1aacf11 100644
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -901,6 +901,10 @@ void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char
printf("Temperature Sensor %d : %d C\n", c + 1,
temp - 273);
}
+ printf("Thermal Management T1 Trans Count : %u\n", le32_to_cpu(smart->thm_temp1_trans_count));
+ printf("Thermal Management T2 Trans Count : %u\n", le32_to_cpu(smart->thm_temp2_trans_count));
+ printf("Thermal Management T1 Total Time : %u\n", le32_to_cpu(smart->thm_temp1_total_time));
+ printf("Thermal Management T2 Total Time : %u\n", le32_to_cpu(smart->thm_temp2_total_time));
}
char *nvme_feature_to_string(int feature)
@@ -1554,6 +1558,14 @@ void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char
le32_to_cpu(smart->warning_temp_time));
json_object_add_value_int(root, "critical_comp_time",
le32_to_cpu(smart->critical_comp_time));
+ json_object_add_value_int(root, "thm_temp1_trans_count",
+ le32_to_cpu(smart->thm_temp1_trans_count));
+ json_object_add_value_int(root, "thm_temp2_trans_count",
+ le32_to_cpu(smart->thm_temp2_trans_count));
+ json_object_add_value_int(root, "thm_temp1_total_time",
+ le32_to_cpu(smart->thm_temp1_total_time));
+ json_object_add_value_int(root, "thm_temp2_total_time",
+ le32_to_cpu(smart->thm_temp2_total_time));
json_print_object(root, NULL);
printf("\n");
--
2.11.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] nvme-cli: add temperature sensor fields in json_smart_log
2017-06-21 5:09 [PATCH 0/3] nvme-cli: supplement and fixup for smart-log Guan Junxiong
2017-06-21 5:09 ` [PATCH 1/3] nvme-cli: add thermal management fields " Guan Junxiong
@ 2017-06-21 5:09 ` Guan Junxiong
2017-06-21 5:09 ` [PATCH 3/3] nvme-cli: add output-format discription for smart-log Guan Junxiong
2017-06-26 20:00 ` [PATCH 0/3] nvme-cli: supplement and fixup " Keith Busch
3 siblings, 0 replies; 5+ messages in thread
From: Guan Junxiong @ 2017-06-21 5:09 UTC (permalink / raw)
Signed-off-by: Guan Junxiong <guanjunxiong at huawei.com>
---
nvme-print.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/nvme-print.c b/nvme-print.c
index 1aacf11..8c873cd 100644
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -1522,6 +1522,8 @@ void json_fw_log(struct nvme_firmware_log_page *fw_log, const char *devname)
void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char *devname)
{
struct json_object *root;
+ int c;
+ char key[21];
unsigned int temperature = ((smart->temperature[1] << 8) |
smart->temperature[0]);
@@ -1558,6 +1560,16 @@ void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char
le32_to_cpu(smart->warning_temp_time));
json_object_add_value_int(root, "critical_comp_time",
le32_to_cpu(smart->critical_comp_time));
+
+ for (c=0; c < 8; c++) {
+ __s32 temp = le16_to_cpu(smart->temp_sensor[c]);
+
+ if (temp == 0)
+ continue;
+ sprintf(key, "temperature_sensor_%d",c+1);
+ json_object_add_value_int(root, key, temp);
+ }
+
json_object_add_value_int(root, "thm_temp1_trans_count",
le32_to_cpu(smart->thm_temp1_trans_count));
json_object_add_value_int(root, "thm_temp2_trans_count",
--
2.11.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] nvme-cli: add output-format discription for smart-log
2017-06-21 5:09 [PATCH 0/3] nvme-cli: supplement and fixup for smart-log Guan Junxiong
2017-06-21 5:09 ` [PATCH 1/3] nvme-cli: add thermal management fields " Guan Junxiong
2017-06-21 5:09 ` [PATCH 2/3] nvme-cli: add temperature sensor fields in json_smart_log Guan Junxiong
@ 2017-06-21 5:09 ` Guan Junxiong
2017-06-26 20:00 ` [PATCH 0/3] nvme-cli: supplement and fixup " Keith Busch
3 siblings, 0 replies; 5+ messages in thread
From: Guan Junxiong @ 2017-06-21 5:09 UTC (permalink / raw)
The nvme smart-log command has implemented output-format option,
but the documentation of the command doesn't reflect this. This
patch synchronizes the documentation with the implemenation.
Signed-off-by: Guan Junxiong <guanjunxiong at huawei.com>
---
I don't know why nvme-smart-log.html fails when applied.
It sounds like this file's end of line is in Windows format in a whole
and git has a bug about processing the EOL.
Maybe maintainer should apply this patch manually.
Documentation/nvme-smart-log.1 | 8 ++++++++
Documentation/nvme-smart-log.html | 12 ++++++++++++
Documentation/nvme-smart-log.txt | 5 +++++
3 files changed, 25 insertions(+)
diff --git a/Documentation/nvme-smart-log.1 b/Documentation/nvme-smart-log.1
index 40edd10..793c0bf 100644
--- a/Documentation/nvme-smart-log.1
+++ b/Documentation/nvme-smart-log.1
@@ -54,6 +54,14 @@ Retrieve the SMART log for the given nsid\&. This is optional and its success ma
.RS 4
Print the raw SMART log buffer to stdout\&.
.RE
+.PP
+\-o <format>, \-\-output\-format=<format>
+.RS 4
+Set the reporting format to
+\fInormal\fR,
+\fIjson\fR, or
+\fIbinary\fR\&. Only one output format can be used at a time\&.
+.RE
.SH "EXAMPLES"
.sp
.RS 4
diff --git a/Documentation/nvme-smart-log.html b/Documentation/nvme-smart-log.html
index 6cdebba..2bf7545 100644
--- a/Documentation/nvme-smart-log.html
+++ b/Documentation/nvme-smart-log.html
@@ -801,6 +801,18 @@ printed to stdout for another program to parse.</p></div>
Print the raw SMART log buffer to stdout.
</p>
</dd>
+<dt class="hdlist1">
+-o <format>
+</dt>
+<dt class="hdlist1">
+--output-format=<format>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
+</p>
+</dd>
</dl></div>
</div>
</div>
diff --git a/Documentation/nvme-smart-log.txt b/Documentation/nvme-smart-log.txt
index a9d1eac..2971c94 100644
--- a/Documentation/nvme-smart-log.txt
+++ b/Documentation/nvme-smart-log.txt
@@ -38,6 +38,11 @@ OPTIONS
--raw-binary::
Print the raw SMART log buffer to stdout.
+-o <format>::
+--output-format=<format>::
+ Set the reporting format to 'normal', 'json', or
+ 'binary'. Only one output format can be used at a time.
+
EXAMPLES
--------
* Print the SMART log page in a human readable format:
--
2.11.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 0/3] nvme-cli: supplement and fixup for smart-log
2017-06-21 5:09 [PATCH 0/3] nvme-cli: supplement and fixup for smart-log Guan Junxiong
` (2 preceding siblings ...)
2017-06-21 5:09 ` [PATCH 3/3] nvme-cli: add output-format discription for smart-log Guan Junxiong
@ 2017-06-26 20:00 ` Keith Busch
3 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2017-06-26 20:00 UTC (permalink / raw)
On Wed, Jun 21, 2017@01:09:21PM +0800, Guan Junxiong wrote:
> NVMe 1.3 introduces new thermal management temperature related
> fields into the smart log page. The first patch adds those fields
> into smart-log command.
>
> Besides, next two patches address some fixup for smart-log such as
> adding temperatature sensor fields in json_smart_log and synchronizing
> the documenation for smart-log with the implementation of output-format
> option.
Thanks, all applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-26 20:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 5:09 [PATCH 0/3] nvme-cli: supplement and fixup for smart-log Guan Junxiong
2017-06-21 5:09 ` [PATCH 1/3] nvme-cli: add thermal management fields " Guan Junxiong
2017-06-21 5:09 ` [PATCH 2/3] nvme-cli: add temperature sensor fields in json_smart_log Guan Junxiong
2017-06-21 5:09 ` [PATCH 3/3] nvme-cli: add output-format discription for smart-log Guan Junxiong
2017-06-26 20:00 ` [PATCH 0/3] nvme-cli: supplement and fixup " Keith Busch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.