diff options
author | Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> | 2023-04-13 10:22:58 +0300 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2023-04-13 20:34:23 +0300 |
commit | 73c55fa5ab5539d38561b0d816be1315c8bf6752 (patch) | |
tree | 7c21effb9720150f3512a7c9701e9b4be3e5481d /tools/testing/selftests/resctrl/resctrl.h | |
parent | 39e34ddc382b33c9b784805ca9d83927093eb4af (diff) | |
download | linux-73c55fa5ab5539d38561b0d816be1315c8bf6752.tar.xz |
selftests/resctrl: Commonize the signal handler register/unregister for all tests
After creating a child process with fork() in CAT test, if a signal such
as SIGINT is received, the parent process will be terminated immediately,
and therefore the child process will not be killed and also resctrlfs is
not unmounted.
There is a signal handler registered in CMT/MBM/MBA tests, which kills
child process, unmount resctrlfs, cleanups result files, etc., if a
signal such as SIGINT is received.
Commonize the signal handler registered for CMT/MBM/MBA tests and
reuse it in CAT.
To reuse the signal handler to kill child process use global bm_pid
instead of local bm_pid.
Also, since the MBA/MBA/CMT/CAT are run in order, unregister the signal
handler at the end of each test so that the signal handler cannot be
inherited by other tests.
Reviewed-by: Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/resctrl.h')
-rw-r--r-- | tools/testing/selftests/resctrl/resctrl.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 9555a6f683f7..87e39456dee0 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -109,6 +109,8 @@ void mba_test_cleanup(void); int get_cbm_mask(char *cache_type, char *cbm_mask); int get_cache_size(int cpu_no, char *cache_type, unsigned long *cache_size); void ctrlc_handler(int signum, siginfo_t *info, void *ptr); +int signal_handler_register(void); +void signal_handler_unregister(void); int cat_val(struct resctrl_val_param *param); void cat_test_cleanup(void); int cat_perf_miss_val(int cpu_no, int no_of_bits, char *cache_type); |