aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/resctrl/resctrl_tests.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-09-04 12:53:36 +0300
committerShuah Khan <skhan@linuxfoundation.org>2023-10-13 14:28:49 -0600
commit47809eb70cdc81221e03baafe8c1768801a9184e (patch)
treee6be4e77654c8619207d4e282d779a3cac1ebe75 /tools/testing/selftests/resctrl/resctrl_tests.c
parentselftests/resctrl: Simplify span lifetime (diff)
downloadwireguard-linux-47809eb70cdc81221e03baafe8c1768801a9184e.tar.xz
wireguard-linux-47809eb70cdc81221e03baafe8c1768801a9184e.zip
selftests/resctrl: Reorder resctrl FS prep code and benchmark_cmd init
Benchmark command is initialized before resctrl FS check and preparation code that can call ksft_exit_skip(). There is no strong reason why the resctrl FS support check and unmounting it (if already mounted), has to be done after the benchmark command initialization. Move benchmark command initialization such that it is done not until right before the tests commence. This simplifies rollback handling when benchmark command initialization starts to use dynamic allocation (in a change following this). Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/resctrl_tests.c')
-rw-r--r--tools/testing/selftests/resctrl/resctrl_tests.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c
index 64e28bde5131..f105e00d6099 100644
--- a/tools/testing/selftests/resctrl/resctrl_tests.c
+++ b/tools/testing/selftests/resctrl/resctrl_tests.c
@@ -252,6 +252,14 @@ int main(int argc, char **argv)
if (geteuid() != 0)
return ksft_exit_skip("Not running as root. Skipping...\n");
+ if (!check_resctrlfs_support())
+ return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n");
+
+ if (umount_resctrlfs())
+ return ksft_exit_skip("resctrl FS unmount failed.\n");
+
+ filter_dmesg();
+
if (has_ben) {
if (argc - ben_ind >= BENCHMARK_ARGS)
ksft_exit_fail_msg("Too long benchmark command.\n");
@@ -277,14 +285,6 @@ int main(int argc, char **argv)
benchmark_cmd[5] = NULL;
}
- if (!check_resctrlfs_support())
- return ksft_exit_skip("resctrl FS does not exist. Enable X86_CPU_RESCTRL config option.\n");
-
- if (umount_resctrlfs())
- return ksft_exit_skip("resctrl FS unmount failed.\n");
-
- filter_dmesg();
-
ksft_set_plan(tests ? : 4);
if (mbm_test)