aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_mc.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/sched_mc.c')
-rw-r--r--litmus/sched_mc.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c
index 90a60c568183..b2a9ca205be4 100644
--- a/litmus/sched_mc.c
+++ b/litmus/sched_mc.c
@@ -69,9 +69,9 @@ static int interrupt_cpu;
69 (container_of((void*)((ce) - (ce)->level), struct cpu_entry, crit_entries)) 69 (container_of((void*)((ce) - (ce)->level), struct cpu_entry, crit_entries))
70#define get_crit_entry_for(cpu, level) (&per_cpu(cpus, cpu).crit_entries[level]) 70#define get_crit_entry_for(cpu, level) (&per_cpu(cpus, cpu).crit_entries[level])
71#define TRACE_ENTRY(e, fmt, args...) \ 71#define TRACE_ENTRY(e, fmt, args...) \
72 STRACE("P%d, linked=" TS " " fmt "\n", e->cpu, TA(e->linked), ##args) 72 STRACE("P%d, linked=" TS " " fmt, e->cpu, TA(e->linked), ##args)
73#define TRACE_CRIT_ENTRY(ce, fmt, args...) \ 73#define TRACE_CRIT_ENTRY(ce, fmt, args...) \
74 STRACE("%s P%d, linked=" TS " " fmt "\n", \ 74 STRACE("%s P%d, linked=" TS " " fmt, \
75 (ce)->domain->name, crit_cpu(ce)->cpu, TA((ce)->linked), ##args) 75 (ce)->domain->name, crit_cpu(ce)->cpu, TA((ce)->linked), ##args)
76 76
77/* 77/*
@@ -163,14 +163,14 @@ static void update_ghost_time(struct task_struct *p)
163 BUG_ON(!is_ghost(p)); 163 BUG_ON(!is_ghost(p));
164 if (unlikely ((s64)delta < 0)) { 164 if (unlikely ((s64)delta < 0)) {
165 delta = 0; 165 delta = 0;
166 TRACE_MC_TASK(p, "WARNING: negative time delta"); 166 TRACE_MC_TASK(p, "WARNING: negative time delta\n");
167 } 167 }
168 if (tsk_mc_data(p)->mc_job.ghost_budget <= delta) { 168 if (tsk_mc_data(p)->mc_job.ghost_budget <= delta) {
169 TRACE_MC_TASK(p, "Ghost job could have ended"); 169 TRACE_MC_TASK(p, "Ghost job could have ended\n");
170 tsk_mc_data(p)->mc_job.ghost_budget = 0; 170 tsk_mc_data(p)->mc_job.ghost_budget = 0;
171 p->se.exec_start = clock; 171 p->se.exec_start = clock;
172 } else { 172 } else {
173 TRACE_MC_TASK(p, "Ghost job updated, but didn't finish"); 173 TRACE_MC_TASK(p, "Ghost job updated, but didn't finish\n");
174 tsk_mc_data(p)->mc_job.ghost_budget -= delta; 174 tsk_mc_data(p)->mc_job.ghost_budget -= delta;
175 p->se.exec_start = clock; 175 p->se.exec_start = clock;
176 } 176 }
@@ -201,7 +201,7 @@ static void link_task_to_crit(struct crit_entry *ce,
201{ 201{
202 lt_t when_to_fire; 202 lt_t when_to_fire;
203 203
204 TRACE_CRIT_ENTRY(ce, "Linking " TS, TA(task)); 204 TRACE_CRIT_ENTRY(ce, "Linking " TS "\n", TA(task));
205 BUG_ON(!ce->usable && task); 205 BUG_ON(!ce->usable && task);
206 BUG_ON(task && tsk_rt(task)->linked_on != NO_CPU); 206 BUG_ON(task && tsk_rt(task)->linked_on != NO_CPU);
207 BUG_ON(task && is_global(ce->domain) && 207 BUG_ON(task && is_global(ce->domain) &&
@@ -209,7 +209,7 @@ static void link_task_to_crit(struct crit_entry *ce,
209 209
210 /* Unlink last task */ 210 /* Unlink last task */
211 if (ce->linked) { 211 if (ce->linked) {
212 TRACE_MC_TASK(ce->linked, "Unlinking"); 212 TRACE_MC_TASK(ce->linked, "Unlinking\n");
213 ce->linked->rt_param.linked_on = NO_CPU; 213 ce->linked->rt_param.linked_on = NO_CPU;
214 if (is_ghost(ce->linked)) { 214 if (is_ghost(ce->linked)) {
215 cancel_ghost(ce); 215 cancel_ghost(ce);
@@ -248,7 +248,7 @@ static void job_arrival(struct task_struct *task)
248{ 248{
249 struct domain *dom = get_task_domain(task); 249 struct domain *dom = get_task_domain(task);
250 250
251 TRACE_MC_TASK(task, "Job arriving"); 251 TRACE_MC_TASK(task, "Job arriving\n");
252 BUG_ON(!task); 252 BUG_ON(!task);
253 253
254 if (can_requeue(task)) { 254 if (can_requeue(task)) {
@@ -263,7 +263,7 @@ static void job_arrival(struct task_struct *task)
263 * causing the system to crash when the task is scheduled 263 * causing the system to crash when the task is scheduled
264 * in two places simultaneously. 264 * in two places simultaneously.
265 */ 265 */
266 TRACE_MC_TASK(task, "Delayed arrival of scheduled task"); 266 TRACE_MC_TASK(task, "Delayed arrival of scheduled task\n");
267 } 267 }
268} 268}
269 269
@@ -284,7 +284,7 @@ static void low_prio_arrival(struct task_struct *task)
284 if (smp_processor_id() != interrupt_cpu) { 284 if (smp_processor_id() != interrupt_cpu) {
285 entry = &__get_cpu_var(cpus); 285 entry = &__get_cpu_var(cpus);
286 raw_spin_lock(&entry->redir_lock); 286 raw_spin_lock(&entry->redir_lock);
287 TRACE_MC_TASK(task, "Adding to redirect queue"); 287 TRACE_MC_TASK(task, "Adding to redirect queue\n");
288 list_add(&tsk_rt(task)->list, &entry->redir); 288 list_add(&tsk_rt(task)->list, &entry->redir);
289 raw_spin_unlock(&entry->redir_lock); 289 raw_spin_unlock(&entry->redir_lock);
290 litmus_reschedule(interrupt_cpu); 290 litmus_reschedule(interrupt_cpu);
@@ -314,7 +314,7 @@ static void fix_global_levels(void)
314 list_for_each_safe(pos, safe, &e->redir) { 314 list_for_each_safe(pos, safe, &e->redir) {
315 t = list_entry(pos, struct task_struct, rt_param.list); 315 t = list_entry(pos, struct task_struct, rt_param.list);
316 BUG_ON(!t); 316 BUG_ON(!t);
317 TRACE_MC_TASK(t, "Dequeued redirected job"); 317 TRACE_MC_TASK(t, "Dequeued redirected job\n");
318 list_del_init(pos); 318 list_del_init(pos);
319 job_arrival(t); 319 job_arrival(t);
320 } 320 }
@@ -331,7 +331,7 @@ static void fix_global_levels(void)
331static void link_task_to_cpu(struct cpu_entry *entry, struct task_struct *task) 331static void link_task_to_cpu(struct cpu_entry *entry, struct task_struct *task)
332{ 332{
333 int i = entry_level(entry); 333 int i = entry_level(entry);
334 TRACE_MC_TASK(task, "Linking to P%d", entry->cpu); 334 TRACE_MC_TASK(task, "Linking to P%d\n", entry->cpu);
335 BUG_ON(task && tsk_rt(task)->linked_on != entry->cpu); 335 BUG_ON(task && tsk_rt(task)->linked_on != entry->cpu);
336 BUG_ON(task && is_ghost(task)); 336 BUG_ON(task && is_ghost(task));
337 337
@@ -341,7 +341,7 @@ static void link_task_to_cpu(struct cpu_entry *entry, struct task_struct *task)
341 entry->linked = task; 341 entry->linked = task;
342 /* Higher criticality crit entries are now usable */ 342 /* Higher criticality crit entries are now usable */
343 for (; i < entry_level(entry) + 1; i++) { 343 for (; i < entry_level(entry) + 1; i++) {
344 TRACE_CRIT_ENTRY(&entry->crit_entries[i], "Marking usable"); 344 TRACE_CRIT_ENTRY(&entry->crit_entries[i], "Marking usable\n");
345 entry->crit_entries[i].usable = 1; 345 entry->crit_entries[i].usable = 1;
346 } 346 }
347} 347}
@@ -360,7 +360,7 @@ static void preempt(struct domain *dom, struct crit_entry *ce)
360 struct task_struct *old = ce->linked; 360 struct task_struct *old = ce->linked;
361 361
362 BUG_ON(!task); 362 BUG_ON(!task);
363 TRACE_CRIT_ENTRY(ce, "Preempted by " TS, TA(task)); 363 TRACE_CRIT_ENTRY(ce, "Preempted by " TS "\n", TA(task));
364 364
365 /* Per-domain preemption */ 365 /* Per-domain preemption */
366 if (old && can_requeue(old)) { 366 if (old && can_requeue(old)) {
@@ -407,7 +407,7 @@ static void update_crit_levels(struct cpu_entry *entry)
407 * explained in job_arrival. 407 * explained in job_arrival.
408 */ 408 */
409 readmit[i] = (!global_preempted) ? ce->linked : NULL; 409 readmit[i] = (!global_preempted) ? ce->linked : NULL;
410 TRACE_CRIT_ENTRY(ce, "Marking un-usable"); 410 TRACE_CRIT_ENTRY(ce, "Marking un-usable\n");
411 ce->usable = 0; 411 ce->usable = 0;
412 if (ce->linked) 412 if (ce->linked)
413 link_task_to_crit(ce, NULL); 413 link_task_to_crit(ce, NULL);
@@ -481,7 +481,7 @@ static void remove_from_all(struct task_struct* task)
481 struct crit_entry *ce; 481 struct crit_entry *ce;
482 struct domain *dom = get_task_domain(task); 482 struct domain *dom = get_task_domain(task);
483 483
484 TRACE_MC_TASK(task, "Removing from everything"); 484 TRACE_MC_TASK(task, "Removing from everything\n");
485 BUG_ON(!task); 485 BUG_ON(!task);
486 486
487 raw_spin_lock(dom->lock); 487 raw_spin_lock(dom->lock);
@@ -530,7 +530,7 @@ static void remove_from_all(struct task_struct* task)
530static void job_completion(struct task_struct *task, int forced) 530static void job_completion(struct task_struct *task, int forced)
531{ 531{
532 lt_t now; 532 lt_t now;
533 TRACE_MC_TASK(task, "Completed"); 533 TRACE_MC_TASK(task, "Completed\n");
534 sched_trace_task_completion(task, forced); 534 sched_trace_task_completion(task, forced);
535 BUG_ON(!task); 535 BUG_ON(!task);
536 536
@@ -542,7 +542,7 @@ static void job_completion(struct task_struct *task, int forced)
542 542
543 /* If it's not a ghost job, do ghost job conversion */ 543 /* If it's not a ghost job, do ghost job conversion */
544 if (!is_ghost(task)) { 544 if (!is_ghost(task)) {
545 TRACE_MC_TASK(task, "is not a ghost task"); 545 TRACE_MC_TASK(task, "is not a ghost task\n");
546 tsk_mc_data(task)->mc_job.ghost_budget = budget_remaining(task); 546 tsk_mc_data(task)->mc_job.ghost_budget = budget_remaining(task);
547 tsk_mc_data(task)->mc_job.is_ghost = 1; 547 tsk_mc_data(task)->mc_job.is_ghost = 1;
548 } 548 }
@@ -552,7 +552,7 @@ static void job_completion(struct task_struct *task, int forced)
552 * conversion. Revert back to a normal task and complete the period. 552 * conversion. Revert back to a normal task and complete the period.
553 */ 553 */
554 if (tsk_mc_data(task)->mc_job.ghost_budget == 0) { 554 if (tsk_mc_data(task)->mc_job.ghost_budget == 0) {
555 TRACE_MC_TASK(task, "has zero ghost budget"); 555 TRACE_MC_TASK(task, "has zero ghost budget\n");
556 tsk_mc_data(task)->mc_job.is_ghost = 0; 556 tsk_mc_data(task)->mc_job.is_ghost = 0;
557 prepare_for_next_period(task); 557 prepare_for_next_period(task);
558 if (is_released(task, litmus_clock())) 558 if (is_released(task, litmus_clock()))
@@ -582,7 +582,7 @@ static enum hrtimer_restart mc_ghost_exhausted(struct hrtimer *timer)
582 582
583 local_irq_save(flags); 583 local_irq_save(flags);
584 TRACE("Ghost exhausted\n"); 584 TRACE("Ghost exhausted\n");
585 TRACE_CRIT_ENTRY(ce, "Firing here"); 585 TRACE_CRIT_ENTRY(ce, "Firing here\n");
586 586
587 /* Due to race conditions, we cannot just set the linked 587 /* Due to race conditions, we cannot just set the linked
588 * task's budget to 0 as it may no longer be the task 588 * task's budget to 0 as it may no longer be the task
@@ -929,7 +929,7 @@ static struct task_struct* mc_schedule(struct task_struct * prev)
929 if (next) { 929 if (next) {
930 TRACE_TASK(next, "Picked this task\n"); 930 TRACE_TASK(next, "Picked this task\n");
931 } else if (exists && !next) 931 } else if (exists && !next)
932 TRACE_ENTRY(entry, "Becomes idle at %llu", litmus_clock()); 932 TRACE_ENTRY(entry, "Becomes idle at %llu\n", litmus_clock());
933 return next; 933 return next;
934} 934}
935 935