diff options
Diffstat (limited to 'litmus/preempt.c')
-rw-r--r-- | litmus/preempt.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/litmus/preempt.c b/litmus/preempt.c index 8f1304afea26..26c6c7a929d9 100644 --- a/litmus/preempt.c +++ b/litmus/preempt.c | |||
@@ -22,9 +22,10 @@ void sched_state_will_schedule(struct task_struct* tsk) | |||
22 | */ | 22 | */ |
23 | if (likely(task_cpu(tsk) == smp_processor_id())) { | 23 | if (likely(task_cpu(tsk) == smp_processor_id())) { |
24 | VERIFY_SCHED_STATE(TASK_SCHEDULED | SHOULD_SCHEDULE | TASK_PICKED | WILL_SCHEDULE); | 24 | VERIFY_SCHED_STATE(TASK_SCHEDULED | SHOULD_SCHEDULE | TASK_PICKED | WILL_SCHEDULE); |
25 | if (is_in_sched_state(TASK_PICKED | PICKED_WRONG_TASK)) | 25 | if (is_in_sched_state(TASK_PICKED | PICKED_WRONG_TASK)) { |
26 | TRACE_TASK(tsk, "Wrong task\n"); | ||
26 | set_sched_state(PICKED_WRONG_TASK); | 27 | set_sched_state(PICKED_WRONG_TASK); |
27 | else | 28 | } else |
28 | set_sched_state(WILL_SCHEDULE); | 29 | set_sched_state(WILL_SCHEDULE); |
29 | } /* else */ | 30 | } /* else */ |
30 | /* /\* Litmus tasks should never be subject to a remote */ | 31 | /* /\* Litmus tasks should never be subject to a remote */ |
@@ -32,8 +33,8 @@ void sched_state_will_schedule(struct task_struct* tsk) | |||
32 | /* BUG_ON(is_realtime(tsk)); */ | 33 | /* BUG_ON(is_realtime(tsk)); */ |
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 | STRACE("%d: set_tsk_need_resched() ret:%p\n", |
36 | __builtin_return_address(0)); | 37 | tsk->pid, __builtin_return_address(0)); |
37 | #endif | 38 | #endif |
38 | } | 39 | } |
39 | 40 | ||
@@ -69,9 +70,11 @@ void litmus_reschedule(int cpu) | |||
69 | * is not aware of the need to reschedule at this point. */ | 70 | * is not aware of the need to reschedule at this point. */ |
70 | 71 | ||
71 | /* is a context switch in progress? */ | 72 | /* is a context switch in progress? */ |
72 | if (cpu_is_in_sched_state(cpu, TASK_PICKED)) | 73 | if (cpu_is_in_sched_state(cpu, TASK_PICKED)) { |
74 | STRACE("Transition onto wrong task\n"); | ||
73 | picked_transition_ok = sched_state_transition_on( | 75 | picked_transition_ok = sched_state_transition_on( |
74 | cpu, TASK_PICKED, PICKED_WRONG_TASK); | 76 | cpu, TASK_PICKED, PICKED_WRONG_TASK); |
77 | } | ||
75 | 78 | ||
76 | if (!picked_transition_ok && | 79 | if (!picked_transition_ok && |
77 | cpu_is_in_sched_state(cpu, TASK_SCHEDULED)) { | 80 | cpu_is_in_sched_state(cpu, TASK_SCHEDULED)) { |
@@ -90,17 +93,18 @@ void litmus_reschedule(int cpu) | |||
90 | smp_send_reschedule(cpu); | 93 | smp_send_reschedule(cpu); |
91 | } | 94 | } |
92 | 95 | ||
93 | TRACE_STATE("%s picked-ok:%d sched-ok:%d\n", | 96 | STRACE("%s picked-ok:%d sched-ok:%d\n", |
94 | __FUNCTION__, | 97 | __FUNCTION__, |
95 | picked_transition_ok, | 98 | picked_transition_ok, |
96 | scheduled_transition_ok); | 99 | scheduled_transition_ok); |
97 | } | 100 | } |
98 | 101 | ||
99 | void litmus_reschedule_local(void) | 102 | void litmus_reschedule_local(void) |
100 | { | 103 | { |
101 | if (is_in_sched_state(TASK_PICKED)) | 104 | if (is_in_sched_state(TASK_PICKED)) { |
105 | STRACE("Rescheduling into wrong task\n"); | ||
102 | set_sched_state(PICKED_WRONG_TASK); | 106 | set_sched_state(PICKED_WRONG_TASK); |
103 | else if (is_in_sched_state(TASK_SCHEDULED | SHOULD_SCHEDULE)) { | 107 | } else if (is_in_sched_state(TASK_SCHEDULED | SHOULD_SCHEDULE)) { |
104 | set_sched_state(WILL_SCHEDULE); | 108 | set_sched_state(WILL_SCHEDULE); |
105 | set_tsk_need_resched(current); | 109 | set_tsk_need_resched(current); |
106 | } | 110 | } |
@@ -111,7 +115,7 @@ void litmus_reschedule_local(void) | |||
111 | void sched_state_plugin_check(void) | 115 | void sched_state_plugin_check(void) |
112 | { | 116 | { |
113 | if (!is_in_sched_state(TASK_PICKED | PICKED_WRONG_TASK)) { | 117 | if (!is_in_sched_state(TASK_PICKED | PICKED_WRONG_TASK)) { |
114 | TRACE("!!!! plugin did not call sched_state_task_picked()!" | 118 | STRACE("!!!! plugin did not call sched_state_task_picked()!" |
115 | "Calling sched_state_task_picked() is mandatory---fix this.\n"); | 119 | "Calling sched_state_task_picked() is mandatory---fix this.\n"); |
116 | set_sched_state(TASK_PICKED); | 120 | set_sched_state(TASK_PICKED); |
117 | } | 121 | } |