73 lines
2.3 KiB
Diff
73 lines
2.3 KiB
Diff
From 1839b896bbb7cfaddbd8b19d322465c7ef7e185c Mon Sep 17 00:00:00 2001
|
|
From: Zhiqi Song <songzhiqi1@huawei.com>
|
|
Date: Mon, 11 Mar 2024 18:07:24 +0800
|
|
Subject: [PATCH 15/44] uadk/util: use default sched_type for instruction task
|
|
|
|
To prevent users from perceiving the difference in instruction
|
|
acceleration task, no longer check the specific sched_type, just
|
|
accept sched_type within the valid range from user, and use
|
|
default sched_type inside.
|
|
|
|
As sched_type is checked before init2 calls wd_alg_attrs_init().
|
|
Redundancy check is not needed.
|
|
|
|
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
|
|
---
|
|
include/wd_sched.h | 2 +-
|
|
wd_util.c | 12 ++----------
|
|
2 files changed, 3 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/include/wd_sched.h b/include/wd_sched.h
|
|
index b145172..be541c6 100644
|
|
--- a/include/wd_sched.h
|
|
+++ b/include/wd_sched.h
|
|
@@ -21,7 +21,7 @@ enum sched_policy_type {
|
|
SCHED_POLICY_RR = 0,
|
|
/* requests will no need ctxs */
|
|
SCHED_POLICY_NONE,
|
|
- /* requests will need a fixed ctx */
|
|
+ /* requests will need a fixed ctx */
|
|
SCHED_POLICY_SINGLE,
|
|
SCHED_POLICY_BUTT,
|
|
};
|
|
diff --git a/wd_util.c b/wd_util.c
|
|
index b8e755c..fb58167 100644
|
|
--- a/wd_util.c
|
|
+++ b/wd_util.c
|
|
@@ -2681,12 +2681,6 @@ int wd_alg_attrs_init(struct wd_init_attrs *attrs)
|
|
switch (driver_type) {
|
|
case UADK_ALG_SOFT:
|
|
case UADK_ALG_CE_INSTR:
|
|
- /* No need to alloc resource */
|
|
- if (sched_type != SCHED_POLICY_NONE) {
|
|
- WD_ERR("invalid sched_type\n");
|
|
- return -WD_EINVAL;
|
|
- }
|
|
-
|
|
ctx_config = calloc(1, sizeof(*ctx_config));
|
|
if (!ctx_config) {
|
|
WD_ERR("fail to alloc ctx config\n");
|
|
@@ -2694,6 +2688,7 @@ int wd_alg_attrs_init(struct wd_init_attrs *attrs)
|
|
}
|
|
attrs->ctx_config = ctx_config;
|
|
|
|
+ /* Use default sched_type to alloc scheduler */
|
|
alg_sched = wd_sched_rr_alloc(SCHED_POLICY_NONE, 1, 1, alg_poll_func);
|
|
if (!alg_sched) {
|
|
WD_ERR("fail to alloc scheduler\n");
|
|
@@ -2714,10 +2709,7 @@ int wd_alg_attrs_init(struct wd_init_attrs *attrs)
|
|
|
|
break;
|
|
case UADK_ALG_SVE_INSTR:
|
|
- /* Todo lock cpu core */
|
|
- if (sched_type != SCHED_POLICY_SINGLE)
|
|
- return -WD_EINVAL;
|
|
-
|
|
+ /* Use default sched_type to alloc scheduler */
|
|
alg_sched = wd_sched_rr_alloc(SCHED_POLICY_SINGLE, 1, 1, alg_poll_func);
|
|
if (!alg_sched) {
|
|
WD_ERR("fail to alloc scheduler\n");
|
|
--
|
|
2.25.1
|
|
|