Skip to content

Commit

Permalink
uadk/util: use default sched_type for instruction task
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Zhiqi Song authored and Liulongfang committed Mar 19, 2024
1 parent 7869d42 commit 1839b89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/wd_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
12 changes: 2 additions & 10 deletions wd_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2681,19 +2681,14 @@ 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");
return -WD_ENOMEM;
}
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");
Expand All @@ -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");
Expand Down

0 comments on commit 1839b89

Please sign in to comment.