Skip to content

Commit 0460c5f

Browse files
lgdacunhigaw
authored andcommitted
plugins/solidigm: Added missing log descriptions and uuid support to some logs.
Added log descriptions to log-page-directory. Added UUID support to market-log and workload-tracker. Added nvme command printing to verbose mode of modified plugin commands. Signed-off-by: Leonardo da Cunha <[email protected]>
1 parent 4a66443 commit 0460c5f

File tree

4 files changed

+93
-46
lines changed

4 files changed

+93
-46
lines changed

plugins/solidigm/solidigm-log-page-dir.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ static struct lid_dir *get_solidigm_lids(struct nvme_supported_log_pages *suppor
110110
solidigm_dir.lid[0xDD].str = "VU Marketing Description Log Page";
111111
solidigm_dir.lid[0xEF].str = "Performance Rating and LBA Access Histogram";
112112
solidigm_dir.lid[0xF2].str = "Get Power Usage Log Page";
113+
solidigm_dir.lid[0xF4].str = "Nand Statistics Log Page";
114+
solidigm_dir.lid[0xF5].str = "Nand Defects Count Log Page";
113115
solidigm_dir.lid[0xF6].str = "Vt Histo Get Log Page";
114116
solidigm_dir.lid[0xF9].str = "Workload Tracker Get Log Page";
115117
solidigm_dir.lid[0xFD].str = "Garbage Control Collection Log Page";
116-
solidigm_dir.lid[0xFE].str = "Latency Outlier Log Page";
118+
solidigm_dir.lid[0xFE].str = "Latency Outlier / SK SMART Log Page";
117119

118120
update_vendor_lid_supported(supported, &solidigm_dir);
119121

@@ -131,6 +133,9 @@ static struct lid_dir *get_ocp_lids(struct nvme_supported_log_pages *supported)
131133
ocp_dir.lid[0xC3].str = "OCP Latency Monitor";
132134
ocp_dir.lid[0xC4].str = "OCP Device Capabilities";
133135
ocp_dir.lid[0xC5].str = "OCP Unsupported Requirements";
136+
ocp_dir.lid[0xC6].str = "OCP Hardware Component";
137+
ocp_dir.lid[0xC7].str = "OCP TCG Configuration";
138+
ocp_dir.lid[0xC9].str = "OCP Telemetry String Log";
134139

135140
update_vendor_lid_supported(supported, &ocp_dir);
136141

@@ -188,10 +193,11 @@ int solidigm_get_log_page_directory_log(int argc, char **argv, struct command *c
188193
{
189194
const int NO_UUID_INDEX = 0;
190195
const char *description = "Retrieves list of supported log pages for each UUID index.";
191-
char *format = "normal";
192196

193197
OPT_ARGS(options) = {
194-
OPT_FMT("output-format", 'o', &format, "output format : normal | json"),
198+
OPT_FMT("output-format", 'o', &nvme_cfg.output_format,
199+
"output format : normal | json"),
200+
OPT_INCR("verbose", 'v', &nvme_cfg.verbose, verbose),
195201
OPT_END()
196202
};
197203

@@ -244,9 +250,10 @@ int solidigm_get_log_page_directory_log(int argc, char **argv, struct command *c
244250
if (!err) {
245251
nvme_print_flags_t print_flag;
246252

247-
err = validate_output_format(format, &print_flag);
248-
if (err < 0) {
249-
fprintf(stderr, "Error: Invalid output format specified: %s.\n", format);
253+
err = validate_output_format(nvme_cfg.output_format, &print_flag);
254+
if (err) {
255+
nvme_show_error("Error: Invalid output format specified: %s.\n",
256+
nvme_cfg.output_format);
250257
return err;
251258
}
252259

plugins/solidigm/solidigm-market-log.c

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,61 @@
1818
#include "libnvme.h"
1919
#include "plugin.h"
2020
#include "nvme-print.h"
21+
#include "solidigm-util.h"
2122

23+
#define MARKET_LOG_LID 0xDD
2224
#define MARKET_LOG_MAX_SIZE 512
2325

2426
int sldgm_get_market_log(int argc, char **argv, struct command *command,
2527
struct plugin *plugin)
2628
{
2729
const char *desc = "Get Solidigm Marketing Name log and show it.";
2830
const char *raw = "dump output in binary format";
29-
struct nvme_dev *dev;
31+
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
3032
char log[MARKET_LOG_MAX_SIZE];
3133
int err;
32-
33-
struct config {
34-
bool raw_binary;
35-
};
36-
37-
struct config cfg = {
38-
};
34+
__u8 uuid_idx;
35+
bool raw_binary = false;
3936

4037
OPT_ARGS(opts) = {
41-
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw),
38+
OPT_FLAG("raw-binary", 'b', &raw_binary, raw),
39+
OPT_INCR("verbose", 'v', &nvme_cfg.verbose, verbose),
4240
OPT_END()
4341
};
4442

4543
err = parse_and_open(&dev, argc, argv, desc, opts);
4644
if (err)
4745
return err;
4846

49-
err = nvme_get_log_simple(dev_fd(dev), 0xdd, sizeof(log), log);
50-
if (!err) {
51-
if (!cfg.raw_binary)
52-
printf("Solidigm Marketing Name Log:\n%s\n", log);
53-
else
54-
d_raw((unsigned char *)&log, sizeof(log));
55-
} else if (err > 0)
56-
57-
nvme_show_status(err);
58-
/* Redundant close() to make static code analysis happy */
59-
close(dev->direct.fd);
60-
dev_close(dev);
47+
sldgm_get_uuid_index(dev, &uuid_idx);
48+
49+
struct nvme_get_log_args args = {
50+
.lpo = 0,
51+
.result = NULL,
52+
.log = log,
53+
.args_size = sizeof(args),
54+
.fd = dev_fd(dev),
55+
.uuidx = uuid_idx,
56+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
57+
.lid = MARKET_LOG_LID,
58+
.len = sizeof(log),
59+
.nsid = NVME_NSID_ALL,
60+
.csi = NVME_CSI_NVM,
61+
.lsi = NVME_LOG_LSI_NONE,
62+
.lsp = NVME_LOG_LSP_NONE,
63+
.rae = false,
64+
.ot = false,
65+
};
66+
67+
err = nvme_get_log(&args);
68+
if (err) {
69+
nvme_show_status(err);
70+
return err;
71+
}
72+
if (!raw_binary)
73+
printf("Solidigm Marketing Name Log:\n%s\n", log);
74+
else
75+
d_raw((unsigned char *)&log, sizeof(log));
76+
6177
return err;
6278
}

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.11"
16+
#define SOLIDIGM_PLUGIN_VERSION "1.12"
1717

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

plugins/solidigm/solidigm-workload-tracker.c

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ struct workloadLog { // Full WL Log Structure
197197

198198
struct wltracker {
199199
int fd;
200+
__u8 uuid_index;
200201
struct workloadLog workload_log;
201202
size_t poll_count;
202203
bool show_wall_timestamp;
203204
__u64 us_epoch_ssd_delta;
204-
unsigned int verbose;
205205
__u64 start_time_us;
206206
__u64 run_time_us;
207207
bool disable;
@@ -229,7 +229,7 @@ static void wltracker_print_field_names(struct wltracker *wlt)
229229
if (wlt->show_wall_timestamp)
230230
printf("%-*s", (int)sizeof("YYYY-MM-DD-hh:mm:ss.uuuuuu"), "wall-time");
231231

232-
if (wlt->verbose > 1)
232+
if (nvme_cfg.verbose > 1)
233233
printf("%s", "entry# ");
234234

235235
printf("\n");
@@ -250,7 +250,7 @@ static void wltracker_print_header(struct wltracker *wlt)
250250
printf("%-24s %s\n", "Tracker Type:", trk_types[log->config.contentGroup]);
251251
printf("%-24s %u\n", "Total log page entries:", le32_to_cpu(log->workloadLogCount));
252252
printf("%-24s %u\n", "Trigger count:", log->triggeredEvents);
253-
if (wlt->verbose > 1)
253+
if (nvme_cfg.verbose > 1)
254254
printf("%-24s %ld\n", "Poll count:", wlt->poll_count);
255255
if (wlt->poll_count != 0)
256256
wltracker_print_field_names(wlt);
@@ -275,12 +275,12 @@ int wltracker_config(struct wltracker *wlt, union WorkloadLogEnable *we)
275275
{
276276
struct nvme_set_features_args args = {
277277
.args_size = sizeof(args),
278-
.fd = wlt->fd,
278+
.fd = wlt->fd,
279279
.fid = FID,
280280
.cdw11 = we->dword,
281+
.uuidx = wlt->uuid_index,
281282
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
282283
};
283-
284284
return nvme_set_features(&args);
285285
}
286286

@@ -294,7 +294,18 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
294294
__u64 timestamp = 0;
295295
union WorkloadLogEnable workloadEnable;
296296

297-
int err = nvme_get_log_simple(wlt->fd, LID, sizeof(struct workloadLog), log);
297+
struct nvme_get_log_args args = {
298+
.lpo = 0,
299+
.result = NULL,
300+
.log = log,
301+
.args_size = sizeof(args),
302+
.fd = wlt->fd,
303+
.uuidx = wlt->uuid_index,
304+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
305+
.lid = LID,
306+
.len = sizeof(*log),
307+
};
308+
int err = nvme_get_log(&args);
298309

299310
if (err > 0) {
300311
nvme_show_status(err);
@@ -303,7 +314,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
303314
if (err < 0)
304315
return err;
305316

306-
if (wlt->verbose)
317+
if (nvme_cfg.verbose)
307318
wltracker_print_header(wlt);
308319

309320
cnt = log->workloadLogCount;
@@ -331,15 +342,15 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
331342
// retrieve fresh timestamp to reconstruct wall time
332343
union WorkloadLogEnable we = log->config;
333344

334-
if (wlt->verbose > 1) {
345+
if (nvme_cfg.verbose > 1) {
335346
printf("Temporarily enabling tracker to find current timestamp\n");
336347
printf("Original config value: 0x%08x\n", we.dword);
337348
}
338349
we.trackerEnable = true;
339350
we.triggerEnable = false;
340351
we.sampleTime = 1;
341352

342-
if (wlt->verbose > 1)
353+
if (nvme_cfg.verbose > 1)
343354
printf("Modified config value: 0x%08x\n", we.dword);
344355

345356
err = wltracker_config(wlt, &we);
@@ -357,7 +368,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
357368
we = log->config;
358369
we.triggerEnable = false;
359370
err = wltracker_config(wlt, &we);
360-
if (wlt->verbose > 1)
371+
if (nvme_cfg.verbose > 1)
361372
printf("Restored config value: 0x%08x\n",
362373
we.dword);
363374
}
@@ -395,7 +406,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
395406
(uint64_t)(epoch_ts_us % 1000000ULL));
396407
}
397408

398-
if (wlt->verbose > 1)
409+
if (nvme_cfg.verbose > 1)
399410
printf("%-*i", (int)sizeof("entry#"), i);
400411

401412
printf("\n");
@@ -431,7 +442,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
431442
void wltracker_run_time_update(struct wltracker *wlt)
432443
{
433444
wlt->run_time_us = micros() - wlt->start_time_us;
434-
if (wlt->verbose > 0)
445+
if (nvme_cfg.verbose > 0)
435446
printf("run_time: %lluus\n", wlt->run_time_us);
436447
}
437448

@@ -527,6 +538,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
527538
join_options(sample_options, samplet, ARRAY_SIZE(samplet));
528539

529540
OPT_ARGS(opts) = {
541+
OPT_BYTE("uuid-index", 'U', &wlt.uuid_index, "specify uuid index"),
530542
OPT_FLAG("enable", 'e', &cfg.enable, "tracker enable"),
531543
OPT_FLAG("disable", 'd', &cfg.disable, "tracker disable"),
532544
OPT_STRING("sample-time", 's', sample_options, &cfg.sample_time, sample_interval),
@@ -542,14 +554,19 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
542554
"Trigger on delta to stop sampling"),
543555
OPT_FLAG("trigger-on-latency", 'L', &cfg.trigger_on_latency,
544556
"Use latency tracker to trigger stop sampling"),
545-
OPT_INCR("verbose", 'v', &wlt.verbose, "Increase logging verbosity"),
557+
OPT_INCR("verbose", 'v', &nvme_cfg.verbose, "Increase logging verbosity"),
546558
OPT_END()
547559
};
548560

549561
err = parse_and_open(&dev, argc, argv, desc, opts);
550562
if (err)
551563
return err;
552564

565+
if (wlt.uuid_index > 127) {
566+
nvme_show_error("invalid uuid index param: %u", wlt.uuid_index);
567+
return -1;
568+
}
569+
553570
wlt.fd = dev_fd(dev);
554571

555572
if ((cfg.flush_frequency < 1) || (cfg.flush_frequency > MAX_WORKLOAD_LOG_ENTRIES)) {
@@ -598,8 +615,15 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
598615
we.triggerEnable = true;
599616
we.triggerDelta = cfg.trigger_on_delta;
600617
we.triggerSynchronous = !cfg.trigger_on_latency;
601-
err = nvme_set_features_data(wlt.fd, 0xf5, 0, cfg.trigger_treshold, 0, 0, NULL,
602-
NULL);
618+
struct nvme_set_features_args args = {
619+
.args_size = sizeof(args),
620+
.fd = wlt.fd,
621+
.fid = 0xf5,
622+
.cdw11 = cfg.trigger_treshold,
623+
.uuidx = wlt.uuid_index,
624+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
625+
};
626+
err = nvme_set_features(&args);
603627
if (err < 0) {
604628
nvme_show_error("Trigger Threshold set-feature: %s", nvme_strerror(errno));
605629
return err;
@@ -651,7 +675,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
651675
if (interval > elapsed) {
652676
__u64 period_us = min(next_sample_us - wlt.run_time_us,
653677
stop_time_us - wlt.run_time_us);
654-
if (wlt.verbose > 1)
678+
if (nvme_cfg.verbose > 1)
655679
printf("Sleeping %lluus..\n", period_us);
656680
usleep(period_us);
657681
wltracker_run_time_update(&wlt);
@@ -666,7 +690,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
666690
if (cfg.disable) {
667691
union WorkloadLogEnable we2 = wlt.workload_log.config;
668692

669-
if (wlt.verbose > 1)
693+
if (nvme_cfg.verbose > 1)
670694
printf("Original config value: 0x%08x\n", we2.dword);
671695

672696
we2.trackerEnable = false;
@@ -679,7 +703,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
679703
nvme_show_status(err);
680704
return err;
681705
}
682-
if (wlt.verbose > 1)
706+
if (nvme_cfg.verbose > 1)
683707
printf("Modified config value: 0x%08x\n", we2.dword);
684708
printf("Tracker disabled\n");
685709
return 0;

0 commit comments

Comments
 (0)