diff options
-rwxr-xr-x[-rw-r--r--] | include/litmus/ikglp_lock.h | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | litmus/Kconfig | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | litmus/aux_tasks.c | 18 | ||||
-rwxr-xr-x[-rw-r--r--] | litmus/edf_common.c | 21 | ||||
-rwxr-xr-x[-rw-r--r--] | litmus/ikglp_lock.c | 3 |
5 files changed, 42 insertions, 24 deletions
diff --git a/include/litmus/ikglp_lock.h b/include/litmus/ikglp_lock.h index 89d9c37c7631..af155eadbb35 100644..100755 --- a/include/litmus/ikglp_lock.h +++ b/include/litmus/ikglp_lock.h | |||
@@ -114,7 +114,7 @@ struct ikglp_queue_info | |||
114 | struct fifo_queue* q; | 114 | struct fifo_queue* q; |
115 | lt_t estimated_len; | 115 | lt_t estimated_len; |
116 | int *nr_cur_users; | 116 | int *nr_cur_users; |
117 | int *nr_aff_users; | 117 | int64_t *nr_aff_users; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct ikglp_affinity_ops | 120 | struct ikglp_affinity_ops |
diff --git a/litmus/Kconfig b/litmus/Kconfig index a32f42898148..16087b9e4e81 100644..100755 --- a/litmus/Kconfig +++ b/litmus/Kconfig | |||
@@ -56,6 +56,26 @@ config REALTIME_AUX_TASKS | |||
56 | priority inversions may occur with respect to single-threaded | 56 | priority inversions may occur with respect to single-threaded |
57 | task models if/when one of threads are scheduled simultanously | 57 | task models if/when one of threads are scheduled simultanously |
58 | with another of the same identity. | 58 | with another of the same identity. |
59 | |||
60 | choice | ||
61 | prompt "Scheduling prioritization of AUX tasks." | ||
62 | default REALTIME_AUX_TASK_PRIORITY_BOOSTED | ||
63 | help | ||
64 | Select the prioritization method for auxillary tasks. | ||
65 | |||
66 | config REALTIME_AUX_TASK_PRIORITY_BOOSTED | ||
67 | bool "Boosted" | ||
68 | help | ||
69 | Run all auxillary task threads at a maximum priority. Useful for | ||
70 | temporarily working around bugs during development. | ||
71 | |||
72 | config REALTIME_AUX_TASK_PRIORITY_INHERITANCE | ||
73 | bool "Inheritance" | ||
74 | help | ||
75 | Auxillary tasks inherit the maximum priority from blocked real-time | ||
76 | threads within the same process. | ||
77 | |||
78 | Additional pitfall: | ||
59 | 3) Busy-wait deadlock is likely between normal real-time tasks and | 79 | 3) Busy-wait deadlock is likely between normal real-time tasks and |
60 | auxillary tasks synchronize using _preemptive_ spinlocks that do | 80 | auxillary tasks synchronize using _preemptive_ spinlocks that do |
61 | not use priority inheritance. | 81 | not use priority inheritance. |
@@ -73,9 +93,11 @@ config REALTIME_AUX_TASKS | |||
73 | holder that blocks the rt task CAN block on I/O and contribute its priority | 93 | holder that blocks the rt task CAN block on I/O and contribute its priority |
74 | to the aux tasks. Aux tasks may still _indirectly_ inherit the priority of | 94 | to the aux tasks. Aux tasks may still _indirectly_ inherit the priority of |
75 | the blocked rt task via the lock holder. | 95 | the blocked rt task via the lock holder. |
96 | endchoice | ||
76 | 97 | ||
77 | endmenu | 98 | endmenu |
78 | 99 | ||
100 | |||
79 | menu "Real-Time Synchronization" | 101 | menu "Real-Time Synchronization" |
80 | 102 | ||
81 | config NP_SECTION | 103 | config NP_SECTION |
diff --git a/litmus/aux_tasks.c b/litmus/aux_tasks.c index 9572d960b46a..bd7bcbed58fe 100644..100755 --- a/litmus/aux_tasks.c +++ b/litmus/aux_tasks.c | |||
@@ -50,7 +50,7 @@ int exit_aux_task(struct task_struct *t) | |||
50 | 50 | ||
51 | TRACE_CUR("Aux task %s/%d is exiting from %s/%d.\n", t->comm, t->pid, leader->comm, leader->pid); | 51 | TRACE_CUR("Aux task %s/%d is exiting from %s/%d.\n", t->comm, t->pid, leader->comm, leader->pid); |
52 | 52 | ||
53 | #if 0 | 53 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
54 | list_del(&tsk_rt(t)->aux_task_node); | 54 | list_del(&tsk_rt(t)->aux_task_node); |
55 | 55 | ||
56 | tsk_rt(t)->is_aux_task = 0; | 56 | tsk_rt(t)->is_aux_task = 0; |
@@ -67,7 +67,7 @@ static int aux_tasks_increase_priority(struct task_struct *leader, struct task_s | |||
67 | { | 67 | { |
68 | int retval = 0; | 68 | int retval = 0; |
69 | 69 | ||
70 | #if 0 | 70 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
71 | struct list_head *pos; | 71 | struct list_head *pos; |
72 | 72 | ||
73 | TRACE_CUR("Increasing priority of aux tasks in group %s/%d.\n", leader->comm, leader->pid); | 73 | TRACE_CUR("Increasing priority of aux tasks in group %s/%d.\n", leader->comm, leader->pid); |
@@ -94,7 +94,7 @@ static int aux_tasks_decrease_priority(struct task_struct *leader, struct task_s | |||
94 | { | 94 | { |
95 | int retval = 0; | 95 | int retval = 0; |
96 | 96 | ||
97 | #if 0 | 97 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
98 | struct list_head *pos; | 98 | struct list_head *pos; |
99 | 99 | ||
100 | TRACE_CUR("Decreasing priority of aux tasks in group %s/%d.\n", leader->comm, leader->pid); | 100 | TRACE_CUR("Decreasing priority of aux tasks in group %s/%d.\n", leader->comm, leader->pid); |
@@ -121,7 +121,7 @@ int aux_task_owner_increase_priority(struct task_struct *t) | |||
121 | { | 121 | { |
122 | int retval = 0; | 122 | int retval = 0; |
123 | 123 | ||
124 | #if 0 | 124 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
125 | struct task_struct *leader; | 125 | struct task_struct *leader; |
126 | struct task_struct *hp = NULL; | 126 | struct task_struct *hp = NULL; |
127 | struct task_struct *hp_eff = NULL; | 127 | struct task_struct *hp_eff = NULL; |
@@ -166,7 +166,7 @@ int aux_task_owner_decrease_priority(struct task_struct *t) | |||
166 | { | 166 | { |
167 | int retval = 0; | 167 | int retval = 0; |
168 | 168 | ||
169 | #if 0 | 169 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
170 | struct task_struct *leader; | 170 | struct task_struct *leader; |
171 | struct task_struct *hp = NULL; | 171 | struct task_struct *hp = NULL; |
172 | struct task_struct *hp_eff = NULL; | 172 | struct task_struct *hp_eff = NULL; |
@@ -214,7 +214,7 @@ long enable_aux_task_owner(struct task_struct *t) | |||
214 | { | 214 | { |
215 | long retval = 0; | 215 | long retval = 0; |
216 | 216 | ||
217 | #if 0 | 217 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
218 | struct task_struct *leader = t->group_leader; | 218 | struct task_struct *leader = t->group_leader; |
219 | struct task_struct *hp; | 219 | struct task_struct *hp; |
220 | 220 | ||
@@ -252,7 +252,7 @@ long disable_aux_task_owner(struct task_struct *t) | |||
252 | { | 252 | { |
253 | long retval = 0; | 253 | long retval = 0; |
254 | 254 | ||
255 | #if 0 | 255 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
256 | struct task_struct *leader = t->group_leader; | 256 | struct task_struct *leader = t->group_leader; |
257 | struct task_struct *hp; | 257 | struct task_struct *hp; |
258 | struct task_struct *new_hp = NULL; | 258 | struct task_struct *new_hp = NULL; |
@@ -344,7 +344,7 @@ static long __do_enable_aux_tasks(void) | |||
344 | /* hasn't been aux_tasks_increase_priorityted into rt. make it a aux. */ | 344 | /* hasn't been aux_tasks_increase_priorityted into rt. make it a aux. */ |
345 | tsk_rt(t)->is_aux_task = 1; | 345 | tsk_rt(t)->is_aux_task = 1; |
346 | 346 | ||
347 | #if 0 | 347 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
348 | list_add_tail(&tsk_rt(t)->aux_task_node, &tsk_aux(leader)->aux_tasks); | 348 | list_add_tail(&tsk_rt(t)->aux_task_node, &tsk_aux(leader)->aux_tasks); |
349 | #endif | 349 | #endif |
350 | 350 | ||
@@ -368,7 +368,7 @@ static long __do_enable_aux_tasks(void) | |||
368 | } while(t != leader); | 368 | } while(t != leader); |
369 | 369 | ||
370 | 370 | ||
371 | #if 0 | 371 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
372 | if (!binheap_empty(&tsk_aux(leader)->aux_task_owners)) { | 372 | if (!binheap_empty(&tsk_aux(leader)->aux_task_owners)) { |
373 | struct task_struct *hp = container_of(binheap_top_entry(&tsk_aux(leader)->aux_task_owners, struct rt_param, aux_task_owner_node), | 373 | struct task_struct *hp = container_of(binheap_top_entry(&tsk_aux(leader)->aux_task_owners, struct rt_param, aux_task_owner_node), |
374 | struct task_struct, rt_param); | 374 | struct task_struct, rt_param); |
diff --git a/litmus/edf_common.c b/litmus/edf_common.c index a9bf0c08e125..5a3f5b417f73 100644..100755 --- a/litmus/edf_common.c +++ b/litmus/edf_common.c | |||
@@ -43,7 +43,7 @@ static inline long edf_hash(struct task_struct *t) | |||
43 | } | 43 | } |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #ifdef CONFIG_REALTIME_AUX_TASKS | 46 | #ifdef CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE |
47 | int aux_tie_break(struct task_struct *first, struct task_struct *second) | 47 | int aux_tie_break(struct task_struct *first, struct task_struct *second) |
48 | { | 48 | { |
49 | long fhash = edf_hash(first); | 49 | long fhash = edf_hash(first); |
@@ -90,9 +90,8 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
90 | return first && !second; | 90 | return first && !second; |
91 | } | 91 | } |
92 | 92 | ||
93 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
94 | { | ||
95 | 93 | ||
94 | #if defined(CONFIG_REALTIME_AUX_TASK_PRIORITY_BOOSTED) | ||
96 | /* run aux tasks at max priority */ | 95 | /* run aux tasks at max priority */ |
97 | if (first->rt_param.is_aux_task != second->rt_param.is_aux_task) | 96 | if (first->rt_param.is_aux_task != second->rt_param.is_aux_task) |
98 | { | 97 | { |
@@ -103,9 +102,8 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
103 | first = first->group_leader; | 102 | first = first->group_leader; |
104 | second = second->group_leader; | 103 | second = second->group_leader; |
105 | } | 104 | } |
106 | 105 | #elif defined(CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE) | |
107 | 106 | { | |
108 | #if 0 | ||
109 | int first_lo_aux, second_lo_aux; | 107 | int first_lo_aux, second_lo_aux; |
110 | int first_hi_aux, second_hi_aux; | 108 | int first_hi_aux, second_hi_aux; |
111 | first_lo_aux = first->rt_param.is_aux_task && !first->rt_param.inh_task; | 109 | first_lo_aux = first->rt_param.is_aux_task && !first->rt_param.inh_task; |
@@ -133,11 +131,10 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
133 | TRACE_CUR("hi aux tie break: %s/%d >> %s/%d --- %d\n", first->comm, first->pid, second->comm, second->pid, aux_hi_tie_break); | 131 | TRACE_CUR("hi aux tie break: %s/%d >> %s/%d --- %d\n", first->comm, first->pid, second->comm, second->pid, aux_hi_tie_break); |
134 | return aux_hi_tie_break; | 132 | return aux_hi_tie_break; |
135 | } | 133 | } |
136 | #endif | ||
137 | |||
138 | } | 134 | } |
139 | #endif | 135 | #endif |
140 | 136 | ||
137 | |||
141 | #ifdef CONFIG_LITMUS_LOCKING | 138 | #ifdef CONFIG_LITMUS_LOCKING |
142 | /* Check for EFFECTIVE priorities. Change task | 139 | /* Check for EFFECTIVE priorities. Change task |
143 | * used for comparison in such a case. | 140 | * used for comparison in such a case. |
@@ -252,15 +249,13 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
252 | else if (first_task->rt_param.is_proxy_thread == second_task->rt_param.is_proxy_thread) { | 249 | else if (first_task->rt_param.is_proxy_thread == second_task->rt_param.is_proxy_thread) { |
253 | #endif | 250 | #endif |
254 | 251 | ||
255 | #if 0 | 252 | #if defined(CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE) |
256 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
257 | /* is this dead code? */ | 253 | /* is this dead code? */ |
258 | if (tsk_rt(first)->is_aux_task < tsk_rt(second)->is_aux_task) { | 254 | if (tsk_rt(first)->is_aux_task < tsk_rt(second)->is_aux_task) { |
259 | return 1; | 255 | return 1; |
260 | } | 256 | } |
261 | else if (tsk_rt(first)->is_aux_task == tsk_rt(second)->is_aux_task) { | 257 | else if (tsk_rt(first)->is_aux_task == tsk_rt(second)->is_aux_task) { |
262 | #endif | 258 | #endif |
263 | #endif | ||
264 | 259 | ||
265 | /* Something could be wrong if you get this far. */ | 260 | /* Something could be wrong if you get this far. */ |
266 | if (unlikely(first->rt_param.inh_task == | 261 | if (unlikely(first->rt_param.inh_task == |
@@ -297,11 +292,9 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
297 | return 1; | 292 | return 1; |
298 | } | 293 | } |
299 | } | 294 | } |
300 | #if 0 | 295 | #if defined(CONFIG_REALTIME_AUX_TASK_PRIORITY_INHERITANCE) |
301 | #ifdef CONFIG_REALTIME_AUX_TASKS | ||
302 | } | 296 | } |
303 | #endif | 297 | #endif |
304 | #endif | ||
305 | 298 | ||
306 | #ifdef CONFIG_LITMUS_SOFTIRQD | 299 | #ifdef CONFIG_LITMUS_SOFTIRQD |
307 | } | 300 | } |
diff --git a/litmus/ikglp_lock.c b/litmus/ikglp_lock.c index 16ae621bbf75..b29828344dd1 100644..100755 --- a/litmus/ikglp_lock.c +++ b/litmus/ikglp_lock.c | |||
@@ -2598,7 +2598,10 @@ ikglp_wait_state_t* gpu_ikglp_advise_donor_to_fq(struct ikglp_affinity* aff, str | |||
2598 | ikglp_wait_state_t *donor = NULL; | 2598 | ikglp_wait_state_t *donor = NULL; |
2599 | int distance = MIG_NONE; | 2599 | int distance = MIG_NONE; |
2600 | int gpu = replica_to_gpu(aff, ikglp_get_idx(sem, fq)); | 2600 | int gpu = replica_to_gpu(aff, ikglp_get_idx(sem, fq)); |
2601 | |||
2602 | #ifdef CONFIG_SCHED_DEBUG_TRACE | ||
2601 | ikglp_wait_state_t* default_donor = binheap_top_entry(&sem->donors, ikglp_wait_state_t, node); | 2603 | ikglp_wait_state_t* default_donor = binheap_top_entry(&sem->donors, ikglp_wait_state_t, node); |
2604 | #endif | ||
2602 | 2605 | ||
2603 | __find_closest_donor(gpu, sem->donors.root, &donor, &distance); | 2606 | __find_closest_donor(gpu, sem->donors.root, &donor, &distance); |
2604 | 2607 | ||