nvme-cli: Some minors changes in PEL
v2 cover nvme-cli: Some minors changes in PEL
From: Wen Xiong <[email protected]>
During NVME hardware bringup, our hardware IO team give some suggestions/improvements for PEL support in linux.
Changes in V2:
- Add cover letter in the patch series
- Add "add_bitmap" function in Decode bitmap patch
- Add output of "set feature" event
Wen Xiong (5):
nvme-cli: Decode "Supported Events Bitmap" in PEL header
nvme-cli: Adds event number in persistent event entries
nvme-cli: Adds readable firmware level in persistent
nvme-cli: Add support set feature event in PEL
nvme-cli: Add support Telemetry CRT in PEL
nvme-print.c | 138 +++++++++++++++++++++++++++++++++++++++------------ nvme.c | 4 +- 2 files changed, 107 insertions(+), 35 deletions(-)
Signature · 1 line
2.27.0
PATCH v2 1/5 nvme-cli: Decode "Supported Events Bitmap" in PEL header
From: Wen Xiong <[email protected]>
"Supported Events Bitmap" in PEL header shows what events are supported in current nvme devices.
Persistent Event Log for device: nvme0n1
Action for Persistent Event Log: 0
..
..
..
Supported Events Bitmap:
Support SMART/Health Log Snapshot Event(0x1)
Support Firmware Commit Event(0x2)
Support Timestamp Change Event(0x3)
Support Power-on or Reset Event(0x4)
Support NVM Subsystem Hardware Error Event(0x5)
Support Change Namespace Event(0x6)
Support Format NVM Start Event(0x7)
Support Format NVM Completion Event(0x8)
Support Sanitize Start Event(0x9)
Support Sanitize Completion Event(0xa)
Support Set Feature Event(0xb)
Support Set Telemetry CRT Event(0xc)
Support Thermal Excursion Event(0xd)--- nvme-print.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ nvme.c | 4 ++-- 2 files changed, 48 insertions(+), 8 deletions(-)
nvme-print.c +46 -6
@@ -1053,6 +1053,26 @@ void nvme_show_predictable_latency_event_agg_log( } } +const char *nvme_pel_event_to_string (int type) +{ +switch (type) { +case NVME_PEL_SMART_HEALTH_EVENT :return "SMART/Health Log Snapshot Event(0x1)" ; +case NVME_PEL_FW_COMMIT_EVENT :return "Firmware Commit Event(0x2)" ; +case NVME_PEL_TIMESTAMP_EVENT :return "Timestamp Change Event(0x3)" ; +case NVME_PEL_POWER_ON_RESET_EVENT :return "Power-on or Reset Event(0x4)" ; +case NVME_PEL_NSS_HW_ERROR_EVENT :return "NVM Subsystem Hardware Error Event(0x5)" ; +case NVME_PEL_CHANGE_NS_EVENT :return "Change Namespace Event(0x6)" ; +case NVME_PEL_FORMAT_START_EVENT :return "Format NVM Start Event(0x7)" ; +case NVME_PEL_FORMAT_COMPLETION_EVENT :return "Format NVM Completion Event(0x8)" ; +case NVME_PEL_SANITIZE_START_EVENT :return "Sanitize Start Event(0x9)" ; +case NVME_PEL_SANITIZE_COMPLETION_EVENT :return "Sanitize Completion Event(0xa)" ; +case NVME_PEL_SET_FEATURE_EVENT :return "Set Feature Event(0xb)" ; +case NVME_PEL_TELEMETRY_CRT :return "Set Telemetry CRT Event(0xc)" ; +case NVME_PEL_THERMAL_EXCURSION_EVENT :return "Thermal Excursion Event(0xd)" ; +default :return NULL ; + } +} +static const char *nvme_show_nss_hw_error (__u16 error_code) {switch (error_code) {
@@ -1081,6 +1101,29 @@ static const char *nvme_show_nss_hw_error(__u16 error_code) } } +void add_bitmap (int i,__u8 seb,struct json_object *root,int json_flag) +{ +char evt_str[50 ]; +char key[128 ]; + +for (int bit =0 ; bit <8 ; bit++) { +if (nvme_pel_event_to_string (bit + i *8 )) { +if (json_flag ==1 ) { +sprintf (key,"bitmap_%x" , (bit + i *8 )); +if ((seb >> bit) &0x1 ) +snprintf (evt_str,sizeof (evt_str),"Support %s" , +nvme_pel_event_to_string (bit + i *8 )); +json_object_add_value_string (root, key, evt_str); + }else { +if (nvme_pel_event_to_string (bit + i *8 )) +if ((seb >> bit) &0x1 ) +printf (" Support %s\n" , +nvme_pel_event_to_string (bit + i *8 )); + } + } + } +} +void json_persistent_event_log (void *pevent_log_info,__u32 size) {struct json_object *root;
@@ -1151,9 +1194,7 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)for (int i =0 ; i <32 ; i++) {if (pevent_log_head->seb[i] ==0 )continue ; -sprintf (key,"bitmap_%d" , i); -json_object_add_value_uint (root, key, - pevent_log_head->seb[i]); +add_bitmap (i, pevent_log_head->seb[i], root,1 ); } }else { printf("No log data can be shown with this log len at least " \
@@ -1479,12 +1520,11 @@ void nvme_show_persistent_event_log(void *pevent_log_info, le32_to_cpu(pevent_log_head->rci));if (human)nvme_show_persistent_event_log_rci (pevent_log_head->rci); -printf ("Supported Events Bitmap: " ); +printf ("Supported Events Bitmap: \n" );for (int i =0 ; i <32 ; i++) {if (pevent_log_head->seb[i] ==0 )continue ; -printf (" BitMap[%d] is 0x%x\n" , i, - pevent_log_head->seb[i]); +add_bitmap (i, pevent_log_head->seb[i],NULL ,0 ); } }else { printf("No log data can be shown with this log len at least " \
nvme.c +2 -2
@@ -4922,7 +4922,7 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin nc =argconfig_parse_comma_sep_array (cfg.ctx_attrs, (int *)ctx_attrs,ARRAY_SIZE (ctx_attrs)); nb =argconfig_parse_comma_sep_array (cfg.blocks, (int *)nlbs,ARRAY_SIZE (nlbs)); - ns =argconfig_parse_comma_sep_array_long (cfg.slbas, slbas,ARRAY_SIZE (slbas)); + ns =argconfig_parse_comma_sep_array_long (cfg.slbas, (long long unsigned int *)slbas,ARRAY_SIZE (slbas)); nr =max (nc,max (nb, ns));if (!nr || nr >256 ) {fprintf (stderr,"No range definition provided\n" );
@@ -5067,7 +5067,7 @@ static int copy(int argc, char **argv, struct command *cmd, struct plugin *plugi } } -nvme_init_copy_range (copy, nlbs, slbas, eilbrts, elbatms, elbats, nr); +nvme_init_copy_range (copy, nlbs, (__u64 *)slbas, eilbrts, elbatms, elbats, nr); err = nvme_copy(fd, cfg.namespace_id, copy, cfg.sdlba, nr, cfg.prinfor, cfg.prinfow, cfg.dtype, cfg.dspec, cfg.format, cfg.lr,
Signature · 1 line
2.27.0
Re: [PATCH V2 1/5] nvme-cli: Decode "Supported Events Bitmap" in PEL header
Quoted 8 lines · On 11/18/21 8:57 AM, [email protected] wrote:
External email: Use caution opening links or attachments
From: Wen Xiong <[email protected]>
"Supported Events Bitmap" in PEL header shows what events are supported in current nvme devices.
Quoted 7 lines
Persistent Event Log for device: nvme0n1
Action for Persistent Event Log: 0
..
..
..
Supported Events Bitmap:Support SMART/Health Log Snapshot Event(0x1)
Support word is duplicate since we already have "Supported Events Bitmap" in the header of this message.
Quoted 24 lines
Support Firmware Commit Event(0x2) Support Timestamp Change Event(0x3) Support Power-on or Reset Event(0x4) Support NVM Subsystem Hardware Error Event(0x5) Support Change Namespace Event(0x6) Support Format NVM Start Event(0x7) Support Format NVM Completion Event(0x8) Support Sanitize Start Event(0x9) Support Sanitize Completion Event(0xa) Support Set Feature Event(0xb) Support Set Telemetry CRT Event(0xc) Support Thermal Excursion Event(0xd)Signed-off-by Wen Xiong <[email protected]>--- nvme-print.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ nvme.c | 4 ++-- 2 files changed, 48 insertions(+), 8 deletions(-)nvme-print.c +0
-0
nvme-print.c void nvme_show_predictable_latency_event_agg_log( · line 1057
Quoted 5 lines
nvme-print.c +2
-0@@ -1053,6 +1053,26 @@ void nvme_show_predictable_latency_event_agg_log( } } +const char *nvme_pel_event_to_string (int type) +{
type should be a type of enum nvme_persistent_event_types, is there a reason its type is int ?
Quoted 22 lines
nvme-print.c +18
-0+switch (type) { +case NVME_PEL_SMART_HEALTH_EVENT :return "SMART/Health Log Snapshot Event(0x1)" ; +case NVME_PEL_FW_COMMIT_EVENT :return "Firmware Commit Event(0x2)" ; +case NVME_PEL_TIMESTAMP_EVENT :return "Timestamp Change Event(0x3)" ; +case NVME_PEL_POWER_ON_RESET_EVENT :return "Power-on or Reset Event(0x4)" ; +case NVME_PEL_NSS_HW_ERROR_EVENT :return "NVM Subsystem Hardware Error Event(0x5)" ; +case NVME_PEL_CHANGE_NS_EVENT :return "Change Namespace Event(0x6)" ; +case NVME_PEL_FORMAT_START_EVENT :return "Format NVM Start Event(0x7)" ; +case NVME_PEL_FORMAT_COMPLETION_EVENT :return "Format NVM Completion Event(0x8)" ; +case NVME_PEL_SANITIZE_START_EVENT :return "Sanitize Start Event(0x9)" ; +case NVME_PEL_SANITIZE_COMPLETION_EVENT :return "Sanitize Completion Event(0xa)" ; +case NVME_PEL_SET_FEATURE_EVENT :return "Set Feature Event(0xb)" ; +case NVME_PEL_TELEMETRY_CRT :return "Set Telemetry CRT Event(0xc)" ; +case NVME_PEL_THERMAL_EXCURSION_EVENT :return "Thermal Excursion Event(0xd)" ; +default :return NULL ; + } +} +static const char *nvme_show_nss_hw_error (__u16 error_code) {switch (error_code) {
nvme-print.c static const char *nvme_show_nss_hw_error(__u16 error_code) · line 1108
Quoted 8 lines
nvme-print.c +5
-0@@ -1081,6 +1101,29 @@ static const char *nvme_show_nss_hw_error(__u16 error_code) } } +void add_bitmap (int i,__u8 seb,struct json_object *root,int json_flag) +{ +char evt_str[50 ]; +char key[128 ]; +
do we need to initialize above arrays to 0s ?
nvme-print.c static const char *nvme_show_nss_hw_error(__u16 error_code) · line 1111
Quoted 3 lines
nvme-print.c +3
-0+for (int bit =0 ; bit <8 ; bit++) { +if (nvme_pel_event_to_string (bit + i *8 )) { +if (json_flag ==1 ) {
If json_flag is going to take only two values then its type should be bool.
Quoted 69 lines
nvme-print.c +18
-6+sprintf (key,"bitmap_%x" , (bit + i *8 )); +if ((seb >> bit) &0x1 ) +snprintf (evt_str,sizeof (evt_str),"Support %s" , +nvme_pel_event_to_string (bit + i *8 )); +json_object_add_value_string (root, key, evt_str); + }else { +if (nvme_pel_event_to_string (bit + i *8 )) +if ((seb >> bit) &0x1 ) +printf (" Support %s\n" , +nvme_pel_event_to_string (bit + i *8 )); + } + } + } +} +void json_persistent_event_log (void *pevent_log_info,__u32 size) {struct json_object *root;@@ -1151,9 +1194,7 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)for (int i =0 ; i <32 ; i++) {if (pevent_log_head->seb[i] ==0 )continue ; -sprintf (key,"bitmap_%d" , i); -json_object_add_value_uint (root, key, - pevent_log_head->seb[i]); +add_bitmap (i, pevent_log_head->seb[i], root,1 ); } }else { printf("No log data can be shown with this log len at least " \@@ -1479,12 +1520,11 @@ void nvme_show_persistent_event_log(void *pevent_log_info, le32_to_cpu(pevent_log_head->rci));if (human)nvme_show_persistent_event_log_rci (pevent_log_head->rci); -printf ("Supported Events Bitmap: " ); +printf ("Supported Events Bitmap: \n" );for (int i =0 ; i <32 ; i++) {if (pevent_log_head->seb[i] ==0 )continue ; -printf (" BitMap[%d] is 0x%x\n" , i, - pevent_log_head->seb[i]); +add_bitmap (i, pevent_log_head->seb[i],NULL ,0 ); } }else { printf("No log data can be shown with this log len at least " \nvme.c +2
-3@@ -4922,7 +4922,7 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin nc =argconfig_parse_comma_sep_array (cfg.ctx_attrs, (int *)ctx_attrs,ARRAY_SIZE (ctx_attrs)); nb =argconfig_parse_comma_sep_array (cfg.blocks, (int *)nlbs,ARRAY_SIZE (nlbs)); - ns =argconfig_parse_comma_sep_array_long (cfg.slbas, slbas,ARRAY_SIZE (slbas)); + ns =argconfig_parse_comma_sep_array_long (cfg.slbas, (long long unsigned int *)slbas,ARRAY_SIZE (slbas)); nr =max (nc,max (nb, ns));if (!nr || nr >256 ) {fprintf (stderr,"No range definition provided\n" );@@ -5067,7 +5067,7 @@ static int copy(int argc, char **argv, struct command *cmd, struct plugin *plugi } } -nvme_init_copy_range (copy, nlbs, slbas, eilbrts, elbatms, elbats, nr); +nvme_init_copy_range (copy, nlbs, (__u64 *)slbas, eilbrts, elbatms, elbats, nr); err = nvme_copy(fd, cfg.namespace_id, copy, cfg.sdlba, nr, cfg.prinfor, cfg.prinfow, cfg.dtype, cfg.dspec, cfg.format, cfg.lr, --2.27.0
PATCH v2 2/5 nvme-cli: Adds event number in persistent event entries
In reply to [email protected]From: Wen Xiong <[email protected]>
Persistent Event Entries:
Event Number: 0
Event Type: SMART/Health Log Snapshot Event(0x1)
Event Type Revision: 1
Event Header Length: 21
Controller Identifier: 66
Event Timestamp: 44392
--- nvme-print.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
nvme-print.c +17 -16
@@ -1212,9 +1212,10 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size) le16_to_cpu(pevent_entry_head->el)) >= size)break ; valid_attrs =json_create_object (); - -json_object_add_value_uint (valid_attrs,"event_type" , - pevent_entry_head->etype); + +json_object_add_value_uint (valid_attrs,"event_number" , i); +json_object_add_value_string (valid_attrs,"event_type" , +nvme_pel_event_to_string (pevent_entry_head->etype));json_object_add_value_uint (valid_attrs,"event_type_rev" , pevent_entry_head->etype_rev); json_object_add_value_uint(valid_attrs, "event_header_len",
@@ -1543,8 +1544,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,if ((offset + pevent_entry_head->ehl +3 +le16_to_cpu (pevent_entry_head->el)) >= size)break ; - -printf ("Event Type: %u\n" , pevent_entry_head->etype); +printf ("Event Number: %u\n" , i); +printf ("Event Type: %s\n" ,nvme_pel_event_to_string (pevent_entry_head->etype));printf ("Event Type Revision: %u\n" , pevent_entry_head->etype_rev);printf ("Event Header Length: %u\n" , pevent_entry_head->ehl); printf("Controller Identifier: %u\n",
@@ -1560,12 +1561,12 @@ void nvme_show_persistent_event_log(void *pevent_log_info,switch (pevent_entry_head->etype) {case NVME_PEL_SMART_HEALTH_EVENT : smart_event = pevent_log_info + offset; -printf ("Smart Health Event: \n" ); +printf ("Smart Health Event Entry: \n" );nvme_show_smart_log (smart_event,NVME_NSID_ALL , devname, flags);break ;case NVME_PEL_FW_COMMIT_EVENT : fw_commit_event = pevent_log_info + offset; -printf ("FW Commit Event: \n" ); +printf ("FW Commit Event Entry: \n" );printf ("Old Firmware Revision: %" PRIu64"\n" ,le64_to_cpu (fw_commit_event->old_fw_rev)); printf("New Firmware Revision: %"PRIu64"\n",
@@ -1582,7 +1583,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,break ;case NVME_PEL_TIMESTAMP_EVENT : ts_change_event = pevent_log_info + offset; -printf ("Time Stamp Change Event: \n" ); +printf ("Time Stamp Change Event Entry: \n" );printf ("Previous Timestamp: %" PRIu64"\n" ,le64_to_cpu (ts_change_event->previous_timestamp)); printf("Milliseconds Since Reset: %"PRIu64"\n",
@@ -1594,7 +1595,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info, por_info_list = por_info_len /sizeof (*por_event); -printf ("Power On Reset Event: \n" ); +printf ("Power On Reset Event Entry: \n" ); fw_rev = pevent_log_info + offset;printf ("Firmware Revision: %" PRIu64"\n" ,le64_to_cpu (*fw_rev));printf ("Reset Information List: \n" );
@@ -1617,13 +1618,13 @@ void nvme_show_persistent_event_log(void *pevent_log_info,break ;case NVME_PEL_NSS_HW_ERROR_EVENT : nss_hw_err_event = pevent_log_info + offset; -printf ("NVM Subsystem Hardware Error Event Code: %u, %s\n" , +printf ("NVM Subsystem Hardware Error Event Code Entry: %u, %s\n" ,le16_to_cpu (nss_hw_err_event->nss_hw_err_event_code),nvme_show_nss_hw_error (nss_hw_err_event->nss_hw_err_event_code));break ;case NVME_PEL_CHANGE_NS_EVENT : ns_event = pevent_log_info + offset; -printf ("Change Namespace Event: \n" ); +printf ("Change Namespace Event Entry: \n" );printf ("Namespace Management CDW10: %u\n" ,le32_to_cpu (ns_event->nsmgt_cdw10)); printf("Namespace Size: %"PRIu64"\n",
@@ -1642,7 +1643,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,break ;case NVME_PEL_FORMAT_START_EVENT : format_start_event = pevent_log_info + offset; -printf ("Format NVM Start Event: \n" ); +printf ("Format NVM Start Event Entry: \n" );printf ("Namespace Identifier: %u\n" ,le32_to_cpu (format_start_event->nsid)); printf("Format NVM Attributes: %u\n",
@@ -1652,7 +1653,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,break ;case NVME_PEL_FORMAT_COMPLETION_EVENT : format_cmpln_event = pevent_log_info + offset; -printf ("Format NVM Completion Event: \n" ); +printf ("Format NVM Completion Event Entry: \n" );printf ("Namespace Identifier: %u\n" ,le32_to_cpu (format_cmpln_event->nsid)); printf("Smallest Format Progress Indicator: %u\n",
@@ -1666,7 +1667,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,break ;case NVME_PEL_SANITIZE_START_EVENT : sanitize_start_event = pevent_log_info + offset; -printf ("Sanitize Start Event: \n" ); +printf ("Sanitize Start Event Entry: \n" );printf ("SANICAP: %u\n" , sanitize_start_event->sani_cap);printf ("Sanitize CDW10: %u\n" ,le32_to_cpu (sanitize_start_event->sani_cdw10));
@@ -1675,7 +1676,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,break ;case NVME_PEL_SANITIZE_COMPLETION_EVENT : sanitize_cmpln_event = pevent_log_info + offset; -printf ("Sanitize Completion Event: \n" ); +printf ("Sanitize Completion Event Entry: \n" );printf ("Sanitize Progress: %u\n" ,le16_to_cpu (sanitize_cmpln_event->sani_prog)); printf("Sanitize Status: %u\n",
@@ -1685,7 +1686,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,break ;case NVME_PEL_THERMAL_EXCURSION_EVENT : thermal_exc_event = pevent_log_info + offset; -printf ("Thermal Excursion Event: \n" ); +printf ("Thermal Excursion Event Entry: \n" );printf ("Over Temperature: %u\n" , thermal_exc_event->over_temp);printf ("Threshold: %u\n" , thermal_exc_event->threshold);break ;
Signature · 1 line
2.27.0
Re: [PATCH V2 2/5] nvme-cli: Adds event number in persistent event entries
Quoted 5 lines · On 11/18/21 8:57 AM, [email protected] wrote:
External email: Use caution opening links or attachments
From: Wen Xiong <[email protected]>
Quoted 8 lines
Persistent Event Entries:
Event Number: 0
Event Type: SMART/Health Log Snapshot Event(0x1)
Event Type Revision: 1
Event Header Length: 21
Controller Identifier: 66
Event Timestamp: 44392
Please re write above commit log and resend.
PATCH v2 3/5 nvme-cli: Adds readable firmware level in persistent
In reply to [email protected]From: Wen Xiong <[email protected]>
For example, In Firmware Commit Event:
Old Firmware Revision: 3617604718875264338
New Firmware Revision: 3833777500989048146
changes to
Old Firmware Revision: 3617604718875264338 (REV.SP42) New Firmware Revision: 3833777500989048146 (REV.SP45)
--- nvme-print.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
nvme-print.c +21 -11
@@ -1132,6 +1132,7 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)__u32 offset, por_info_len, por_info_list;__u64 *fw_rev;char key[128 ]; +char fw_str[50 ];struct nvme_smart_log *smart_event;struct nvme_fw_commit_event *fw_commit_event;
@@ -1305,10 +1306,14 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)break ;case NVME_PEL_FW_COMMIT_EVENT : fw_commit_event = pevent_log_info + offset; -json_object_add_value_uint64 (valid_attrs,"old_fw_rev" , -le64_to_cpu (fw_commit_event->old_fw_rev)); -json_object_add_value_uint64 (valid_attrs,"new_fw_rev" , -le64_to_cpu (fw_commit_event->new_fw_rev)); +snprintf (fw_str,sizeof (fw_str),"%" PRIu64" (%s)" , +le64_to_cpu (fw_commit_event->old_fw_rev), +fw_to_string ((char *)&fw_commit_event->old_fw_rev)); +json_object_add_value_string (valid_attrs,"old_fw_rev" , fw_str); +snprintf (fw_str,sizeof (fw_str),"%" PRIu64" (%s)" , +le64_to_cpu (fw_commit_event->new_fw_rev), +fw_to_string ((char *)&fw_commit_event->new_fw_rev)); +json_object_add_value_string (valid_attrs,"new_fw_rev" , fw_str);json_object_add_value_uint (valid_attrs,"fw_commit_action" , fw_commit_event->fw_commit_action); json_object_add_value_uint(valid_attrs, "fw_slot",
@@ -1336,8 +1341,10 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size) por_info_list = por_info_len /sizeof (*por_event); fw_rev = pevent_log_info + offset; -json_object_add_value_uint64 (valid_attrs,"fw_rev" , -le64_to_cpu (*fw_rev)); +snprintf (fw_str,sizeof (fw_str),"%" PRIu64" (%s)" , +le64_to_cpu (*fw_rev), +fw_to_string ((char *)fw_rev)); +json_object_add_value_string (valid_attrs,"fw_rev" , fw_str);for (int i =0 ; i < por_info_list; i++) { por_event = pevent_log_info + offset +sizeof (*fw_rev) + i *sizeof (*por_event);
@@ -1567,10 +1574,12 @@ void nvme_show_persistent_event_log(void *pevent_log_info,case NVME_PEL_FW_COMMIT_EVENT : fw_commit_event = pevent_log_info + offset;printf ("FW Commit Event Entry: \n" ); -printf ("Old Firmware Revision: %" PRIu64"\n" , -le64_to_cpu (fw_commit_event->old_fw_rev)); -printf ("New Firmware Revision: %" PRIu64"\n" , -le64_to_cpu (fw_commit_event->new_fw_rev)); +printf ("Old Firmware Revision: %" PRIu64" (%s)\n" , +le64_to_cpu (fw_commit_event->old_fw_rev), +fw_to_string ((char *)&fw_commit_event->old_fw_rev)); +printf ("New Firmware Revision: %" PRIu64" (%s)\n" , +le64_to_cpu (fw_commit_event->new_fw_rev), +fw_to_string ((char *)&fw_commit_event->new_fw_rev));printf ("FW Commit Action: %u\n" , fw_commit_event->fw_commit_action);printf ("FW Slot: %u\n" , fw_commit_event->fw_slot);
@@ -1597,7 +1606,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,printf ("Power On Reset Event Entry: \n" ); fw_rev = pevent_log_info + offset; -printf ("Firmware Revision: %" PRIu64"\n" ,le64_to_cpu (*fw_rev)); +printf ("Firmware Revision: %" PRIu64" (%s)\n" ,le64_to_cpu (*fw_rev), +fw_to_string ((char *)fw_rev));printf ("Reset Information List: \n" );for (int i =0 ; i < por_info_list; i++) {
Signature · 1 line
2.27.0
Re: [PATCH V2 3/5] nvme-cli: Adds readable firmware level in persistent
Quoted 10 lines · On 11/18/21 8:57 AM, [email protected] wrote:
External email: Use caution opening links or attachments
From: Wen Xiong <[email protected]>
For example, In Firmware Commit Event:
Old Firmware Revision: 3617604718875264338
New Firmware Revision: 3833777500989048146
Quoted 7 lines
changes to
Old Firmware Revision: 3617604718875264338 (REV.SP42) New Firmware Revision: 3833777500989048146 (REV.SP45)
Signed-off-by Wen Xiong <[email protected]
This patch looks useful to me, but the commit log doesn't follow the style that we have in the git. Please have a look.
PATCH v2 4/5 nvme-cli: Add support set feature event in PEL
In reply to [email protected]From: Wen Xiong <[email protected]>
Add "Set Feature" event in PEL.
Persistent Event Entries:
Event Number: 0
Event Type: Set Feature Event(0xb)
Event Type Revision: 1
Event Header Length: 21
Controller Identifier: 65
Event Timestamp: 564587204146155
Vendor Specific Information Length: 0
Event Length: 16
Set Feature Event Entry:
Set Feature ID :0x7 (Number of Queues), value:0x270027
Number of IO Completion Queues Allocated (NCQA): 40 Number of IO Submission Queues Allocated (NSQA): 40
--- nvme-print.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
nvme-print.c +18 -0
@@ -1472,6 +1472,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info, {__u32 offset, por_info_len, por_info_list;__u64 *fw_rev; +int fid, cdw11, dword_cnt; +unsigned char *mem_buf =NULL ;struct nvme_smart_log *smart_event;struct nvme_fw_commit_event *fw_commit_event;struct nvme_time_stamp_change_event *ts_change_event;
@@ -1482,6 +1484,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,struct nvme_format_nvm_compln_event *format_cmpln_event;struct nvme_sanitize_start_event *sanitize_start_event;struct nvme_sanitize_compln_event *sanitize_cmpln_event; +struct nvme_set_feature_event *set_feat_event;struct nvme_thermal_exc_event *thermal_exc_event;struct nvme_persistent_event_log *pevent_log_head;struct nvme_persistent_event_entry *pevent_entry_head;
@@ -1694,6 +1697,21 @@ void nvme_show_persistent_event_log(void *pevent_log_info,printf ("Completion Information: %u\n" ,le16_to_cpu (sanitize_cmpln_event->cmpln_info));break ; +case NVME_PEL_SET_FEATURE_EVENT : + set_feat_event = pevent_log_info + offset; +printf ("Set Feature Event Entry: \n" ); + dword_cnt = set_feat_event->layout &0x03 ; + fid =le32_to_cpu (set_feat_event->cdw_mem[0 ]) &0x000f ; + cdw11 =le32_to_cpu (set_feat_event->cdw_mem[1 ]); + +if (((set_feat_event->layout &0xff ) >>2 ) !=0 ) + mem_buf = (unsigned char *)(set_feat_event +4 + dword_cnt *4 ); + +printf ("Set Feature ID :%#02x (%s), value:%#08x\n" , fid, +nvme_feature_to_string (fid), cdw11); + +nvme_feature_show_fields (fid, cdw11, mem_buf); +break ;case NVME_PEL_THERMAL_EXCURSION_EVENT : thermal_exc_event = pevent_log_info + offset;printf ("Thermal Excursion Event Entry: \n" );
Signature · 1 line
2.27.0
Re: [PATCH V2 4/5] nvme-cli: Add support set feature event in PEL
Quoted 48 lines · On 11/18/21 8:57 AM, [email protected] wrote:
External email: Use caution opening links or attachments
From: Wen Xiong <[email protected]>
Add "Set Feature" event in PEL.
Persistent Event Entries:
Event Number: 0
Event Type: Set Feature Event(0xb)
Event Type Revision: 1
Event Header Length: 21
Controller Identifier: 65
Event Timestamp: 564587204146155
Vendor Specific Information Length: 0
Event Length: 16
Set Feature Event Entry:
Set Feature ID :0x7 (Number of Queues), value:0x270027
Number of IO Completion Queues Allocated (NCQA): 40 Number of IO Submission Queues Allocated (NSQA): 40Signed-off-by Wen Xiong <[email protected]>--- nvme-print.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)nvme-print.c +3
-0@@ -1472,6 +1472,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info, {__u32 offset, por_info_len, por_info_list;__u64 *fw_rev; +int fid, cdw11, dword_cnt; +unsigned char *mem_buf =NULL ;struct nvme_smart_log *smart_event;struct nvme_fw_commit_event *fw_commit_event;struct nvme_time_stamp_change_event *ts_change_event;@@ -1482,6 +1484,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,struct nvme_format_nvm_compln_event *format_cmpln_event;struct nvme_sanitize_start_event *sanitize_start_event;struct nvme_sanitize_compln_event *sanitize_cmpln_event; +struct nvme_set_feature_event *set_feat_event;struct nvme_thermal_exc_event *thermal_exc_event;struct nvme_persistent_event_log *pevent_log_head;struct nvme_persistent_event_entry *pevent_entry_head;
nvme-print.c void nvme_show_persistent_event_log(void *pevent_log_info, · line 1702
Quoted 6 lines
nvme-print.c +3
-0@@ -1694,6 +1697,21 @@ void nvme_show_persistent_event_log(void *pevent_log_info,printf ("Completion Information: %u\n" ,le16_to_cpu (sanitize_cmpln_event->cmpln_info));break ; +case NVME_PEL_SET_FEATURE_EVENT : + set_feat_event = pevent_log_info + offset; +printf ("Set Feature Event Entry: \n" );
Usually prinf() statements are grouped together, is there a reason why above printf is not grouped with follwing printf() for in this switch case ?
Quoted 18 lines
nvme-print.c +12
-1+ dword_cnt = set_feat_event->layout &0x03 ; + fid =le32_to_cpu (set_feat_event->cdw_mem[0 ]) &0x000f ; + cdw11 =le32_to_cpu (set_feat_event->cdw_mem[1 ]); + +if (((set_feat_event->layout &0xff ) >>2 ) !=0 ) + mem_buf = (unsigned char *)(set_feat_event +4 + dword_cnt *4 ); + +printf ("Set Feature ID :%#02x (%s), value:%#08x\n" , fid, +nvme_feature_to_string (fid), cdw11); + +nvme_feature_show_fields (fid, cdw11, mem_buf); +break ;case NVME_PEL_THERMAL_EXCURSION_EVENT : thermal_exc_event = pevent_log_info + offset;printf ("Thermal Excursion Event Entry: \n" ); --2.27.0
PATCH v2 5/5 nvme-cli: Add support Telemetry CRT in PEL
In reply to [email protected]From: Wen Xiong <[email protected]>
Add "Telemetry CRT" event in PEL.
--- nvme-print.c | 3 +++ 1 file changed, 3 insertions(+)
nvme-print.c +3 -0
@@ -1712,6 +1712,9 @@ void nvme_show_persistent_event_log(void *pevent_log_info,nvme_feature_show_fields (fid, cdw11, mem_buf);break ; +case NVME_PEL_TELEMETRY_CRT : +d (pevent_log_info + offset,512 ,16 ,1 ); +break ;case NVME_PEL_THERMAL_EXCURSION_EVENT : thermal_exc_event = pevent_log_info + offset;printf ("Thermal Excursion Event Entry: \n" );
Signature · 1 line
2.27.0