Merging upstream version 2.14.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
0d9181726f
commit
f268303a51
572 changed files with 4636 additions and 1730 deletions
|
@ -197,11 +197,11 @@ struct workloadLog { // Full WL Log Structure
|
|||
|
||||
struct wltracker {
|
||||
int fd;
|
||||
__u8 uuid_index;
|
||||
struct workloadLog workload_log;
|
||||
size_t poll_count;
|
||||
bool show_wall_timestamp;
|
||||
__u64 us_epoch_ssd_delta;
|
||||
unsigned int verbose;
|
||||
__u64 start_time_us;
|
||||
__u64 run_time_us;
|
||||
bool disable;
|
||||
|
@ -229,7 +229,7 @@ static void wltracker_print_field_names(struct wltracker *wlt)
|
|||
if (wlt->show_wall_timestamp)
|
||||
printf("%-*s", (int)sizeof("YYYY-MM-DD-hh:mm:ss.uuuuuu"), "wall-time");
|
||||
|
||||
if (wlt->verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("%s", "entry# ");
|
||||
|
||||
printf("\n");
|
||||
|
@ -250,7 +250,7 @@ static void wltracker_print_header(struct wltracker *wlt)
|
|||
printf("%-24s %s\n", "Tracker Type:", trk_types[log->config.contentGroup]);
|
||||
printf("%-24s %u\n", "Total log page entries:", le32_to_cpu(log->workloadLogCount));
|
||||
printf("%-24s %u\n", "Trigger count:", log->triggeredEvents);
|
||||
if (wlt->verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("%-24s %ld\n", "Poll count:", wlt->poll_count);
|
||||
if (wlt->poll_count != 0)
|
||||
wltracker_print_field_names(wlt);
|
||||
|
@ -275,12 +275,12 @@ int wltracker_config(struct wltracker *wlt, union WorkloadLogEnable *we)
|
|||
{
|
||||
struct nvme_set_features_args args = {
|
||||
.args_size = sizeof(args),
|
||||
.fd = wlt->fd,
|
||||
.fd = wlt->fd,
|
||||
.fid = FID,
|
||||
.cdw11 = we->dword,
|
||||
.uuidx = wlt->uuid_index,
|
||||
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
|
||||
};
|
||||
|
||||
return nvme_set_features(&args);
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,18 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
|
|||
__u64 timestamp = 0;
|
||||
union WorkloadLogEnable workloadEnable;
|
||||
|
||||
int err = nvme_get_log_simple(wlt->fd, LID, sizeof(struct workloadLog), log);
|
||||
struct nvme_get_log_args args = {
|
||||
.lpo = 0,
|
||||
.result = NULL,
|
||||
.log = log,
|
||||
.args_size = sizeof(args),
|
||||
.fd = wlt->fd,
|
||||
.uuidx = wlt->uuid_index,
|
||||
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
|
||||
.lid = LID,
|
||||
.len = sizeof(*log),
|
||||
};
|
||||
int err = nvme_get_log(&args);
|
||||
|
||||
if (err > 0) {
|
||||
nvme_show_status(err);
|
||||
|
@ -303,7 +314,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (wlt->verbose)
|
||||
if (nvme_cfg.verbose)
|
||||
wltracker_print_header(wlt);
|
||||
|
||||
cnt = log->workloadLogCount;
|
||||
|
@ -331,7 +342,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
|
|||
// retrieve fresh timestamp to reconstruct wall time
|
||||
union WorkloadLogEnable we = log->config;
|
||||
|
||||
if (wlt->verbose > 1) {
|
||||
if (nvme_cfg.verbose > 1) {
|
||||
printf("Temporarily enabling tracker to find current timestamp\n");
|
||||
printf("Original config value: 0x%08x\n", we.dword);
|
||||
}
|
||||
|
@ -339,7 +350,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
|
|||
we.triggerEnable = false;
|
||||
we.sampleTime = 1;
|
||||
|
||||
if (wlt->verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("Modified config value: 0x%08x\n", we.dword);
|
||||
|
||||
err = wltracker_config(wlt, &we);
|
||||
|
@ -357,7 +368,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
|
|||
we = log->config;
|
||||
we.triggerEnable = false;
|
||||
err = wltracker_config(wlt, &we);
|
||||
if (wlt->verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("Restored config value: 0x%08x\n",
|
||||
we.dword);
|
||||
}
|
||||
|
@ -395,7 +406,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
|
|||
(uint64_t)(epoch_ts_us % 1000000ULL));
|
||||
}
|
||||
|
||||
if (wlt->verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("%-*i", (int)sizeof("entry#"), i);
|
||||
|
||||
printf("\n");
|
||||
|
@ -431,7 +442,7 @@ static int wltracker_show_newer_entries(struct wltracker *wlt)
|
|||
void wltracker_run_time_update(struct wltracker *wlt)
|
||||
{
|
||||
wlt->run_time_us = micros() - wlt->start_time_us;
|
||||
if (wlt->verbose > 0)
|
||||
if (nvme_cfg.verbose > 0)
|
||||
printf("run_time: %lluus\n", wlt->run_time_us);
|
||||
}
|
||||
|
||||
|
@ -527,6 +538,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
|
|||
join_options(sample_options, samplet, ARRAY_SIZE(samplet));
|
||||
|
||||
OPT_ARGS(opts) = {
|
||||
OPT_BYTE("uuid-index", 'U', &wlt.uuid_index, "specify uuid index"),
|
||||
OPT_FLAG("enable", 'e', &cfg.enable, "tracker enable"),
|
||||
OPT_FLAG("disable", 'd', &cfg.disable, "tracker disable"),
|
||||
OPT_STRING("sample-time", 's', sample_options, &cfg.sample_time, sample_interval),
|
||||
|
@ -542,7 +554,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
|
|||
"Trigger on delta to stop sampling"),
|
||||
OPT_FLAG("trigger-on-latency", 'L', &cfg.trigger_on_latency,
|
||||
"Use latency tracker to trigger stop sampling"),
|
||||
OPT_INCR("verbose", 'v', &wlt.verbose, "Increase logging verbosity"),
|
||||
OPT_INCR("verbose", 'v', &nvme_cfg.verbose, "Increase logging verbosity"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
|
@ -550,6 +562,11 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
if (wlt.uuid_index > 127) {
|
||||
nvme_show_error("invalid uuid index param: %u", wlt.uuid_index);
|
||||
return -1;
|
||||
}
|
||||
|
||||
wlt.fd = dev_fd(dev);
|
||||
|
||||
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
|
|||
we.triggerEnable = true;
|
||||
we.triggerDelta = cfg.trigger_on_delta;
|
||||
we.triggerSynchronous = !cfg.trigger_on_latency;
|
||||
err = nvme_set_features_data(wlt.fd, 0xf5, 0, cfg.trigger_treshold, 0, 0, NULL,
|
||||
NULL);
|
||||
struct nvme_set_features_args args = {
|
||||
.args_size = sizeof(args),
|
||||
.fd = wlt.fd,
|
||||
.fid = 0xf5,
|
||||
.cdw11 = cfg.trigger_treshold,
|
||||
.uuidx = wlt.uuid_index,
|
||||
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
|
||||
};
|
||||
err = nvme_set_features(&args);
|
||||
if (err < 0) {
|
||||
nvme_show_error("Trigger Threshold set-feature: %s", nvme_strerror(errno));
|
||||
return err;
|
||||
|
@ -651,7 +675,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
|
|||
if (interval > elapsed) {
|
||||
__u64 period_us = min(next_sample_us - wlt.run_time_us,
|
||||
stop_time_us - wlt.run_time_us);
|
||||
if (wlt.verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("Sleeping %lluus..\n", period_us);
|
||||
usleep(period_us);
|
||||
wltracker_run_time_update(&wlt);
|
||||
|
@ -666,7 +690,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
|
|||
if (cfg.disable) {
|
||||
union WorkloadLogEnable we2 = wlt.workload_log.config;
|
||||
|
||||
if (wlt.verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("Original config value: 0x%08x\n", we2.dword);
|
||||
|
||||
we2.trackerEnable = false;
|
||||
|
@ -679,7 +703,7 @@ int sldgm_get_workload_tracker(int argc, char **argv, struct command *cmd, struc
|
|||
nvme_show_status(err);
|
||||
return err;
|
||||
}
|
||||
if (wlt.verbose > 1)
|
||||
if (nvme_cfg.verbose > 1)
|
||||
printf("Modified config value: 0x%08x\n", we2.dword);
|
||||
printf("Tracker disabled\n");
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue