diff --git a/Documentation/nvme-solidigm-vs-internal-log.txt b/Documentation/nvme-solidigm-vs-internal-log.txt index e488106b25..6f3dd4fbf3 100644 --- a/Documentation/nvme-solidigm-vs-internal-log.txt +++ b/Documentation/nvme-solidigm-vs-internal-log.txt @@ -24,7 +24,10 @@ OPTIONS ------- -t :: --log-type=:: - Specify the type of log to retrieve. Valid options are ALL, CIT, HIT, NLOG, ASSERT, and EVENT. Defaults to ALL. + Specify the type of log to retrieve. Valid options are ALL, CIT, HIT, NLOG, ASSERT, + EVENT, and EXTENDED. Defaults to ALL. + The EXTENDED option generates logs that may take longer time or affect drive performance, + but provides more comprehensive debugging information. -d :: --output-dir=:: @@ -54,6 +57,12 @@ EXAMPLES # nvme solidigm vs-internal-log /dev/nvme0 -v ------------ +* Retrieve extended logs: ++ +------------ +# nvme solidigm vs-internal-log /dev/nvme0 -t EXTENDED +------------ + NVME ---- Part of the nvme-user suite \ No newline at end of file diff --git a/completions/_nvme b/completions/_nvme index cfb18fd8f1..6f7226b828 100644 --- a/completions/_nvme +++ b/completions/_nvme @@ -486,7 +486,7 @@ _nvme () { (vs-internal-log) local _vs_internal_log _vs_internal_log=( - --type':Log type: ALL, CIT, HIT, NLOG, ASSERT, EVENT. Defaults to ALL.' + --type':Log type: ALL, CIT, HIT, NLOG, ASSERT, EVENT, EXTENDED. Defaults to ALL.' -t':alias for --type' --dir-name':Output directory; defaults to current working directory.' -d':alias for --dir-name' diff --git a/plugins/solidigm/solidigm-internal-logs.c b/plugins/solidigm/solidigm-internal-logs.c index 303d471275..1481fee9fd 100644 --- a/plugins/solidigm/solidigm-internal-logs.c +++ b/plugins/solidigm/solidigm-internal-logs.c @@ -24,6 +24,7 @@ #define DWORD_SIZE 4 #define LOG_FILE_PERMISSION 0644 +#define ATMOS_MODEL_PREFIX "SOLIDIGM SB5" enum log_type { NLOG = 0, @@ -31,7 +32,8 @@ enum log_type { ASSERTLOG = 2, HIT, CIT, - ALL + ALL, + EXTENDED }; #pragma pack(push, internal_logs, 1) @@ -136,7 +138,6 @@ struct ilog { struct config *cfg; int count; struct nvme_id_ctrl id_ctrl; - enum nvme_telemetry_da max_da; }; static void print_nlog_header(__u8 *buffer) @@ -519,17 +520,32 @@ static int ilog_ensure_dump_id_ctrl(struct ilog *ilog) first = false; err = ilog_dump_identify_page(ilog, &idctrl, 0); - if (err) - return err; + if (!err) + ilog->count++; + + return err; +} - ilog->count++; +static bool is_atmos(struct ilog *ilog) +{ + ilog_ensure_dump_id_ctrl(ilog); + return !strncmp(ilog->id_ctrl.mn, ATMOS_MODEL_PREFIX, sizeof(ATMOS_MODEL_PREFIX) - 1); +} + +static enum nvme_telemetry_da get_max_da(struct ilog *ilog, enum log_type ttype) +{ + enum nvme_telemetry_da max_da = NVME_TELEMETRY_DA_1; + + ilog_ensure_dump_id_ctrl(ilog); + + if (is_atmos(ilog) && ttype != EXTENDED) + return NVME_TELEMETRY_DA_3; if (ilog->id_ctrl.lpa & 0x8) - ilog->max_da = NVME_TELEMETRY_DA_3; + max_da = NVME_TELEMETRY_DA_3; if (ilog->id_ctrl.lpa & 0x40) - ilog->max_da = NVME_TELEMETRY_DA_4; - - return err; + max_da = NVME_TELEMETRY_DA_4; + return max_da; } 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) if (err) return err; - da = ilog->max_da; + da = get_max_da(ilog, ttype); mdts = ilog->id_ctrl.mdts; if (da == 4) { @@ -564,6 +580,8 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype) switch (ttype) { case HIT: + case ALL: + case EXTENDED: file_name = "lid_0x07_lsp_0x01_lsi_0x0000.bin"; log.desc = "Host Initiated Telemetry"; 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, }; OPT_ARGS(opts) = { - OPT_STRING("type", 't', "ALL|CIT|HIT|NLOG|ASSERT|EVENT", &cfg.type, type), + OPT_STRING("type", 't', "ALL|CIT|HIT|NLOG|ASSERT|EVENT|EXTENDED", &cfg.type, type), OPT_STRING("dir-name", 'd', "DIRECTORY", &cfg.out_dir, out_dir), - OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), + OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), OPT_END() }; @@ -874,6 +892,8 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command, log_type = ASSERTLOG; else if (!strcmp(cfg.type, "EVENT")) log_type = EVENTLOG; + else if (!strcmp(cfg.type, "EXTENDED")) + log_type = EXTENDED; else { fprintf(stderr, "Invalid log type: %s\n", cfg.type); return -EINVAL; @@ -909,42 +929,42 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command, output_path = full_folder; /* Retrieve first logs that records actions to retrieve other logs */ - if (log_type == ALL || log_type == HIT) { - err = ilog_dump_telemetry(&ilog, HIT); + if (log_type == ALL || log_type == HIT || log_type == EXTENDED) { + err = ilog_dump_telemetry(&ilog, log_type); if (err == 0) ilog.count++; else if (err < 0) perror("Error retrieving Host Initiated Telemetry"); } - if (log_type == ALL || log_type == NLOG) { + if (log_type == ALL || log_type == NLOG || log_type == EXTENDED) { err = ilog_dump_nlogs(&ilog, -1); if (err == 0) ilog.count++; else if (err < 0) perror("Error retrieving Nlog"); } - if (log_type == ALL || log_type == CIT) { + if (log_type == ALL || log_type == CIT || log_type == EXTENDED) { err = ilog_dump_telemetry(&ilog, CIT); if (err == 0) ilog.count++; else if (err < 0) perror("Error retrieving Controller Initiated Telemetry"); } - if (log_type == ALL || log_type == ASSERTLOG) { + if (log_type == ALL || log_type == ASSERTLOG || log_type == EXTENDED) { err = ilog_dump_assert_logs(&ilog); if (err == 0) ilog.count++; else if (err < 0) perror("Error retrieving Assert log"); } - if (log_type == ALL || log_type == EVENTLOG) { + if (log_type == ALL || log_type == EVENTLOG || log_type == EXTENDED) { err = ilog_dump_event_logs(&ilog); if (err == 0) ilog.count++; else if (err < 0) perror("Error retrieving Event log"); } - if (log_type == ALL) { + if (log_type == ALL || log_type == EXTENDED) { err = ilog_dump_identify_pages(&ilog); if (err < 0) perror("Error retrieving Identify pages"); diff --git a/plugins/solidigm/solidigm-nvme.h b/plugins/solidigm/solidigm-nvme.h index 1928abe51a..f89df99e05 100644 --- a/plugins/solidigm/solidigm-nvme.h +++ b/plugins/solidigm/solidigm-nvme.h @@ -13,7 +13,7 @@ #include "cmd.h" -#define SOLIDIGM_PLUGIN_VERSION "1.13" +#define SOLIDIGM_PLUGIN_VERSION "1.14" PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_VERSION), COMMAND_LIST(