diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-17 19:31:04 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-17 19:31:04 -0400 |
commit | ba54b1096870fba6e3bbb99aafc713e76b747353 (patch) | |
tree | 26727a7f89ca520392fec0b559f09500cb9934ac /litmus/locking.c | |
parent | ef0974bf8e768b38d728f3bba147332ddea1e11b (diff) |
Fixed three bugs with aux threads and nested locks
Fixes two bugs with nested locks:
1) List of aux threads could become corrupted.
-- moved modifications to be within scheduler lock.
2) Fixed bad EDF comparison ordering that could lead
to schedule thrashing in an infinite loop.
3) Prevent aux threads from inheriting a priority from
a task that is blocked on a real-time litmus lock.
(since the aux threads can't possibly hold these locks,
we don't have to worry about inheritance.)
Diffstat (limited to 'litmus/locking.c')
-rw-r--r-- | litmus/locking.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/litmus/locking.c b/litmus/locking.c index 12a23eb715cc..16c936ba8139 100644 --- a/litmus/locking.c +++ b/litmus/locking.c | |||
@@ -540,6 +540,35 @@ out: | |||
540 | return passed; | 540 | return passed; |
541 | } | 541 | } |
542 | 542 | ||
543 | |||
544 | void suspend_for_lock(void) | ||
545 | { | ||
546 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
547 | unsigned int restore = 0; | ||
548 | struct task_struct *t = current; | ||
549 | unsigned int hide; | ||
550 | |||
551 | if (tsk_rt(t)->has_aux_tasks) { | ||
552 | /* hide from aux tasks so they can't inherit our priority when we block | ||
553 | * for a litmus lock. inheritance is already going to a litmus lock | ||
554 | * holder. */ | ||
555 | hide = tsk_rt(t)->hide_from_aux_tasks; | ||
556 | restore = 1; | ||
557 | tsk_rt(t)->hide_from_aux_tasks = 1; | ||
558 | } | ||
559 | #endif | ||
560 | |||
561 | schedule(); | ||
562 | |||
563 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
564 | if (restore) { | ||
565 | /* restore our state */ | ||
566 | tsk_rt(t)->hide_from_aux_tasks = hide; | ||
567 | } | ||
568 | #endif | ||
569 | } | ||
570 | |||
571 | |||
543 | #else // CONFIG_LITMUS_LOCKING | 572 | #else // CONFIG_LITMUS_LOCKING |
544 | 573 | ||
545 | struct fdso_ops generic_lock_ops = {}; | 574 | struct fdso_ops generic_lock_ops = {}; |