aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-04-06 13:09:38 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2013-04-06 13:09:38 -0400
commit759ef91c440ea42a0ca55b86b6886ca7743bab63 (patch)
tree0042369c557b877884e489b887a92a60bf8037c0
parentab187fdd431c3f0222f994723a02ce31fe7d4a96 (diff)
PRIOQ: Handled budget exhaustion.
-rw-r--r--litmus/fifo_lock.c5
-rw-r--r--litmus/prioq_lock.c53
2 files changed, 42 insertions, 16 deletions
diff --git a/litmus/fifo_lock.c b/litmus/fifo_lock.c
index e3a4420851b2..88f27a016b16 100644
--- a/litmus/fifo_lock.c
+++ b/litmus/fifo_lock.c
@@ -684,7 +684,8 @@ inline static void __fifo_mutex_propagate_decrease_inheritance(
684 struct litmus_lock *still_blocked = tsk_rt(t)->blocked_lock; 684 struct litmus_lock *still_blocked = tsk_rt(t)->blocked_lock;
685 685
686 /* TODO: is this code path valid for budgets? */ 686 /* TODO: is this code path valid for budgets? */
687 WARN_ON(1); 687 if (budget_tiggered)
688 WARN_ON(1);
688 689
689 TRACE_TASK(t, "is not blocked on lock %d.\n", l->ident); 690 TRACE_TASK(t, "is not blocked on lock %d.\n", l->ident);
690 if(still_blocked) { 691 if(still_blocked) {
@@ -735,7 +736,7 @@ void fifo_mutex_budget_exhausted(struct litmus_lock* l, struct task_struct* t)
735 struct fifo_mutex *mutex = fifo_mutex_from_lock(l); 736 struct fifo_mutex *mutex = fifo_mutex_from_lock(l);
736 unsigned long flags = 0; 737 unsigned long flags = 0;
737 738
738 /* DGL lock must already be held on this code path */ 739 /* DGL lock must already be held on this code path if DGLs are enabled. */
739 lock_fine_irqsave(&mutex->lock, flags); 740 lock_fine_irqsave(&mutex->lock, flags);
740 741
741 /* unlocks mutex->lock */ 742 /* unlocks mutex->lock */
diff --git a/litmus/prioq_lock.c b/litmus/prioq_lock.c
index cd351079c8bf..71ef87db316b 100644
--- a/litmus/prioq_lock.c
+++ b/litmus/prioq_lock.c
@@ -70,9 +70,9 @@ __dump_prioq_lock_info(struct prioq_mutex *mutex)
70 "\n", 70 "\n",
71 blocked_task->comm, blocked_task->pid, 71 blocked_task->comm, blocked_task->pid,
72 (tsk_rt(blocked_task)->inh_task) ? 72 (tsk_rt(blocked_task)->inh_task) ?
73 tsk_rt(blocked_task)->inh_task->comm : "null", 73 tsk_rt(blocked_task)->inh_task->comm : "null",
74 (tsk_rt(blocked_task)->inh_task) ? 74 (tsk_rt(blocked_task)->inh_task) ?
75 tsk_rt(blocked_task)->inh_task->pid : 0 75 tsk_rt(blocked_task)->inh_task->pid : 0
76#ifdef CONFIG_LITMUS_DGL_SUPPORT 76#ifdef CONFIG_LITMUS_DGL_SUPPORT
77 , enabled 77 , enabled
78#endif 78#endif
@@ -1158,18 +1158,17 @@ void prioq_mutex_propagate_increase_inheritance(struct litmus_lock* l,
1158} 1158}
1159 1159
1160 1160
1161void prioq_mutex_propagate_decrease_inheritance(struct litmus_lock* l, 1161
1162 struct task_struct* t, 1162
1163 raw_spinlock_t* to_unlock, 1163
1164 unsigned long irqflags, 1164inline static void __prioq_mutex_propagate_decrease_inheritance(
1165 int budget_triggered) 1165 struct litmus_lock* l,
1166 struct task_struct* t,
1167 unsigned long irqflags,
1168 int budget_triggered)
1166{ 1169{
1167 struct prioq_mutex *mutex = prioq_mutex_from_lock(l); 1170 struct prioq_mutex *mutex = prioq_mutex_from_lock(l);
1168 1171
1169 // relay-style locking
1170 lock_fine(&mutex->lock);
1171 unlock_fine(to_unlock);
1172
1173#ifdef CONFIG_LITMUS_DGL_SUPPORT 1172#ifdef CONFIG_LITMUS_DGL_SUPPORT
1174 __prioq_dgl_decrease_pos(mutex, t); 1173 __prioq_dgl_decrease_pos(mutex, t);
1175#else 1174#else
@@ -1195,7 +1194,7 @@ void prioq_mutex_propagate_decrease_inheritance(struct litmus_lock* l,
1195 old_max_eff_prio = top_priority(&tsk_rt(owner)->hp_blocked_tasks); 1194 old_max_eff_prio = top_priority(&tsk_rt(owner)->hp_blocked_tasks);
1196 1195
1197 binheap_delete(&l->nest.hp_binheap_node, &tsk_rt(owner)->hp_blocked_tasks); 1196 binheap_delete(&l->nest.hp_binheap_node, &tsk_rt(owner)->hp_blocked_tasks);
1198 mutex->hp_waiter = __prioq_mutex_find_hp_waiter(mutex, NULL); 1197 mutex->hp_waiter = __prioq_mutex_find_hp_waiter(mutex, NULL); /* update HP waiter */
1199 1198
1200 TRACE_TASK(t, "prioq_mutex %d state after prio decrease in priority queue\n", l->ident); 1199 TRACE_TASK(t, "prioq_mutex %d state after prio decrease in priority queue\n", l->ident);
1201 __dump_prioq_lock_info(mutex); 1200 __dump_prioq_lock_info(mutex);
@@ -1240,7 +1239,8 @@ void prioq_mutex_propagate_decrease_inheritance(struct litmus_lock* l,
1240 } 1239 }
1241 1240
1242 // beware: recursion 1241 // beware: recursion
1243 litmus->nested_decrease_prio(owner, decreased_prio, &mutex->lock, irqflags, budget_triggered); // will unlock mutex->lock 1242 litmus->nested_decrease_prio(owner, decreased_prio, &mutex->lock, irqflags,
1243 budget_triggered); // will unlock mutex->lock
1244 } 1244 }
1245 else { 1245 else {
1246 raw_spin_unlock(&tsk_rt(owner)->hp_blocked_tasks_lock); 1246 raw_spin_unlock(&tsk_rt(owner)->hp_blocked_tasks_lock);
@@ -1261,6 +1261,9 @@ void prioq_mutex_propagate_decrease_inheritance(struct litmus_lock* l,
1261 TRACE_TASK(t, "prioq_mutex %d state after prio decrease in priority queue\n", l->ident); 1261 TRACE_TASK(t, "prioq_mutex %d state after prio decrease in priority queue\n", l->ident);
1262 __dump_prioq_lock_info(mutex); 1262 __dump_prioq_lock_info(mutex);
1263 1263
1264 if (budget_triggered)
1265 WARN_ON(1);
1266
1264 still_blocked = tsk_rt(t)->blocked_lock; 1267 still_blocked = tsk_rt(t)->blocked_lock;
1265 1268
1266 TRACE_TASK(t, "is not blocked on lock %d.\n", l->ident); 1269 TRACE_TASK(t, "is not blocked on lock %d.\n", l->ident);
@@ -1289,9 +1292,31 @@ void prioq_mutex_propagate_decrease_inheritance(struct litmus_lock* l,
1289 } 1292 }
1290} 1293}
1291 1294
1295void prioq_mutex_propagate_decrease_inheritance(struct litmus_lock* l,
1296 struct task_struct* t,
1297 raw_spinlock_t* to_unlock,
1298 unsigned long irqflags,
1299 int budget_triggered)
1300{
1301 struct prioq_mutex *mutex = prioq_mutex_from_lock(l);
1302
1303 // relay-style locking
1304 lock_fine(&mutex->lock);
1305 unlock_fine(to_unlock);
1306
1307 __prioq_mutex_propagate_decrease_inheritance(&mutex->litmus_lock, t,
1308 irqflags, budget_triggered);
1309}
1310
1292void prioq_mutex_budget_exhausted(struct litmus_lock* l, struct task_struct* t) 1311void prioq_mutex_budget_exhausted(struct litmus_lock* l, struct task_struct* t)
1293{ 1312{
1294 TRACE_TASK(t, "TODO!\n"); 1313 struct prioq_mutex *mutex = prioq_mutex_from_lock(l);
1314 unsigned long flags = 0;
1315
1316 /* DGL lock must already be held on this code path if DGLs are enabled. */
1317 lock_fine_irqsave(&mutex->lock, flags);
1318
1319 __prioq_mutex_propagate_decrease_inheritance(&mutex->litmus_lock, t, flags, 1);
1295} 1320}
1296 1321
1297int prioq_mutex_close(struct litmus_lock* l) 1322int prioq_mutex_close(struct litmus_lock* l)