diff options
-rw-r--r-- | include/litmus/preempt.h | 2 | ||||
-rw-r--r-- | litmus/Kconfig | 14 | ||||
-rw-r--r-- | litmus/preempt.c | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/include/litmus/preempt.h b/include/litmus/preempt.h index 260c6fe17986..380b886d78ff 100644 --- a/include/litmus/preempt.h +++ b/include/litmus/preempt.h | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | extern DEFINE_PER_CPU_SHARED_ALIGNED(atomic_t, resched_state); | 11 | extern DEFINE_PER_CPU_SHARED_ALIGNED(atomic_t, resched_state); |
12 | 12 | ||
13 | #ifdef CONFIG_DEBUG_KERNEL | 13 | #ifdef CONFIG_PREEMPT_STATE_TRACE |
14 | const char* sched_state_name(int s); | 14 | const char* sched_state_name(int s); |
15 | #define TRACE_STATE(fmt, args...) TRACE("SCHED_STATE " fmt, args) | 15 | #define TRACE_STATE(fmt, args...) TRACE("SCHED_STATE " fmt, args) |
16 | #else | 16 | #else |
diff --git a/litmus/Kconfig b/litmus/Kconfig index d7fde6f97e14..94b48e199577 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig | |||
@@ -199,6 +199,20 @@ config SCHED_DEBUG_TRACE_CALLER | |||
199 | 199 | ||
200 | If unsure, say No. | 200 | If unsure, say No. |
201 | 201 | ||
202 | config PREEMPT_STATE_TRACE | ||
203 | bool "Trace preemption state machine transitions" | ||
204 | depends on SCHED_DEBUG_TRACE | ||
205 | default n | ||
206 | help | ||
207 | With this option enabled, each CPU will log when it transitions | ||
208 | states in the preemption state machine. This state machine is | ||
209 | used to determine how to react to IPIs (avoid races with in-flight IPIs). | ||
210 | |||
211 | Warning: this creates a lot of information in the debug trace. Only | ||
212 | recommended when you are debugging preemption-related races. | ||
213 | |||
214 | If unsure, say No. | ||
215 | |||
202 | endmenu | 216 | endmenu |
203 | 217 | ||
204 | endmenu | 218 | endmenu |
diff --git a/litmus/preempt.c b/litmus/preempt.c index ebe2e3461895..5704d0bf4c0b 100644 --- a/litmus/preempt.c +++ b/litmus/preempt.c | |||
@@ -30,8 +30,10 @@ void sched_state_will_schedule(struct task_struct* tsk) | |||
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 | #ifdef CONFIG_PREEMPT_STATE_TRACE | ||
33 | TRACE_TASK(tsk, "set_tsk_need_resched() ret:%p\n", | 34 | TRACE_TASK(tsk, "set_tsk_need_resched() ret:%p\n", |
34 | __builtin_return_address(0)); | 35 | __builtin_return_address(0)); |
36 | #endif | ||
35 | } | 37 | } |
36 | 38 | ||
37 | /* Called by the IPI handler after another CPU called smp_send_resched(). */ | 39 | /* Called by the IPI handler after another CPU called smp_send_resched(). */ |