[Sound-open-firmware] [PATCH] scheduler: enforce locking for edf_schedule list operations
Liam Girdwood
liam.r.girdwood at linux.intel.com
Fri Oct 13 17:47:20 CEST 2017
make sure our task list is protected by lock for readers and writers.
Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
src/lib/schedule.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/lib/schedule.c b/src/lib/schedule.c
index 993f94a..ab0602b 100644
--- a/src/lib/schedule.c
+++ b/src/lib/schedule.c
@@ -102,10 +102,15 @@ static inline struct task *edf_get_next(uint64_t current,
uint64_t delta;
uint64_t deadline;
int reschedule = 0;
+ uint32_t flags;
+ spin_lock_irq(&sch->lock, flags);
+
/* any tasks in the scheduler ? */
- if (list_is_empty(&sch->list))
+ if (list_is_empty(&sch->list)) {
+ spin_unlock_irq(&sch->lock, flags);
return NULL;
+ }
/* check every queued or running task in list */
list_for_item_safe(clist, tlist, &sch->list) {
@@ -142,6 +147,7 @@ static inline struct task *edf_get_next(uint64_t current,
}
}
+ spin_unlock_irq(&sch->lock, flags);
return next_task;
}
@@ -164,20 +170,15 @@ static struct task *schedule_edf(void)
struct task *task;
struct task *next_plus1_task = NULL;
uint64_t current;
- uint32_t flags;
tracev_pipe("edf");
- /* get next component scheduled */
- spin_lock_irq(&sch->lock, flags);
-
/* get the current time */
current = platform_timer_get(platform_timer);
/* get next task to be scheduled */
task = edf_get_next(current, NULL);
- spin_unlock_irq(&sch->lock, flags);
interrupt_clear(PLATFORM_SCHEDULE_IRQ);
/* any tasks ? */
--
1.9.1
More information about the Sound-open-firmware
mailing list