aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_mc2.c
diff options
context:
space:
mode:
authorNamhoon Kim <namhoonk@cs.unc.edu>2016-09-22 14:49:49 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2016-09-22 14:49:49 -0400
commitd7352bf3c9392104c34b56e2c0756a14db81b68a (patch)
tree34a42a02bb6ce3a10b00ce5fa9302ab182d3aae0 /litmus/sched_mc2.c
parent2b1bccf411c97a933796526b0427785a2dafde1d (diff)
9/22/2016
Diffstat (limited to 'litmus/sched_mc2.c')
-rw-r--r--litmus/sched_mc2.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/litmus/sched_mc2.c b/litmus/sched_mc2.c
index 5c88a36aacec..d0a39ff96b13 100644
--- a/litmus/sched_mc2.c
+++ b/litmus/sched_mc2.c
@@ -341,7 +341,7 @@ static void mc2_update_timer_and_unlock(struct mc2_cpu_state *state)
341 local = local_cpu_state() == state; 341 local = local_cpu_state() == state;
342 342
343 raw_spin_lock(&_global_env.lock); 343 raw_spin_lock(&_global_env.lock);
344 344// TRACE("P%d acquired GE lock L344\n");
345 list_for_each_entry_safe(event, next, &_global_env.next_events, list) { 345 list_for_each_entry_safe(event, next, &_global_env.next_events, list) {
346 /* If the event time is already passed, we call schedule() on 346 /* If the event time is already passed, we call schedule() on
347 the lowest priority cpu */ 347 the lowest priority cpu */
@@ -376,6 +376,7 @@ static void mc2_update_timer_and_unlock(struct mc2_cpu_state *state)
376 /* Must drop state lock before calling into hrtimer_start(), which 376 /* Must drop state lock before calling into hrtimer_start(), which
377 * may raise a softirq, which in turn may wake ksoftirqd. */ 377 * may raise a softirq, which in turn may wake ksoftirqd. */
378 raw_spin_unlock(&_global_env.lock); 378 raw_spin_unlock(&_global_env.lock);
379// TRACE("P%d releases GE lock L379\n");
379 raw_spin_unlock(&state->lock); 380 raw_spin_unlock(&state->lock);
380 381
381 if (update <= now || reschedule[state->cpu]) { 382 if (update <= now || reschedule[state->cpu]) {
@@ -600,6 +601,7 @@ static enum hrtimer_restart on_scheduling_timer(struct hrtimer *timer)
600 } 601 }
601 602
602 raw_spin_lock(&_global_env.lock); 603 raw_spin_lock(&_global_env.lock);
604// TRACE("P%d acquired GE lock L604\n");
603 global_schedule_now = gmp_update_time(&_global_env, now); 605 global_schedule_now = gmp_update_time(&_global_env, now);
604 606
605 BUG_ON(global_schedule_now < 0 || global_schedule_now > 4); 607 BUG_ON(global_schedule_now < 0 || global_schedule_now > 4);
@@ -619,7 +621,7 @@ static enum hrtimer_restart on_scheduling_timer(struct hrtimer *timer)
619 } 621 }
620 } 622 }
621 raw_spin_unlock(&_global_env.lock); 623 raw_spin_unlock(&_global_env.lock);
622 624// TRACE("P%d releases GE lock L624\n");
623 raw_spin_unlock_irqrestore(&state->lock, flags); 625 raw_spin_unlock_irqrestore(&state->lock, flags);
624 //raw_spin_unlock_irqrestore(&_global_env.lock, flags); 626 //raw_spin_unlock_irqrestore(&_global_env.lock, flags);
625 627
@@ -679,6 +681,7 @@ static long mc2_complete_job(void)
679 state = local_cpu_state(); 681 state = local_cpu_state();
680 raw_spin_lock(&state->lock); 682 raw_spin_lock(&state->lock);
681 raw_spin_lock(&_global_env.lock); 683 raw_spin_lock(&_global_env.lock);
684// TRACE("P%d acquired GE lock L684\n");
682 res = gmp_find_by_id(&_global_env, tinfo->mc2_param.res_id); 685 res = gmp_find_by_id(&_global_env, tinfo->mc2_param.res_id);
683 _global_env.env.time_zero = tsk_rt(current)->sporadic_release_time; 686 _global_env.env.time_zero = tsk_rt(current)->sporadic_release_time;
684 } 687 }
@@ -705,8 +708,10 @@ static long mc2_complete_job(void)
705 //if (lv < CRIT_LEVEL_C) 708 //if (lv < CRIT_LEVEL_C)
706// raw_spin_unlock(&state->lock); 709// raw_spin_unlock(&state->lock);
707 //else 710 //else
708 if (lv == CRIT_LEVEL_C) 711 if (lv == CRIT_LEVEL_C) {
709 raw_spin_unlock(&_global_env.lock); 712 raw_spin_unlock(&_global_env.lock);
713// TRACE("P%d releases GE lock L713\n");
714 }
710 715
711 raw_spin_unlock(&state->lock); 716 raw_spin_unlock(&state->lock);
712 local_irq_restore(flags); 717 local_irq_restore(flags);
@@ -991,7 +996,7 @@ static struct task_struct* mc2_schedule(struct task_struct * prev)
991 } 996 }
992 } 997 }
993 998
994 if (to_schedule != 0) { 999 if (to_schedule > 0) {
995 raw_spin_lock(&_global_env.lock); 1000 raw_spin_lock(&_global_env.lock);
996 while (to_schedule--) { 1001 while (to_schedule--) {
997 int cpu = get_lowest_prio_cpu(0); 1002 int cpu = get_lowest_prio_cpu(0);
@@ -1078,9 +1083,11 @@ static void mc2_task_resume(struct task_struct *tsk)
1078 task_arrives(state, tsk); 1083 task_arrives(state, tsk);
1079 } else { 1084 } else {
1080 raw_spin_lock(&_global_env.lock); 1085 raw_spin_lock(&_global_env.lock);
1086// TRACE("P%d acquired GE lock L1086\n");
1081 gmp_update_time(&_global_env, litmus_clock()); 1087 gmp_update_time(&_global_env, litmus_clock());
1082 task_arrives(state, tsk); 1088 task_arrives(state, tsk);
1083 raw_spin_unlock(&_global_env.lock); 1089 raw_spin_unlock(&_global_env.lock);
1090// TRACE("P%d releases GE lock L1090\n");
1084 } 1091 }
1085 1092
1086 /* 9/20/2015 fix 1093 /* 9/20/2015 fix