@@ -197,11 +197,11 @@ struct workloadLog { // Full WL Log Structure
197197
198198struct 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)
431442void 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