From: Zhangfei Gao <zhangfei.gao@linaro.org> wd_xxx_init2 does not take para cparam, which take ctx number. So default ctx number is used with poor performance. numactl --cpubind=0 --membind=0 \ uadk_tool benchmark --alg sha512 --mode sva --opt 0 --async --pktlen 8192 \ --seconds 20 --multi 1 --thread 8 --ctxnum 8 --init2 sha512 8192Bytes 3982625.60KiB/s 497.8Kops 1292.90% after fix: numactl --cpubind=0 --membind=0 \ uadk_tool benchmark --alg sha512 --mode sva --opt 0 --async --pktlen 8192 \ --seconds 20 --multi 1 --thread 8 --ctxnum 8 --init2 sha512 8192Bytes 11276124.40KiB/s 1409.5Kops 1026.70% Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> --- uadk_tool/benchmark/hpre_uadk_benchmark.c | 10 ++++++++++ uadk_tool/benchmark/sec_uadk_benchmark.c | 16 +++++++++++++--- uadk_tool/benchmark/uadk_benchmark.c | 2 +- uadk_tool/benchmark/zip_uadk_benchmark.c | 8 ++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/uadk_tool/benchmark/hpre_uadk_benchmark.c b/uadk_tool/benchmark/hpre_uadk_benchmark.c index 65b68a9..fa26a61 100644 --- a/uadk_tool/benchmark/hpre_uadk_benchmark.c +++ b/uadk_tool/benchmark/hpre_uadk_benchmark.c @@ -663,6 +663,14 @@ static int init_hpre_ctx_config2(struct acc_option *options) cparams.op_type_num = 1; cparams.ctx_set_num = ctx_set_num; + cparams.bmp = numa_allocate_nodemask(); + if (!cparams.bmp) { + WD_ERR("failed to create nodemask!\n"); + ret = -WD_ENOMEM; + goto out_freectx; + } + + numa_bitmask_setall(cparams.bmp); if (mode == CTX_MODE_SYNC) ctx_set_num->sync_ctx_num = g_ctxnum; @@ -695,7 +703,9 @@ static int init_hpre_ctx_config2(struct acc_option *options) return -EINVAL; } +out_freectx: free(ctx_set_num); + return ret; } diff --git a/uadk_tool/benchmark/sec_uadk_benchmark.c b/uadk_tool/benchmark/sec_uadk_benchmark.c index d9d4d25..4a64c94 100644 --- a/uadk_tool/benchmark/sec_uadk_benchmark.c +++ b/uadk_tool/benchmark/sec_uadk_benchmark.c @@ -876,6 +876,14 @@ static int init_ctx_config2(struct acc_option *options) cparams.op_type_num = 1; cparams.ctx_set_num = ctx_set_num; + cparams.bmp = numa_allocate_nodemask(); + if (!cparams.bmp) { + WD_ERR("failed to create nodemask!\n"); + ret = -WD_ENOMEM; + goto out_freectx; + } + + numa_bitmask_setall(cparams.bmp); if (mode == CTX_MODE_SYNC) ctx_set_num->sync_ctx_num = g_ctxnum; @@ -913,11 +921,13 @@ static int init_ctx_config2(struct acc_option *options) if (ret) SEC_TST_PRT("failed to do digest init2!\n"); break; - default: - SEC_TST_PRT("failed to parse alg subtype on uninit2!\n"); - ret = -EINVAL; + } + if (ret) { + SEC_TST_PRT("failed to do cipher init2!\n"); + return ret; } +out_freectx: free(ctx_set_num); return ret; diff --git a/uadk_tool/benchmark/uadk_benchmark.c b/uadk_tool/benchmark/uadk_benchmark.c index e3fdda2..fd64f6c 100644 --- a/uadk_tool/benchmark/uadk_benchmark.c +++ b/uadk_tool/benchmark/uadk_benchmark.c @@ -337,7 +337,7 @@ void time_start(u32 seconds) void get_rand_data(u8 *addr, u32 size) { static __thread unsigned short rand_state[3] = {0}; - static __thread int initialized = 0; + static __thread int initialized = 0; static const uint32_t LCG_A = 1664525U; static const uint32_t LCG_C = 1013904223U; diff --git a/uadk_tool/benchmark/zip_uadk_benchmark.c b/uadk_tool/benchmark/zip_uadk_benchmark.c index 68b93cf..2e7752b 100644 --- a/uadk_tool/benchmark/zip_uadk_benchmark.c +++ b/uadk_tool/benchmark/zip_uadk_benchmark.c @@ -379,6 +379,14 @@ static int init_ctx_config2(struct acc_option *options) cparams.op_type_num = WD_DIR_MAX; cparams.ctx_set_num = ctx_set_num; + cparams.bmp = numa_allocate_nodemask(); + if (!cparams.bmp) { + WD_ERR("failed to create nodemask!\n"); + ret = -WD_ENOMEM; + goto out_freectx; + } + + numa_bitmask_setall(cparams.bmp); for (int i = 0; i < WD_DIR_MAX; i++) { if (mode == CTX_MODE_SYNC) -- 2.33.0