diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-11 15:25:29 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-11 15:25:29 -0400 |
commit | a916d9b2feaeb5934e1f8ba30fde74193a60e8d1 (patch) | |
tree | ecbd2faabe3ae38ac92d7ac807ce76f954b17e96 | |
parent | f4260f81a68d170b1d3558b5447343224d918a45 (diff) |
Fix hang from bug in edf_common.c
-rw-r--r-- | include/litmus/fdso.h | 22 | ||||
-rw-r--r-- | litmus/edf_common.c | 36 | ||||
-rw-r--r-- | litmus/fdso.c | 10 | ||||
-rw-r--r-- | litmus/preempt.c | 5 |
4 files changed, 51 insertions, 22 deletions
diff --git a/include/litmus/fdso.h b/include/litmus/fdso.h index 35be59b970ee..1469c0fd0460 100644 --- a/include/litmus/fdso.h +++ b/include/litmus/fdso.h | |||
@@ -20,20 +20,20 @@ typedef enum { | |||
20 | FMLP_SEM = 0, | 20 | FMLP_SEM = 0, |
21 | SRP_SEM = 1, | 21 | SRP_SEM = 1, |
22 | 22 | ||
23 | RSM_MUTEX = 2, | 23 | MPCP_SEM = 2, |
24 | IKGLP_SEM = 3, | 24 | MPCP_VS_SEM = 3, |
25 | KFMLP_SEM = 4, | 25 | DPCP_SEM = 4, |
26 | 26 | ||
27 | IKGLP_SIMPLE_GPU_AFF_OBS = 5, | 27 | PCP_SEM = 5, |
28 | IKGLP_GPU_AFF_OBS = 6, | ||
29 | KFMLP_SIMPLE_GPU_AFF_OBS = 7, | ||
30 | KFMLP_GPU_AFF_OBS = 8, | ||
31 | 28 | ||
32 | MPCP_SEM = 9, | 29 | RSM_MUTEX = 6, |
33 | MPCP_VS_SEM = 10, | 30 | IKGLP_SEM = 7, |
34 | DPCP_SEM = 11, | 31 | KFMLP_SEM = 8, |
35 | 32 | ||
36 | PCP_SEM = 12, | 33 | IKGLP_SIMPLE_GPU_AFF_OBS = 9, |
34 | IKGLP_GPU_AFF_OBS = 10, | ||
35 | KFMLP_SIMPLE_GPU_AFF_OBS = 11, | ||
36 | KFMLP_GPU_AFF_OBS = 12, | ||
37 | 37 | ||
38 | MAX_OBJ_TYPE = 12 | 38 | MAX_OBJ_TYPE = 12 |
39 | } obj_type_t; | 39 | } obj_type_t; |
diff --git a/litmus/edf_common.c b/litmus/edf_common.c index a1cdc10ea6f1..39ce1816ee04 100644 --- a/litmus/edf_common.c +++ b/litmus/edf_common.c | |||
@@ -185,11 +185,37 @@ int edf_higher_prio(struct task_struct* first, struct task_struct* second) | |||
185 | return 1; | 185 | return 1; |
186 | } | 186 | } |
187 | #endif | 187 | #endif |
188 | /* If the PIDs are the same then the task with the | 188 | /* Something could be wrong if you get this far. */ |
189 | * inherited priority wins. | 189 | if (unlikely(first->rt_param.inh_task == |
190 | */ | 190 | second->rt_param.inh_task)) { |
191 | if (!second_task->rt_param.inh_task) { | 191 | /* Both tasks have the same inherited priority. |
192 | return 1; | 192 | * Likely in a bug-condition. |
193 | */ | ||
194 | if (likely(first->pid < second->pid)) { | ||
195 | return 1; | ||
196 | } | ||
197 | else if (first->pid == second->pid) { | ||
198 | WARN_ON(1); | ||
199 | } | ||
200 | } | ||
201 | else { | ||
202 | /* At least one task must inherit */ | ||
203 | BUG_ON(!first->rt_param.inh_task && | ||
204 | !second->rt_param.inh_task); | ||
205 | |||
206 | /* The task with the inherited priority wins. */ | ||
207 | if (!second->rt_param.inh_task) { | ||
208 | TRACE_CUR("unusual comparison: " | ||
209 | "first = %s/%d first_task = %s/%d " | ||
210 | "second = %s/%d second_task = %s/%d\n", | ||
211 | first->comm, first->pid, | ||
212 | (first->rt_param.inh_task) ? first->rt_param.inh_task->comm : "(nil)", | ||
213 | (first->rt_param.inh_task) ? first->rt_param.inh_task->pid : 0, | ||
214 | second->comm, second->pid, | ||
215 | (second->rt_param.inh_task) ? second->rt_param.inh_task->comm : "(nil)", | ||
216 | (second->rt_param.inh_task) ? second->rt_param.inh_task->pid : 0); | ||
217 | return 1; | ||
218 | } | ||
193 | } | 219 | } |
194 | } | 220 | } |
195 | } | 221 | } |
diff --git a/litmus/fdso.c b/litmus/fdso.c index bac6a35fa17d..2411d16ba486 100644 --- a/litmus/fdso.c +++ b/litmus/fdso.c | |||
@@ -27,6 +27,12 @@ extern struct fdso_ops generic_affinity_ops; | |||
27 | static const struct fdso_ops* fdso_ops[] = { | 27 | static const struct fdso_ops* fdso_ops[] = { |
28 | &generic_lock_ops, /* FMLP_SEM */ | 28 | &generic_lock_ops, /* FMLP_SEM */ |
29 | &generic_lock_ops, /* SRP_SEM */ | 29 | &generic_lock_ops, /* SRP_SEM */ |
30 | |||
31 | &generic_lock_ops, /* MPCP_SEM */ | ||
32 | &generic_lock_ops, /* MPCP_VS_SEM */ | ||
33 | &generic_lock_ops, /* DPCP_SEM */ | ||
34 | &generic_lock_ops, /* PCP_SEM */ | ||
35 | |||
30 | &generic_lock_ops, /* RSM_MUTEX */ | 36 | &generic_lock_ops, /* RSM_MUTEX */ |
31 | &generic_lock_ops, /* IKGLP_SEM */ | 37 | &generic_lock_ops, /* IKGLP_SEM */ |
32 | &generic_lock_ops, /* KFMLP_SEM */ | 38 | &generic_lock_ops, /* KFMLP_SEM */ |
@@ -36,10 +42,6 @@ static const struct fdso_ops* fdso_ops[] = { | |||
36 | &generic_affinity_ops, /* KFMLP_SIMPLE_GPU_AFF_OBS */ | 42 | &generic_affinity_ops, /* KFMLP_SIMPLE_GPU_AFF_OBS */ |
37 | &generic_affinity_ops, /* KFMLP_GPU_AFF_OBS */ | 43 | &generic_affinity_ops, /* KFMLP_GPU_AFF_OBS */ |
38 | #endif | 44 | #endif |
39 | &generic_lock_ops, /* MPCP_SEM */ | ||
40 | &generic_lock_ops, /* MPCP_VS_SEM */ | ||
41 | &generic_lock_ops, /* DPCP_SEM */ | ||
42 | &generic_lock_ops, /* PCP_SEM */ | ||
43 | }; | 45 | }; |
44 | 46 | ||
45 | static int fdso_create(void** obj_ref, obj_type_t type, void* __user config) | 47 | static int fdso_create(void** obj_ref, obj_type_t type, void* __user config) |
diff --git a/litmus/preempt.c b/litmus/preempt.c index 28368d5bc046..a2cae3648e15 100644 --- a/litmus/preempt.c +++ b/litmus/preempt.c | |||
@@ -26,10 +26,11 @@ void sched_state_will_schedule(struct task_struct* tsk) | |||
26 | set_sched_state(PICKED_WRONG_TASK); | 26 | set_sched_state(PICKED_WRONG_TASK); |
27 | else | 27 | else |
28 | set_sched_state(WILL_SCHEDULE); | 28 | set_sched_state(WILL_SCHEDULE); |
29 | } else | 29 | } else { |
30 | /* Litmus tasks should never be subject to a remote | 30 | /* Litmus tasks should never be subject to a remote |
31 | * set_tsk_need_resched(). */ | 31 | * set_tsk_need_resched(). */ |
32 | BUG_ON(is_realtime(tsk)); | 32 | //BUG_ON(is_realtime(tsk)); |
33 | } | ||
33 | 34 | ||
34 | #ifdef CONFIG_PREEMPT_STATE_TRACE | 35 | #ifdef CONFIG_PREEMPT_STATE_TRACE |
35 | TRACE_TASK(tsk, "set_tsk_need_resched() ret:%p\n", | 36 | TRACE_TASK(tsk, "set_tsk_need_resched() ret:%p\n", |