Skip to content

Commit 7279ff3

Browse files
lgdacunhigaw
authored andcommitted
plugin/solidigm: Added EXTENDED vs-internal-log option.
EXTENDED option to extract logs that slows things down during vs-internal-log. Signed-off-by: Leonardo da Cunha <[email protected]>
1 parent 647d0a2 commit 7279ff3

File tree

4 files changed

+51
-22
lines changed

4 files changed

+51
-22
lines changed

Documentation/nvme-solidigm-vs-internal-log.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ OPTIONS
2424
-------
2525
-t <type>::
2626
--log-type=<type>::
27-
Specify the type of log to retrieve. Valid options are ALL, CIT, HIT, NLOG, ASSERT, and EVENT. Defaults to ALL.
27+
Specify the type of log to retrieve. Valid options are ALL, CIT, HIT, NLOG, ASSERT,
28+
EVENT, and EXTENDED. Defaults to ALL.
29+
The EXTENDED option generates logs that may take longer time or affect drive performance,
30+
but provides more comprehensive debugging information.
2831

2932
-d <dir>::
3033
--output-dir=<dir>::
@@ -54,6 +57,12 @@ EXAMPLES
5457
# nvme solidigm vs-internal-log /dev/nvme0 -v
5558
------------
5659

60+
* Retrieve extended logs:
61+
+
62+
------------
63+
# nvme solidigm vs-internal-log /dev/nvme0 -t EXTENDED
64+
------------
65+
5766
NVME
5867
----
5968
Part of the nvme-user suite

completions/_nvme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ _nvme () {
486486
(vs-internal-log)
487487
local _vs_internal_log
488488
_vs_internal_log=(
489-
--type':Log type: ALL, CIT, HIT, NLOG, ASSERT, EVENT. Defaults to ALL.'
489+
--type':Log type: ALL, CIT, HIT, NLOG, ASSERT, EVENT, EXTENDED. Defaults to ALL.'
490490
-t':alias for --type'
491491
--dir-name':Output directory; defaults to current working directory.'
492492
-d':alias for --dir-name'

plugins/solidigm/solidigm-internal-logs.c

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@
2424

2525
#define DWORD_SIZE 4
2626
#define LOG_FILE_PERMISSION 0644
27+
#define ATMOS_MODEL_PREFIX "SOLIDIGM SB5"
2728

2829
enum log_type {
2930
NLOG = 0,
3031
EVENTLOG = 1,
3132
ASSERTLOG = 2,
3233
HIT,
3334
CIT,
34-
ALL
35+
ALL,
36+
EXTENDED
3537
};
3638

3739
#pragma pack(push, internal_logs, 1)
@@ -136,7 +138,6 @@ struct ilog {
136138
struct config *cfg;
137139
int count;
138140
struct nvme_id_ctrl id_ctrl;
139-
enum nvme_telemetry_da max_da;
140141
};
141142

142143
static void print_nlog_header(__u8 *buffer)
@@ -519,17 +520,32 @@ static int ilog_ensure_dump_id_ctrl(struct ilog *ilog)
519520
first = false;
520521
err = ilog_dump_identify_page(ilog, &idctrl, 0);
521522

522-
if (err)
523-
return err;
523+
if (!err)
524+
ilog->count++;
525+
526+
return err;
527+
}
524528

525-
ilog->count++;
529+
static bool is_atmos(struct ilog *ilog)
530+
{
531+
ilog_ensure_dump_id_ctrl(ilog);
532+
return !strncmp(ilog->id_ctrl.mn, ATMOS_MODEL_PREFIX, sizeof(ATMOS_MODEL_PREFIX) - 1);
533+
}
534+
535+
static enum nvme_telemetry_da get_max_da(struct ilog *ilog, enum log_type ttype)
536+
{
537+
enum nvme_telemetry_da max_da = NVME_TELEMETRY_DA_1;
538+
539+
ilog_ensure_dump_id_ctrl(ilog);
540+
541+
if (is_atmos(ilog) && ttype != EXTENDED)
542+
return NVME_TELEMETRY_DA_3;
526543

527544
if (ilog->id_ctrl.lpa & 0x8)
528-
ilog->max_da = NVME_TELEMETRY_DA_3;
545+
max_da = NVME_TELEMETRY_DA_3;
529546
if (ilog->id_ctrl.lpa & 0x40)
530-
ilog->max_da = NVME_TELEMETRY_DA_4;
531-
532-
return err;
547+
max_da = NVME_TELEMETRY_DA_4;
548+
return max_da;
533549
}
534550

535551
static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
@@ -546,7 +562,7 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
546562
if (err)
547563
return err;
548564

549-
da = ilog->max_da;
565+
da = get_max_da(ilog, ttype);
550566
mdts = ilog->id_ctrl.mdts;
551567

552568
if (da == 4) {
@@ -564,6 +580,8 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
564580

565581
switch (ttype) {
566582
case HIT:
583+
case ALL:
584+
case EXTENDED:
567585
file_name = "lid_0x07_lsp_0x01_lsi_0x0000.bin";
568586
log.desc = "Host Initiated Telemetry";
569587
err = sldgm_dynamic_telemetry(dev_fd(ilog->dev), true, false, false, mdts,
@@ -847,9 +865,9 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command,
847865
};
848866

849867
OPT_ARGS(opts) = {
850-
OPT_STRING("type", 't', "ALL|CIT|HIT|NLOG|ASSERT|EVENT", &cfg.type, type),
868+
OPT_STRING("type", 't', "ALL|CIT|HIT|NLOG|ASSERT|EVENT|EXTENDED", &cfg.type, type),
851869
OPT_STRING("dir-name", 'd', "DIRECTORY", &cfg.out_dir, out_dir),
852-
OPT_FLAG("verbose", 'v', &cfg.verbose, verbose),
870+
OPT_FLAG("verbose", 'v', &cfg.verbose, verbose),
853871
OPT_END()
854872
};
855873

@@ -874,6 +892,8 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command,
874892
log_type = ASSERTLOG;
875893
else if (!strcmp(cfg.type, "EVENT"))
876894
log_type = EVENTLOG;
895+
else if (!strcmp(cfg.type, "EXTENDED"))
896+
log_type = EXTENDED;
877897
else {
878898
fprintf(stderr, "Invalid log type: %s\n", cfg.type);
879899
return -EINVAL;
@@ -909,42 +929,42 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command,
909929
output_path = full_folder;
910930

911931
/* Retrieve first logs that records actions to retrieve other logs */
912-
if (log_type == ALL || log_type == HIT) {
913-
err = ilog_dump_telemetry(&ilog, HIT);
932+
if (log_type == ALL || log_type == HIT || log_type == EXTENDED) {
933+
err = ilog_dump_telemetry(&ilog, log_type);
914934
if (err == 0)
915935
ilog.count++;
916936
else if (err < 0)
917937
perror("Error retrieving Host Initiated Telemetry");
918938
}
919-
if (log_type == ALL || log_type == NLOG) {
939+
if (log_type == ALL || log_type == NLOG || log_type == EXTENDED) {
920940
err = ilog_dump_nlogs(&ilog, -1);
921941
if (err == 0)
922942
ilog.count++;
923943
else if (err < 0)
924944
perror("Error retrieving Nlog");
925945
}
926-
if (log_type == ALL || log_type == CIT) {
946+
if (log_type == ALL || log_type == CIT || log_type == EXTENDED) {
927947
err = ilog_dump_telemetry(&ilog, CIT);
928948
if (err == 0)
929949
ilog.count++;
930950
else if (err < 0)
931951
perror("Error retrieving Controller Initiated Telemetry");
932952
}
933-
if (log_type == ALL || log_type == ASSERTLOG) {
953+
if (log_type == ALL || log_type == ASSERTLOG || log_type == EXTENDED) {
934954
err = ilog_dump_assert_logs(&ilog);
935955
if (err == 0)
936956
ilog.count++;
937957
else if (err < 0)
938958
perror("Error retrieving Assert log");
939959
}
940-
if (log_type == ALL || log_type == EVENTLOG) {
960+
if (log_type == ALL || log_type == EVENTLOG || log_type == EXTENDED) {
941961
err = ilog_dump_event_logs(&ilog);
942962
if (err == 0)
943963
ilog.count++;
944964
else if (err < 0)
945965
perror("Error retrieving Event log");
946966
}
947-
if (log_type == ALL) {
967+
if (log_type == ALL || log_type == EXTENDED) {
948968
err = ilog_dump_identify_pages(&ilog);
949969
if (err < 0)
950970
perror("Error retrieving Identify pages");

plugins/solidigm/solidigm-nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "cmd.h"
1515

16-
#define SOLIDIGM_PLUGIN_VERSION "1.13"
16+
#define SOLIDIGM_PLUGIN_VERSION "1.14"
1717

1818
PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_VERSION),
1919
COMMAND_LIST(

0 commit comments

Comments
 (0)