Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Documentation/nvme-solidigm-vs-internal-log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ OPTIONS
-------
-t <type>::
--log-type=<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 <dir>::
--output-dir=<dir>::
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion completions/_nvme
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
58 changes: 39 additions & 19 deletions plugins/solidigm/solidigm-internal-logs.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@

#define DWORD_SIZE 4
#define LOG_FILE_PERMISSION 0644
#define ATMOS_MODEL_PREFIX "SOLIDIGM SB5"

enum log_type {
NLOG = 0,
EVENTLOG = 1,
ASSERTLOG = 2,
HIT,
CIT,
ALL
ALL,
EXTENDED
};

#pragma pack(push, internal_logs, 1)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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,
Expand Down Expand Up @@ -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()
};

Expand All @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion plugins/solidigm/solidigm-nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down