Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/resctrl: Remove "once" parameter required to be false

The CMT, MBM, and MBA tests rely on a benchmark that runs while
the test makes changes to needed configuration (for example memory
bandwidth allocation) and takes needed measurements. By default
the "fill_buf" benchmark is used and by default (via its
"once = false" setting) "fill_buf" is configured to run until
terminated after the test completes.

An unintended consequence of enabling the user to override the
benchmark also enables the user to change parameters to the
"fill_buf" benchmark. This enables the user to set "fill_buf" to
only cycle through the buffer once (by setting "once = true")
and thus breaking the CMT, MBA, and MBM tests that expect
workload/interference to be reflected by their measurements.

Prevent user space from changing the "once" parameter and ensure
that it is always false for the CMT, MBA, and MBM tests.

Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Reinette Chatre and committed by
Shuah Khan
f3069136 efffa8c4

+13 -16
+4 -3
tools/testing/selftests/resctrl/fill_buf.c
··· 151 151 return buf; 152 152 } 153 153 154 - int run_fill_buf(size_t buf_size, int memflush, int op, bool once) 154 + int run_fill_buf(size_t buf_size, int memflush, int op) 155 155 { 156 156 unsigned char *buf; 157 157 ··· 160 160 return -1; 161 161 162 162 if (op == 0) 163 - fill_cache_read(buf, buf_size, once); 163 + fill_cache_read(buf, buf_size, false); 164 164 else 165 - fill_cache_write(buf, buf_size, once); 165 + fill_cache_write(buf, buf_size, false); 166 + 166 167 free(buf); 167 168 168 169 return 0;
+1 -1
tools/testing/selftests/resctrl/resctrl.h
··· 142 142 unsigned char *alloc_buffer(size_t buf_size, int memflush); 143 143 void mem_flush(unsigned char *buf, size_t buf_size); 144 144 void fill_cache_read(unsigned char *buf, size_t buf_size, bool once); 145 - int run_fill_buf(size_t buf_size, int memflush, int op, bool once); 145 + int run_fill_buf(size_t buf_size, int memflush, int op); 146 146 int initialize_mem_bw_imc(void); 147 147 int measure_mem_bw(const struct user_params *uparams, 148 148 struct resctrl_val_param *param, pid_t bm_pid,
+7 -2
tools/testing/selftests/resctrl/resctrl_tests.c
··· 266 266 uparams.benchmark_cmd[1] = span_str; 267 267 uparams.benchmark_cmd[2] = "1"; 268 268 uparams.benchmark_cmd[3] = "0"; 269 - uparams.benchmark_cmd[4] = "false"; 270 - uparams.benchmark_cmd[5] = NULL; 269 + /* 270 + * Fourth parameter was previously used to indicate 271 + * how long "fill_buf" should run for, with "false" 272 + * ("fill_buf" will keep running until terminated) 273 + * the only option that works. 274 + */ 275 + uparams.benchmark_cmd[4] = NULL; 271 276 } 272 277 273 278 ksft_set_plan(tests);
+1 -10
tools/testing/selftests/resctrl/resctrl_val.c
··· 625 625 int operation, ret, memflush; 626 626 char **benchmark_cmd; 627 627 size_t span; 628 - bool once; 629 628 FILE *fp; 630 629 631 630 benchmark_cmd = info->si_ptr; ··· 644 645 span = strtoul(benchmark_cmd[1], NULL, 10); 645 646 memflush = atoi(benchmark_cmd[2]); 646 647 operation = atoi(benchmark_cmd[3]); 647 - if (!strcmp(benchmark_cmd[4], "true")) { 648 - once = true; 649 - } else if (!strcmp(benchmark_cmd[4], "false")) { 650 - once = false; 651 - } else { 652 - ksft_print_msg("Invalid once parameter\n"); 653 - parent_exit(ppid); 654 - } 655 648 656 - if (run_fill_buf(span, memflush, operation, once)) 649 + if (run_fill_buf(span, memflush, operation)) 657 650 fprintf(stderr, "Error in running fill buffer\n"); 658 651 } else { 659 652 /* Execute specified benchmark */