diff --git a/src/include/sof/schedule/schedule.h b/src/include/sof/schedule/schedule.h index 17098cf61..df214043d 100644 --- a/src/include/sof/schedule/schedule.h +++ b/src/include/sof/schedule/schedule.h @@ -10,6 +10,7 @@ #define __SOF_SCHEDULE_SCHEDULE_H__ #include +#include #include #include #include @@ -122,6 +123,7 @@ struct scheduler_ops { struct schedule_data { struct list_item list; /**< list of schedulers */ int type; /**< SOF_SCHEDULE_ type */ + uint32_t core; /**< the index of the core the scheduler run on */ const struct scheduler_ops *ops; /**< scheduler operations */ void *data; /**< pointer to private data */ }; @@ -210,7 +212,8 @@ static inline int schedule_task(struct task *task, uint64_t start, list_for_item(slist, &schedulers->list) { sch = container_of(slist, struct schedule_data, list); - if (task->type == sch->type && sch->ops->schedule_task) + if (task->type == sch->type && sch->core == cpu_get_id() && + sch->ops->schedule_task) return sch->ops->schedule_task(sch->data, task, start, period); } @@ -249,7 +252,8 @@ static inline int schedule_task_cancel(struct task *task) list_for_item(slist, &schedulers->list) { sch = container_of(slist, struct schedule_data, list); - if (task->type == sch->type && sch->ops->schedule_task_cancel) + if (task->type == sch->type && sch->core == cpu_get_id() && + sch->ops->schedule_task_cancel) return sch->ops->schedule_task_cancel(sch->data, task); } diff --git a/src/schedule/schedule.c b/src/schedule/schedule.c index 64a4d74d0..823487c39 100644 --- a/src/schedule/schedule.c +++ b/src/schedule/schedule.c @@ -7,6 +7,7 @@ /* Generic scheduler */ #include +#include #include #include #include @@ -66,6 +67,7 @@ void scheduler_init(int type, const struct scheduler_ops *ops, void *data) sch->type = type; sch->ops = ops; sch->data = data; + sch->core = cpu_get_id(); scheduler_register(sch); }