Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion posix/include/rtos/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct task {
uint64_t start; /**< start time in [ms] since now (LL only) */
const struct sof_uuid_entry *uid; /**< Uuid */
uint16_t type; /**< type of the task (LL or EDF) */
uint16_t priority; /**< priority of the task (used by LL) */
int16_t priority; /**< priority of the task (used by LL); lower runs first */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check do we have a hard limit for max priority (e.g. can we fit max valid priority to a signed 16bit variabe)

uint16_t core; /**< execution core */
uint16_t flags; /**< custom flags */
struct schedule_data *sch; /**< scheduler bound to task */
Expand Down
4 changes: 2 additions & 2 deletions src/include/sof/schedule/ll_schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ int scheduler_init_ll(struct ll_schedule_domain *domain);

int schedule_task_init_ll(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags);
#else
int zephyr_ll_scheduler_init(struct ll_schedule_domain *domain);

int zephyr_ll_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags);

#define scheduler_init_ll zephyr_ll_scheduler_init
Expand Down
2 changes: 1 addition & 1 deletion src/include/sof/schedule/schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static inline struct k_thread *scheduler_init_context(struct task *task)
*/
int schedule_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/platform/library/include/platform/lib/ll_schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int scheduler_init_ll(struct ll_schedule_domain *domain);

int schedule_task_init_ll(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags);

#endif /* __LIBRARY_INCLUDE_LIB_SCHEDULE_H__ */
2 changes: 1 addition & 1 deletion src/platform/library/schedule/ll_schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static struct scheduler_ops schedule_ll_ops = {

int schedule_task_init_ll(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
return schedule_task_init(task, uid, SOF_SCHEDULE_LL_TIMER, 0, run,
Expand Down
2 changes: 1 addition & 1 deletion src/platform/library/schedule/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct schedulers **arch_schedulers_get(void)

int schedule_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
struct schedulers *schedulers = *arch_schedulers_get();
Expand Down
2 changes: 1 addition & 1 deletion src/schedule/ll_schedule_xtos.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ static int schedule_ll_task_after(void *data, struct task *task, uint64_t start,

int schedule_task_init_ll(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
struct ll_task_pdata *ll_pdata;
Expand Down
2 changes: 1 addition & 1 deletion src/schedule/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static inline bool scheduler_is_user(int type)

int schedule_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
struct schedulers *schedulers;
Expand Down
6 changes: 3 additions & 3 deletions src/schedule/zephyr_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ static void zephyr_ll_task_insert_unlocked(struct zephyr_ll *sch, struct task *t

/*
* Tasks are added into the list in priority order. List order
* defines schedule order. Priority 0 indicates highest
* priority and is run first. Tasks with the same priority are
* defines schedule order. Lower values indicate higher priority
* and run first. Tasks with the same priority are
* served on a first-come-first-served basis.
*/
list_for_item(list, &sch->tasks) {
Expand Down Expand Up @@ -662,7 +662,7 @@ void user_ll_unlock_sched(int core)

int zephyr_ll_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
struct zephyr_ll_pdata *pdata;
Expand Down
4 changes: 2 additions & 2 deletions test/cmocka/src/common_mocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ struct schedulers ** WEAK arch_schedulers_get(void)

int WEAK schedule_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
(void)task;
Expand All @@ -329,7 +329,7 @@ int WEAK schedule_task_init(struct task *task,

int WEAK schedule_task_init_ll(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
int16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
return 0;
Expand Down
2 changes: 1 addition & 1 deletion zephyr/include/rtos/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct task {
uint64_t start; /**< start time in [ms] since now (LL only) */
const struct sof_uuid_entry *uid; /**< Uuid */
uint16_t type; /**< type of the task (LL or EDF) */
uint16_t priority; /**< priority of the task (used by LL) */
int16_t priority; /**< priority of the task (used by LL); lower runs first */
uint16_t core; /**< execution core */
uint16_t flags; /**< custom flags */
struct schedule_data *sch; /**< scheduler bound to task */
Expand Down
3 changes: 2 additions & 1 deletion zephyr/test/userspace/test_ll_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static enum task_state task_callback(void *arg)
static void ll_task_test(void)
{
struct task *task;
int priority = 0;
int16_t priority = -1;
int core = 0;
int ret;

Expand All @@ -67,6 +67,7 @@ static void ll_task_test(void)
priority, task_callback,
(void *)&test_runs, core, 0);
zassert_equal(ret, 0);
zassert_equal(task->priority, priority, "negative priority was not preserved");

LOG_INF("task init done");

Expand Down