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
79 changes: 79 additions & 0 deletions Documentation/nvme-ocp-persistent-event-log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
nvme-ocp-persistent-event-log(1)
================================

NAME
----
nvme-ocp-persistent-event-log - Send NVMe persistent event log page request,
returns result and log additional OCP-specific data

SYNOPSIS
--------
[verse]
'nvme ocp persistent-event-log' <device> [--action=<action> | -a <action>]
[--log-len=<log-len> | -l <log-len>] [--raw-binary | -b]
[--output-format=<fmt> | -o <fmt>] [--verbose | -v]

DESCRIPTION
-----------
Retrieves the NVMe persistent event log page from an NVMe device
and provides the returned structure.

The <device> parameter is mandatory and may be either the NVMe character
device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).

On success, the returned persistent event log structure may be returned
in one of several ways depending on the option flags; the structure may
parsed by the program and printed in a readable format or the raw buffer
may be printed to stdout for another program to parse.

OPTIONS
-------
-a <action>::
--action=<action>::
While try to retrieve this log action the controller shall take
during processing this persistent log page command. This mandatory
field, based on the value issued it may Read Log Data, Establish
Context and Read Log Data or Release Context can occur. For More
details see NVM Express 1.4 Spec. Section 5.14.1.13 Persistent
Event Log (Log Identifier 0Dh)

-l <log-len>::
--log-len=<log-len>::
Allocates a buffer of <log-len> bytes size and requests this
many bytes be returned in the constructed NVMe command. This
param is mandatory. If <log-len> given is 0 and action is 0,
it will read the Total Log Length(TLL) of the page.

-b::
--raw-binary::
Print the raw persistent event log buffer to stdout.

-o <fmt>::
--output-format=<fmt>::
Set the reporting format to 'normal', 'json' or 'binary'. Only one
output format can be used at a time.

-v::
--verbose::
Increase the information detail in the output.

EXAMPLES
--------
* Print the persistent event log page in a human readable format:
+
------------
# nvme ocp persistent-event-log /dev/nvme0
------------
+

* Print the raw persistent event log to a file:
+
------------
# nvme ocp persistent-event-log /dev/nvme0 --raw-binary > persistent_log.raw
------------
+
It is probably a bad idea to not redirect stdout when using this mode.

NVME
----
Part of the nvme-user suite
94 changes: 50 additions & 44 deletions nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,8 +1560,8 @@
}
}

static void json_pevent_log_head(struct nvme_persistent_event_log *pevent_log_head,
struct json_object *r)
void nvme_json_pevent_log_head(struct nvme_persistent_event_log *pevent_log_head,

Check failure on line 1563 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 81 exceeds 80 columns
struct json_object *r)
{
int i;
char sn[sizeof(pevent_log_head->sn) + 1];
Expand Down Expand Up @@ -1596,8 +1596,8 @@
}
}

static void json_pel_smart_health(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_smart_health(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
char key[128];
struct nvme_smart_log *smart_event = pevent_log_info + offset;
Expand Down Expand Up @@ -1654,7 +1654,8 @@
le32_to_cpu(smart_event->thm_temp2_total_time));
}

static void json_pel_fw_commit(void *pevent_log_info, __u32 offset, struct json_object *valid_attrs)
void nvme_json_pel_fw_commit(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
char fw_str[50];
struct nvme_fw_commit_event *fw_commit_event = pevent_log_info + offset;
Expand All @@ -1673,7 +1674,8 @@
le16_to_cpu(fw_commit_event->vndr_assign_fw_commit_rc));
}

static void json_pel_timestamp(void *pevent_log_info, __u32 offset, struct json_object *valid_attrs)
void nvme_json_pel_timestamp(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_time_stamp_change_event *ts_change_event = pevent_log_info + offset;

Expand All @@ -1682,8 +1684,9 @@
le64_to_cpu(ts_change_event->ml_secs_since_reset));
}

static void json_pel_power_on_reset(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs, __le16 vsil, __le16 el)
void nvme_json_pel_power_on_reset(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs,
__le16 vsil, __le16 el)
{
__u64 *fw_rev;
char fw_str[50];
Expand Down Expand Up @@ -1711,16 +1714,17 @@
}
}

static void json_pel_nss_hw_error(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_nss_hw_error(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_nss_hw_err_event *nss_hw_err_event = pevent_log_info + offset;

obj_add_uint(valid_attrs, "nss_hw_err_code",
le16_to_cpu(nss_hw_err_event->nss_hw_err_event_code));
}

static void json_pel_change_ns(void *pevent_log_info, __u32 offset, struct json_object *valid_attrs)
void nvme_json_pel_change_ns(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_change_ns_event *ns_event = pevent_log_info + offset;

Expand All @@ -1735,8 +1739,8 @@
obj_add_uint(valid_attrs, "nsid", le32_to_cpu(ns_event->nsid));
}

static void json_pel_format_start(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_format_start(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_format_nvm_start_event *format_start_event = pevent_log_info + offset;

Expand All @@ -1746,8 +1750,8 @@
le32_to_cpu(format_start_event->format_nvm_cdw10));
}

static void json_pel_format_completion(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_format_completion(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_format_nvm_compln_event *format_cmpln_event = pevent_log_info + offset;

Expand All @@ -1757,8 +1761,8 @@
obj_add_uint(valid_attrs, "compln_info", le16_to_cpu(format_cmpln_event->compln_info));
obj_add_uint(valid_attrs, "status_field", le32_to_cpu(format_cmpln_event->status_field));
}
static void json_pel_sanitize_start(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_sanitize_start(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_sanitize_start_event *sanitize_start_event = pevent_log_info + offset;

Expand All @@ -1767,8 +1771,8 @@
obj_add_uint(valid_attrs, "sani_cdw11", le32_to_cpu(sanitize_start_event->sani_cdw11));
}

static void json_pel_sanitize_completion(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_sanitize_completion(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_sanitize_compln_event *sanitize_cmpln_event = pevent_log_info + offset;

Expand All @@ -1777,8 +1781,8 @@
obj_add_uint(valid_attrs, "cmpln_info", le16_to_cpu(sanitize_cmpln_event->cmpln_info));
}

static void json_pel_set_feature(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_set_feature(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_set_feature_event *set_feat_event = pevent_log_info + offset;
int fid = NVME_GET(le32_to_cpu(set_feat_event->cdw_mem[0]), SET_FEATURES_CDW10_FID);
Expand All @@ -1796,14 +1800,14 @@
}
}

static void json_pel_telemetry_crt(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_telemetry_crt(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
obj_d(valid_attrs, "create", pevent_log_info + offset, 512, 16, 1);
}

static void json_pel_thermal_excursion(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
void nvme_json_pel_thermal_excursion(void *pevent_log_info, __u32 offset,
struct json_object *valid_attrs)
{
struct nvme_thermal_exc_event *thermal_exc_event = pevent_log_info + offset;

Expand Down Expand Up @@ -1850,8 +1854,9 @@
obj_add_obj(valid_attrs, "vs_event_data", vs_data);
}

static void json_pel_vendor_specific_event(void *pevent_log_info, __u32 offset,
__u32 event_data_len, struct json_object *valid_attrs)
void nvme_json_pel_vendor_specific_event(void *pevent_log_info, __u32 offset,
__u32 event_data_len,
struct json_object *valid_attrs)
{
__u32 progress = 0;
__u16 vsedl;
Expand Down Expand Up @@ -1925,48 +1930,49 @@

switch (pevent_entry_head->etype) {
case NVME_PEL_SMART_HEALTH_EVENT:
json_pel_smart_health(pevent_log_info, offset, valid_attrs);
nvme_json_pel_smart_health(pevent_log_info, offset, valid_attrs);

Check failure on line 1933 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 89 exceeds 80 columns
break;
case NVME_PEL_FW_COMMIT_EVENT:
json_pel_fw_commit(pevent_log_info, offset, valid_attrs);
nvme_json_pel_fw_commit(pevent_log_info, offset, valid_attrs);

Check failure on line 1936 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns
break;
case NVME_PEL_TIMESTAMP_EVENT:
json_pel_timestamp(pevent_log_info, offset, valid_attrs);
nvme_json_pel_timestamp(pevent_log_info, offset, valid_attrs);

Check failure on line 1939 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns
break;
case NVME_PEL_POWER_ON_RESET_EVENT:
json_pel_power_on_reset(pevent_log_info, offset, valid_attrs,
pevent_entry_head->vsil, pevent_entry_head->el);
nvme_json_pel_power_on_reset(pevent_log_info, offset, valid_attrs,

Check failure on line 1942 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 90 exceeds 80 columns
pevent_entry_head->vsil,
pevent_entry_head->el);
break;
case NVME_PEL_NSS_HW_ERROR_EVENT:
json_pel_nss_hw_error(pevent_log_info, offset, valid_attrs);
nvme_json_pel_nss_hw_error(pevent_log_info, offset, valid_attrs);

Check failure on line 1947 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 89 exceeds 80 columns
break;
case NVME_PEL_CHANGE_NS_EVENT:
json_pel_change_ns(pevent_log_info, offset, valid_attrs);
nvme_json_pel_change_ns(pevent_log_info, offset, valid_attrs);

Check failure on line 1950 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns
break;
case NVME_PEL_FORMAT_START_EVENT:
json_pel_format_start(pevent_log_info, offset, valid_attrs);
nvme_json_pel_format_start(pevent_log_info, offset, valid_attrs);

Check failure on line 1953 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 89 exceeds 80 columns
break;
case NVME_PEL_FORMAT_COMPLETION_EVENT:
json_pel_format_completion(pevent_log_info, offset, valid_attrs);
nvme_json_pel_format_completion(pevent_log_info, offset, valid_attrs);

Check failure on line 1956 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 94 exceeds 80 columns
break;
case NVME_PEL_SANITIZE_START_EVENT:
json_pel_sanitize_start(pevent_log_info, offset, valid_attrs);
nvme_json_pel_sanitize_start(pevent_log_info, offset, valid_attrs);

Check failure on line 1959 in nvme-print-json.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 91 exceeds 80 columns
break;
case NVME_PEL_SANITIZE_COMPLETION_EVENT:
json_pel_sanitize_completion(pevent_log_info, offset, valid_attrs);
nvme_json_pel_sanitize_completion(pevent_log_info, offset, valid_attrs);
break;
case NVME_PEL_SET_FEATURE_EVENT:
json_pel_set_feature(pevent_log_info, offset, valid_attrs);
nvme_json_pel_set_feature(pevent_log_info, offset, valid_attrs);
break;
case NVME_PEL_TELEMETRY_CRT:
json_pel_telemetry_crt(pevent_log_info, offset, valid_attrs);
nvme_json_pel_telemetry_crt(pevent_log_info, offset, valid_attrs);
break;
case NVME_PEL_THERMAL_EXCURSION_EVENT:
json_pel_thermal_excursion(pevent_log_info, offset, valid_attrs);
nvme_json_pel_thermal_excursion(pevent_log_info, offset, valid_attrs);
break;
case NVME_PEL_VENDOR_SPECIFIC_EVENT:
json_pel_vendor_specific_event(pevent_log_info, offset, el - vsil,
valid_attrs);
nvme_json_pel_vendor_specific_event(pevent_log_info, offset, el - vsil,
valid_attrs);
break;
default:
break;
Expand All @@ -1985,7 +1991,7 @@
__u32 offset = sizeof(struct nvme_persistent_event_log);

if (size >= offset) {
json_pevent_log_head(pevent_log_info, r);
nvme_json_pevent_log_head(pevent_log_info, r);
json_pevent_entry(pevent_log_info, action, size, devname, offset, valid);
obj_add_array(r, "list_of_event_entries", valid);
} else {
Expand Down
Loading