Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo with hack #632

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

demo with hack #632

wants to merge 17 commits into from

Conversation

gaozhangfei
Copy link
Collaborator

@gaozhangfei gaozhangfei commented Aug 20, 2024

1.增加一个workers[2]数组,
a.workers 数组默认是按优先级排序。
b.也可以通过config文件,export UADK_CONF=xxx/uadk.conf
i.系统中存在多个驱动,只选择其中2个,
ii.可以切换优先级,前面的驱动优先级高
c.struct worker 不仅包括驱动,还包括驱动需要的资源
d.现在worker[]只有2个,可以修改宏改成多个。
2.要求:init完后 所有worker均初始化好,工作时随便选哪个worker 都能工作,方便随时切换。
3.工作切换
a.默认primary_mode,worker[0]出错 -> worker[1] 10次 -> worker[0]
b.roundrobin_mode, worker[0] 10次 -> worker[1] 10次 -> worker[0] 10次 -> ...

@gaozhangfei gaozhangfei force-pushed the demo-8.20 branch 8 times, most recently from fbf6a01 to b30025d Compare August 27, 2024 07:33
@gaozhangfei gaozhangfei force-pushed the demo-8.20 branch 2 times, most recently from 034c9f5 to 99332bf Compare September 5, 2024 08:30
Using uadk_adapter_worker to record driver and resources.
so adding multi driver is adding workers.

struct uadk_adapter_worker {
	struct wd_alg_driver *driver;
	struct wd_ctx_config *ctx_config;
	struct wd_sched *sched;
	struct wd_ctx_config_internal config;
	struct wd_async_msg_pool pool;
	bool valid;
};
struct uadk_adapter {
	unsigned int workers_nb;
	enum uadk_adapter_mode mode;
	struct uadk_adapter_worker workers[UADK_MAX_NB_WORKERS];
	struct uadk_adapter_ops ops;
};

struct wd_digest_setting {
	struct uadk_adapter *adapter;
}
struct wd_digest_sess {
        struct uadk_adapter_worker *worker;
        pthread_spinlock_t worker_lock;
}

Test

sync
uadk_tool benchmark --alg sha512 --mode sva --opt 0 --sync --pktlen 1024 --seconds 1 --thread 1 --multi 1 --ctxnum 1 --init 2
algname:        length:         perf:           iops:           CPU_rate:
sha512          1024Bytes       461461.00KiB/s  461.5Kops       100.00%

async
uadk_tool benchmark --alg sha512 --mode sva --opt 0 --async --pktlen 1024 --seconds 1 --thread 1 --multi 1 --ctxnum 1 --init 2
algname:        length:         perf:           iops:           CPU_rate:
sha512          1024Bytes       1938160.00KiB/s 1938.2Kops      191.00%

sudo 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 --init 2

algname:        length:         perf:           iops:           CPU_rate:
sha512          8192Bytes       3453520.00KiB/s 431.7Kops       1387.60%

init1:
sudo 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
algname:        length:         perf:           iops:           CPU_rate:
sha512          8192Bytes       11269440.80KiB/s        1408.7Kops      1036.70%

Signed-off-by: Zhangfei Gao <[email protected]>
case 1: sync or async error, switch worker
case 2: roundrobin mode, switch worker 10 times
    case 1: sync or async error, switch worker
    case 2: roundrobin mode, switch worker 10 times
Add zlib drv to to simulate cpu instruction accelerator

Btw, zlib is required.
apt-get install zlib1g-dev

Signed-off-by: Zhangfei Gao <[email protected]>
Will use hisi_zlib to test adapter, so let UADK_ALG_SOFT register to uadk

Signed-off-by: Zhangfei Gao <[email protected]>
will switch between zlib and zip

uadk_tool benchmark --alg zlib --mode sva --opt 0 --sync --pktlen 1024 --seconds 1 --thread 1 --multi 1 --ctxnum 1 --init 2

Signed-off-by: Zhangfei Gao <[email protected]>
export UADK_CONF=/home/linaro/work/uadk/uadk.conf

Example: uadk.conf
mode=1
driver_name=hisi_zip
driver_name=hisi_zlib

If env UADK_CONF exist, only parse UADK_CONF and
add to adapter->workers[] one by one.
So the first driver has higher priority

Signed-off-by: Zhangfei Gao <[email protected]>
all workers need to be initialized in init2, using default type
worker->xxx is common, use sess worker lifetime instead
init sched_key[] for each workers since they may different
miss sess->worker_lifetime = 0 when switch worker, compute again
mode=1 pass in from uadk.conf
export UADK_CONF=/home/linaro/work/uadk/uadk.conf

This reverts commit 45c62bb.
Signed-off-by: Zhangfei Gao <[email protected]>
if UADK_CONF, worker sequence is decided by UADK_CONF
otherwise, workers is listed as drv->priority

Signed-off-by: Zhangfei Gao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants