summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/resctrl/mbm_test.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-06-10 18:14:51 +0300
committerShuah Khan <skhan@linuxfoundation.org>2024-07-11 11:23:54 -0600
commitaef5efa64426396cac5b0126cbb6071e92d5da24 (patch)
treef45ff52a6d5c879d69e432a4a20bc58aa70ae25c /tools/testing/selftests/resctrl/mbm_test.c
parent0e251816995a1972062fc7ad32047c1aee9cd704 (diff)
downloadlwn-aef5efa64426396cac5b0126cbb6071e92d5da24.tar.gz
lwn-aef5efa64426396cac5b0126cbb6071e92d5da24.zip
selftests/resctrl: Add ->init() callback into resctrl_val_param
The struct resctrl_val_param is there to customize behavior inside resctrl_val() which is currently not used to full extent and there are number of strcmp()s for test name in resctrl_val done by resctrl_val(). Create ->init() hook into the struct resctrl_val_param to cleanly do per test initialization. Remove also unused branches to setup paths and the related #defines for CMT test. While touching kerneldoc, make the adjacent line consistent with the newly added form (callback vs call back). Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Tested-by: Babu Moger <babu.moger@amd.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/mbm_test.c')
-rw-r--r--tools/testing/selftests/resctrl/mbm_test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c
index 7c6f60b1dd18..adc205bf9e51 100644
--- a/tools/testing/selftests/resctrl/mbm_test.c
+++ b/tools/testing/selftests/resctrl/mbm_test.c
@@ -86,6 +86,19 @@ static int check_results(size_t span)
return ret;
}
+static int mbm_init(const struct resctrl_val_param *param, int domain_id)
+{
+ int ret;
+
+ ret = initialize_mem_bw_imc();
+ if (ret)
+ return ret;
+
+ initialize_mem_bw_resctrl(param, domain_id);
+
+ return 0;
+}
+
static int mbm_setup(const struct resctrl_test *test,
const struct user_params *uparams,
struct resctrl_val_param *p)
@@ -123,6 +136,7 @@ static int mbm_run_test(const struct resctrl_test *test, const struct user_param
.ctrlgrp = "c1",
.filename = RESULT_FILE_NAME,
.bw_report = "reads",
+ .init = mbm_init,
.setup = mbm_setup,
.measure = mbm_measure,
};