aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhoon Kim <namhoonk@cs.unc.edu>2017-04-25 08:12:24 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2017-04-25 08:12:24 -0400
commit1352c240858520bdf412c7e53b6389cea4c3ee27 (patch)
tree20121517d1cd85113944b0753d873248203afb87
parentfef9a0ca81a70b5b36962026a40b71e437dcc5be (diff)
deadlock patch
-rw-r--r--litmus/sched_mc2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/litmus/sched_mc2.c b/litmus/sched_mc2.c
index f8ad5c615e5d..864e1b03d924 100644
--- a/litmus/sched_mc2.c
+++ b/litmus/sched_mc2.c
@@ -148,7 +148,7 @@ asmlinkage long sys_enact_mode(void)
148 } 148 }
149 mode_changed = false; 149 mode_changed = false;
150 if (pending){ //MCR has entered 150 if (pending){ //MCR has entered
151 raw_spin_lock_irqsave(&state->lock,flags); 151 raw_spin_lock_irqsave(&state->lock, flags);
152 //TRACE_CUR("LOCK_MSG: GLOBAL LOCK\n"); 152 //TRACE_CUR("LOCK_MSG: GLOBAL LOCK\n");
153 raw_spin_lock(&global_lock); 153 raw_spin_lock(&global_lock);
154 raw_spin_lock(&mode_lock); 154 raw_spin_lock(&mode_lock);
@@ -602,6 +602,7 @@ static void mc2_update_timer_and_unlock(struct mc2_cpu_state *state)
602 //enum crit_level lv = get_task_crit_level(state->scheduled); 602 //enum crit_level lv = get_task_crit_level(state->scheduled);
603 struct next_timer_event *event, *next; 603 struct next_timer_event *event, *next;
604 int reschedule[NR_CPUS]; 604 int reschedule[NR_CPUS];
605 unsigned long flags;
605 606
606 for (cpus = 0; cpus<NR_CPUS; cpus++) 607 for (cpus = 0; cpus<NR_CPUS; cpus++)
607 reschedule[cpus] = 0; 608 reschedule[cpus] = 0;
@@ -616,6 +617,7 @@ static void mc2_update_timer_and_unlock(struct mc2_cpu_state *state)
616 local = local_cpu_state() == state; 617 local = local_cpu_state() == state;
617 618
618 //TRACE_CUR("LOCK_MSG: GLOBAL LOCK\n"); 619 //TRACE_CUR("LOCK_MSG: GLOBAL LOCK\n");
620 local_irq_save(flags);
619 raw_spin_lock(&global_lock); 621 raw_spin_lock(&global_lock);
620 622
621 list_for_each_entry_safe(event, next, &_global_env->next_events, list) { 623 list_for_each_entry_safe(event, next, &_global_env->next_events, list) {
@@ -654,6 +656,7 @@ static void mc2_update_timer_and_unlock(struct mc2_cpu_state *state)
654 * may raise a softirq, which in turn may wake ksoftirqd. */ 656 * may raise a softirq, which in turn may wake ksoftirqd. */
655 //TRACE_CUR("LOCK_MSG: GLOBAL UNLOCK\n"); 657 //TRACE_CUR("LOCK_MSG: GLOBAL UNLOCK\n");
656 raw_spin_unlock(&global_lock); 658 raw_spin_unlock(&global_lock);
659 local_irq_restore(flags);
657 raw_spin_unlock(&state->lock); 660 raw_spin_unlock(&state->lock);
658 661
659 if ((update <= now) || reschedule[state->cpu]) { 662 if ((update <= now) || reschedule[state->cpu]) {