aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/locking.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/locking.c')
-rw-r--r--litmus/locking.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/litmus/locking.c b/litmus/locking.c
index 0b5e162c0c02..4b8382cd77d1 100644
--- a/litmus/locking.c
+++ b/litmus/locking.c
@@ -365,6 +365,18 @@ static void snprintf_dgl(char* buf, size_t bsz, struct litmus_lock* dgl_locks[],
365#endif 365#endif
366 366
367 367
368static int failed_owner(struct litmus_lock *cur_lock, struct task_struct *t)
369{
370 struct task_struct *cur_owner = cur_lock->ops->get_owner(cur_lock);
371 printk(KERN_EMERG "lock %d expected owner %s/%d but got %s/%d.\n",
372 cur_lock->ident,
373 (t) ? t->comm : "null",
374 (t) ? t->pid : 0,
375 (cur_owner) ? cur_owner->comm : "null",
376 (cur_owner) ? cur_owner->pid : 0);
377 BUG();
378}
379
368/* only valid when locks are prioq locks!!! 380/* only valid when locks are prioq locks!!!
369 * THE BIG DGL LOCK MUST BE HELD! */ 381 * THE BIG DGL LOCK MUST BE HELD! */
370int __attempt_atomic_dgl_acquire(struct litmus_lock *cur_lock, dgl_wait_state_t *dgl_wait) 382int __attempt_atomic_dgl_acquire(struct litmus_lock *cur_lock, dgl_wait_state_t *dgl_wait)
@@ -386,7 +398,9 @@ int __attempt_atomic_dgl_acquire(struct litmus_lock *cur_lock, dgl_wait_state_t
386 398
387 l->ops->dgl_quick_lock(l, cur_lock, dgl_wait->task, &dgl_wait->wq_nodes[i]); 399 l->ops->dgl_quick_lock(l, cur_lock, dgl_wait->task, &dgl_wait->wq_nodes[i]);
388 400
389 BUG_ON(!(l->ops->is_owner(l, dgl_wait->task))); 401 if(!(l->ops->is_owner(l, dgl_wait->task)))
402 failed_owner(l, dgl_wait->task);
403 //BUG_ON(!(l->ops->is_owner(l, dgl_wait->task)));
390 } 404 }
391 405
392 return 0; /* success */ 406 return 0; /* success */
@@ -564,7 +578,9 @@ all_acquired:
564 // SANITY CHECK FOR TESTING 578 // SANITY CHECK FOR TESTING
565 for(i = 0; i < dgl_wait->size; ++i) { 579 for(i = 0; i < dgl_wait->size; ++i) {
566 struct litmus_lock *l = dgl_wait->locks[i]; 580 struct litmus_lock *l = dgl_wait->locks[i];
567 BUG_ON(!l->ops->is_owner(l, dgl_wait->task)); 581 if(!(l->ops->is_owner(l, dgl_wait->task)))
582 failed_owner(l, dgl_wait->task);
583 //BUG_ON(!l->ops->is_owner(l, dgl_wait->task));
568 } 584 }
569 585
570 TRACE_CUR("Acquired entire DGL\n"); 586 TRACE_CUR("Acquired entire DGL\n");
@@ -830,8 +846,25 @@ void suspend_for_lock(void)
830 } 846 }
831#endif 847#endif
832 848
849#if defined(CONFIG_LITMUS_AFFINITY_LOCKING) && defined(CONFIG_LITMUS_NVIDIA)
850 // disable tracking
851 if(tsk_rt(t)->held_gpus) {
852 tsk_rt(t)->suspend_gpu_tracker_on_block = 1;
853 }
854#endif
855
833 schedule(); 856 schedule();
834 857
858
859 /* TODO: Move the following to wake_up_for_lock()? */
860
861#if defined(CONFIG_LITMUS_AFFINITY_LOCKING) && defined(CONFIG_LITMUS_NVIDIA)
862 // re-enable tracking
863 if(tsk_rt(t)->held_gpus) {
864 tsk_rt(t)->suspend_gpu_tracker_on_block = 0;
865 }
866#endif
867
835#ifdef CONFIG_LITMUS_NVIDIA 868#ifdef CONFIG_LITMUS_NVIDIA
836 if (gpu_restore) { 869 if (gpu_restore) {
837 /* restore our state */ 870 /* restore our state */
@@ -847,6 +880,15 @@ void suspend_for_lock(void)
847#endif 880#endif
848} 881}
849 882
883int wake_up_for_lock(struct task_struct* t)
884{
885 int ret;
886
887 ret = wake_up_process(t);
888
889 return ret;
890}
891
850 892
851#else // CONFIG_LITMUS_LOCKING 893#else // CONFIG_LITMUS_LOCKING
852 894