From: Hao Fang fanghao11@huawei.com
Remove the poll_thread_func() and rename poll2_thread_func() as the poll_thread_func().
Signed-off-by: Hao Fang fanghao11@huawei.com Signed-off-by: Qi Tao taoqi10@huawei.com --- uadk_tool/test/comp_lib.c | 44 ++++---------------------------------- uadk_tool/test/comp_lib.h | 1 - uadk_tool/test/comp_main.c | 6 +++--- 3 files changed, 7 insertions(+), 44 deletions(-)
diff --git a/uadk_tool/test/comp_lib.c b/uadk_tool/test/comp_lib.c index 6f45d07..f4711ac 100644 --- a/uadk_tool/test/comp_lib.c +++ b/uadk_tool/test/comp_lib.c @@ -21,7 +21,6 @@ struct check_rand_ctx { unsigned short state[3]; };
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_spinlock_t lock; static int count = 0;
@@ -334,44 +333,6 @@ static int lib_poll_func(__u32 pos, __u32 expect, __u32 *count) return 0; }
-void *poll_thread_func(void *arg) -{ - struct hizip_test_info *info = (struct hizip_test_info *)arg; - int ret = 0, total = 0; - __u32 expected = 0, received; - - if (!info->opts->sync_mode) - return NULL; - while (1) { - if (info->opts->faults & INJECT_SIG_WORK) - kill(getpid(), SIGTERM); - - pthread_mutex_lock(&mutex); - if (!expected) - expected = 1; - if (count == 0) { - pthread_mutex_unlock(&mutex); - usleep(10); - continue; - } - expected = 1; - received = 0; - ret = wd_comp_poll(expected, &received); - if (ret == 0) - total += received; - if (count == total) { - pthread_mutex_unlock(&mutex); - break; - } else { - if (count > total) - expected = count - total; - pthread_mutex_unlock(&mutex); - usleep(10); - } - } - pthread_exit(NULL); -} - void gen_random_data(void *buf, size_t len) { int i; @@ -1088,7 +1049,7 @@ out: return ret; }
-void *poll2_thread_func(void *arg) +void *poll_thread_func(void *arg) { thread_data_t *tdata = (thread_data_t *)arg; struct hizip_test_info *info = tdata->info; @@ -1100,6 +1061,9 @@ void *poll2_thread_func(void *arg)
gettimeofday(&start_tvl, NULL); while (1) { + if (info->opts->faults & INJECT_SIG_WORK) + kill(getpid(), SIGTERM); + end_threads = __atomic_load_n(&sum_thread_end, __ATOMIC_ACQUIRE); pending = __atomic_load_n(&sum_pend, __ATOMIC_ACQUIRE); diff --git a/uadk_tool/test/comp_lib.h b/uadk_tool/test/comp_lib.h index cc6054e..67e9079 100644 --- a/uadk_tool/test/comp_lib.h +++ b/uadk_tool/test/comp_lib.h @@ -235,7 +235,6 @@ int attach2_threads(struct test_options *opts, struct hizip_test_info *info, void *(*send_thread_func)(void *arg), void *(*poll_thread_func)(void *arg)); -void *poll2_thread_func(void *arg);
int init_ctx_config(struct test_options *opts, void *priv, diff --git a/uadk_tool/test/comp_main.c b/uadk_tool/test/comp_main.c index 6446591..02a5d5e 100644 --- a/uadk_tool/test/comp_main.c +++ b/uadk_tool/test/comp_main.c @@ -537,7 +537,7 @@ static void *hw_dfl_perf(void *arg) tdata->src, tdata->src_sz); if (ret) { - COMP_TST_PRT("Fail to deflate by HW: %d\n", ret); + COMP_TST_PRT("Fail to deflate by HW(stm): %d\n", ret); return (void *)(uintptr_t)ret; } } @@ -563,7 +563,7 @@ static void *hw_dfl_perf(void *arg) ret = hw_deflate4(h_dfl, tdata->in_list, tdata->out_list, opts, &tdata->sem); if (ret) { - COMP_TST_PRT("Fail to deflate by HW: %d\n", ret); + COMP_TST_PRT("Fail to deflate by HW(blk): %d\n", ret); goto out; } } @@ -1026,7 +1026,7 @@ int test_hw(struct test_options *opts, char *model) COMP_TST_PRT( "NOTE: test might trash the TLB\n"); } stat_start(&info); - ret = attach2_threads(opts, &info, func, poll2_thread_func); + ret = attach2_threads(opts, &info, func, poll_thread_func); if (ret) goto out_buf; stat_end(&info);