From 870eaa144c59ee2665b70dcbb9d8649e99e3c0c4 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Wed, 22 Sep 2010 15:55:35 -0400 Subject: EDF-WM: migrating tasks can actually be queued when blocking The migration code patch simulates blocking if state changes occur while dropping the lock. We need to handle that. --- litmus/sched_edf_wm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/litmus/sched_edf_wm.c b/litmus/sched_edf_wm.c index f3627ad1174a..44e05948980c 100644 --- a/litmus/sched_edf_wm.c +++ b/litmus/sched_edf_wm.c @@ -505,14 +505,22 @@ static void wm_task_wake_up(struct task_struct *t) static void wm_task_block(struct task_struct *t) { + wm_domain_t* dom = domain_of_task(t); + unsigned long flags; lt_t now = litmus_clock(); - /* only running tasks can block, thus t is in no queue */ + TRACE_TASK(t, "block at %llu, state=%d\n", now, t->state); tsk_rt(t)->semi_part.wm.suspend_time = now; + raw_spin_lock_irqsave(&dom->slock, flags); + if (is_queued(t)) { + TRACE_TASK(t, "still queued; migration invariant failed?\n"); + remove(&dom->domain, t); + } + raw_spin_unlock_irqrestore(&dom->slock, flags); + BUG_ON(!is_realtime(t)); - BUG_ON(is_queued(t)); } static void wm_task_exit(struct task_struct * t) -- cgit v1.2.2