diff options
| author | Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> | 2023-04-13 16:22:58 +0900 |
|---|---|---|
| committer | Shuah Khan <skhan@linuxfoundation.org> | 2023-04-13 11:34:23 -0600 |
| commit | 73c55fa5ab5539d38561b0d816be1315c8bf6752 (patch) | |
| tree | 7c21effb9720150f3512a7c9701e9b4be3e5481d /tools/testing/selftests/resctrl/fill_buf.c | |
| parent | 39e34ddc382b33c9b784805ca9d83927093eb4af (diff) | |
| download | linux-next-73c55fa5ab5539d38561b0d816be1315c8bf6752.tar.gz linux-next-73c55fa5ab5539d38561b0d816be1315c8bf6752.zip | |
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/fill_buf.c')
| -rw-r--r-- | tools/testing/selftests/resctrl/fill_buf.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index 3cd0b337eae5..341cc93ca84c 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -32,14 +32,6 @@ static void sb(void) #endif } -static void ctrl_handler(int signo) -{ - free(startptr); - printf("\nEnding\n"); - sb(); - exit(EXIT_SUCCESS); -} - static void cl_flush(void *p) { #if defined(__i386) || defined(__x86_64) @@ -201,12 +193,6 @@ int run_fill_buf(unsigned long span, int malloc_and_init_memory, unsigned long long cache_size = span; int ret; - /* set up ctrl-c handler */ - if (signal(SIGINT, ctrl_handler) == SIG_ERR) - printf("Failed to catch SIGINT!\n"); - if (signal(SIGHUP, ctrl_handler) == SIG_ERR) - printf("Failed to catch SIGHUP!\n"); - ret = fill_cache(cache_size, malloc_and_init_memory, memflush, op, resctrl_val); if (ret) { |
