nvme-cli: supplement and fixup for smart-log
Subsystems (2)
cover nvme-cli: supplement and fixup for smart-log
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(-)
Signature · 1 line
2.11.1
PATCH 1/3 nvme-cli: add thermal management fields for smart-log
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.
--- linux/nvme.h | 6 +++++- nvme-print.c | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
linux/nvme.h +5 -1
@@ -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 {
nvme-print.c +12 -0
@@ -901,6 +901,10 @@ void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const charprintf ("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" );
Signature · 1 line
2.11.1
PATCH 2/3 nvme-cli: add temperature sensor fields in json_smart_log
In reply to Guan Junxiong--- nvme-print.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
nvme-print.c +12 -0
@@ -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",
Signature · 1 line
2.11.1
PATCH 3/3 nvme-cli: add output-format discription for smart-log
In reply to Guan JunxiongThe 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.
---
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(+)
Documentation/nvme-smart-log.1 +8 -0
@@ -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
Documentation/nvme-smart-log.html +12 -0
@@ -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>
Documentation/nvme-smart-log.txt +5 -0
@@ -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:
Signature · 1 line
2.11.1
cover nvme-cli: supplement and fixup for smart-log
In reply to Guan JunxiongQuoted 8 lines · Guan Junxiong
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_logand synchronizing the documenation for smart-log with the implementation of output-format option.
Thanks, all applied.