aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/resctrl/resctrl_tests.c
diff options
context:
space:
mode:
authorFenghua Yu <fenghua.yu@intel.com>2020-01-16 13:32:40 -0800
committerShuah Khan <skhan@linuxfoundation.org>2020-02-10 18:42:46 -0700
commit01fee6b4d1f93247e806dddb0065b88317949085 (patch)
treeea8469cb32e4d0fc2cbd539f4f2a9968a57d9990 /tools/testing/selftests/resctrl/resctrl_tests.c
parentselftests/resctrl: Add MBM test (diff)
downloadlinux-dev-01fee6b4d1f93247e806dddb0065b88317949085.tar.xz
linux-dev-01fee6b4d1f93247e806dddb0065b88317949085.zip
selftests/resctrl: Add MBA test
MBA (Memory Bandwidth Allocation) test starts a stressful memory bandwidth benchmark and allocates memory bandwidth from 100% down to 10% for the benchmark process. For each allocation, compare perf IMC counter and mbm total bytes from resctrl. The difference between the two values should be within a threshold to pass the test. Default benchmark is built-in fill_buf. But users can specify their own benchmark by option "-b". We can add memory bandwidth allocation for multiple processes in the future. Co-developed-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> Co-developed-by: Babu Moger <babu.moger@amd.com> Signed-off-by: Babu Moger <babu.moger@amd.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/resctrl/resctrl_tests.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 496c8030fe43..0ed953a97db2 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -26,6 +26,7 @@ static void cmd_help(void)
void tests_cleanup(void)
{
mbm_test_cleanup();
+ mba_test_cleanup();
}
int main(int argc, char **argv)
@@ -33,7 +34,7 @@ int main(int argc, char **argv)
int res, c, cpu_no = 1, span = 250, argc_new = argc, i, ben_ind;
char *benchmark_cmd[BENCHMARK_ARGS], bw_report[64], bm_type[64];
char benchmark_cmd_area[BENCHMARK_ARGS][BENCHMARK_ARG_SIZE];
- bool has_ben = false, mbm_test = true;
+ bool has_ben = false, mbm_test = true, mba_test = true;
int ben_count;
for (i = 0; i < argc; i++) {
@@ -54,9 +55,12 @@ int main(int argc, char **argv)
token = strtok(optarg, ",");
mbm_test = false;
+ mba_test = false;
while (token) {
if (!strcmp(token, "mbm")) {
mbm_test = true;
+ } else if (!strcmp(token, "mba")) {
+ mba_test = true;
} else {
printf("invalid argument\n");
@@ -126,6 +130,16 @@ int main(int argc, char **argv)
tests_run++;
}
+ if (mba_test) {
+ printf("# Starting MBA Schemata change ...\n");
+ if (!has_ben)
+ sprintf(benchmark_cmd[1], "%d", span);
+ res = mba_schemata_change(cpu_no, bw_report, benchmark_cmd);
+ printf("%sok MBA: schemata change\n", res ? "not " : "");
+ mba_test_cleanup();
+ tests_run++;
+ }
+
printf("1..%d\n", tests_run);
return 0;