From cc6a4b90595a566fbd9fcaf8a9399e35f0a7ef93 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Sun, 27 Jan 2013 23:46:48 -0500 Subject: ECRTS13 testbed (hopefully) fixed minor bugs and cleaned up ikglp affinity logic --- include/litmus/rt_domain.h | 2 +- litmus/ikglp_lock.c | 40 ++++++++++++++-------------------------- litmus/litmus.c | 7 ++++--- litmus/sched_cedf.c | 3 +++ litmus/sched_task_trace.c | 4 ++-- 5 files changed, 24 insertions(+), 32 deletions(-) diff --git a/include/litmus/rt_domain.h b/include/litmus/rt_domain.h index 961d7e7c4912..89a8850ecf9d 100644 --- a/include/litmus/rt_domain.h +++ b/include/litmus/rt_domain.h @@ -95,7 +95,7 @@ static inline struct task_struct* __take_ready(rt_domain_t* rt) (taken && tsk_rt(taken)->inh_task) ? tsk_rt(taken)->inh_task->pid : -1); - return bheap2task(hn); + return taken; } else return NULL; diff --git a/litmus/ikglp_lock.c b/litmus/ikglp_lock.c index ae769bce58d6..e78a4ec0dff6 100644 --- a/litmus/ikglp_lock.c +++ b/litmus/ikglp_lock.c @@ -476,7 +476,7 @@ static void ikglp_refresh_owners_prio_decrease(struct fifo_queue *fq, old_max_eff_prio = top_priority(&tsk_rt(owner)->hp_blocked_tasks); binheap_delete(&fq->nest.hp_binheap_node, &tsk_rt(owner)->hp_blocked_tasks); - fq->nest.hp_waiter_eff_prio = effective_priority(fq->hp_waiter); + fq->nest.hp_waiter_eff_prio = (fq->hp_waiter) ? effective_priority(fq->hp_waiter) : NULL; binheap_add(&fq->nest.hp_binheap_node, &tsk_rt(owner)->hp_blocked_tasks, struct nested_info, hp_binheap_node); @@ -1373,16 +1373,12 @@ int ikglp_unlock(struct litmus_lock* l) donee = t; #ifdef CONFIG_LITMUS_AFFINITY_LOCKING - if(sem->aff_obs && sem->aff_obs->relax_max_fifo_len) { + if(sem->aff_obs) fq_of_new_on_fq = sem->aff_obs->ops->advise_enqueue(sem->aff_obs, new_on_fq); - if(fq_of_new_on_fq->count == 0) { - // ignore it? -// fq_of_new_on_fq = fq; - } - } - else { + if((fq_of_new_on_fq->count >= sem->max_fifo_len) && !sem->aff_obs->relax_max_fifo_len) + fq_of_new_on_fq = fq; /* discard recommendation */ + else fq_of_new_on_fq = fq; - } #else fq_of_new_on_fq = fq; #endif @@ -1413,16 +1409,12 @@ int ikglp_unlock(struct litmus_lock* l) binheap_decrease(&other_donor_info->donee_info->node, &sem->donees); #ifdef CONFIG_LITMUS_AFFINITY_LOCKING - if(sem->aff_obs && sem->aff_obs->relax_max_fifo_len) { + if(sem->aff_obs) fq_of_new_on_fq = sem->aff_obs->ops->advise_enqueue(sem->aff_obs, new_on_fq); - if(fq_of_new_on_fq->count == 0) { - // ignore it? -// fq_of_new_on_fq = fq; - } - } - else { + if((fq_of_new_on_fq->count >= sem->max_fifo_len) && !sem->aff_obs->relax_max_fifo_len) + fq_of_new_on_fq = fq; /* discard recommendation */ + else fq_of_new_on_fq = fq; - } #else fq_of_new_on_fq = fq; #endif @@ -1444,16 +1436,12 @@ int ikglp_unlock(struct litmus_lock* l) new_on_fq = pq_wait->task; #ifdef CONFIG_LITMUS_AFFINITY_LOCKING - if(sem->aff_obs && sem->aff_obs->relax_max_fifo_len) { + if(sem->aff_obs) fq_of_new_on_fq = sem->aff_obs->ops->advise_enqueue(sem->aff_obs, new_on_fq); - if(fq_of_new_on_fq->count == 0) { - // ignore it? -// fq_of_new_on_fq = fq; - } - } - else { + if((fq_of_new_on_fq->count >= sem->max_fifo_len) && !sem->aff_obs->relax_max_fifo_len) + fq_of_new_on_fq = fq; /* discard recommendation */ + else fq_of_new_on_fq = fq; - } #else fq_of_new_on_fq = fq; #endif @@ -1507,8 +1495,8 @@ int ikglp_unlock(struct litmus_lock* l) // This kills any inheritance from a donor. raw_spin_lock(&tsk_rt(t)->hp_blocked_tasks_lock); { - TRACE_TASK(t, "discarding _all_ inheritance because IKGLP is outermost\n"); int count = 0; + TRACE_TASK(t, "discarding _all_ inheritance because IKGLP is outermost\n"); while(!binheap_empty(&tsk_rt(t)->hp_blocked_tasks)) { binheap_delete_root(&tsk_rt(t)->hp_blocked_tasks, struct nested_info, hp_binheap_node); diff --git a/litmus/litmus.c b/litmus/litmus.c index 35bc70455425..f0d01c34110c 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c @@ -351,7 +351,7 @@ asmlinkage long sys_sched_trace_event(int event, struct st_inject_args __user *_ } /* slam in the data */ - t->rt_param.job_params.job_no = args.job_no; + tsk_rt(t)->job_params.job_no = args.job_no; sched_trace_task_completion(t, 0); break; @@ -362,8 +362,9 @@ asmlinkage long sys_sched_trace_event(int event, struct st_inject_args __user *_ } /* slam in the data */ - tsk_rt(t)->job_params.release = args.release; - tsk_rt(t)->job_params.deadline = args.deadline; + get_release(t) = args.release; + get_deadline(t) = args.deadline; + tsk_rt(t)->job_params.job_no = args.job_no; sched_trace_task_release(t); break; diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 0d8773b2495f..9d4e822aeede 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c @@ -418,6 +418,8 @@ static noinline void job_completion(struct task_struct *t, int forced) TRACE_TASK(t, "job_completion() at %llu.\n", litmus_clock()); #ifdef CONFIG_LITMUS_LOCKING + BUG_ON(!is_persistent(t) && tsk_rt(t)->inh_task); +#if 0 if (!is_persistent(t) && tsk_rt(t)->inh_task) { /* job completing while inheriting a priority */ TRACE_TASK(t, @@ -426,6 +428,7 @@ static noinline void job_completion(struct task_struct *t, int forced) tsk_rt(t)->inh_task->comm, tsk_rt(t)->inh_task->pid); } +#endif #endif /* set flags */ diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c index 1693d70d0911..2583ee2bb437 100644 --- a/litmus/sched_task_trace.c +++ b/litmus/sched_task_trace.c @@ -155,7 +155,7 @@ feather_callback void do_sched_trace_task_switch_to(unsigned long id, { struct task_struct *t = (struct task_struct*) _task; struct st_event_record* rec; - //if (is_realtime(t)) /* comment out to trace EVERYTHING */ + if (is_realtime(t)) /* comment out to trace EVERYTHING */ { rec = get_record(ST_SWITCH_TO, t); if (rec) { @@ -171,7 +171,7 @@ feather_callback void do_sched_trace_task_switch_away(unsigned long id, { struct task_struct *t = (struct task_struct*) _task; struct st_event_record* rec; - //if (is_realtime(t)) /* comment out to trace EVERYTHING */ + if (is_realtime(t)) /* comment out to trace EVERYTHING */ { rec = get_record(ST_SWITCH_AWAY, t); if (rec) { -- cgit v1.2.2