From d1d6e4c300d858c47b834be145f30973bc2921bf Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Thu, 24 Nov 2011 13:42:59 -0500 Subject: Add option to turn off preemption state tracing Preemption state tracing is only useful when debugging preemption- and IPI-related races. Since it creates a lot of clutter in the logs, this patch turns it off unless explicitly requested. --- include/litmus/preempt.h | 2 +- litmus/Kconfig | 14 ++++++++++++++ litmus/preempt.c | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) 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 @@ extern DEFINE_PER_CPU_SHARED_ALIGNED(atomic_t, resched_state); -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_PREEMPT_STATE_TRACE const char* sched_state_name(int s); #define TRACE_STATE(fmt, args...) TRACE("SCHED_STATE " fmt, args) #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 If unsure, say No. +config PREEMPT_STATE_TRACE + bool "Trace preemption state machine transitions" + depends on SCHED_DEBUG_TRACE + default n + help + With this option enabled, each CPU will log when it transitions + states in the preemption state machine. This state machine is + used to determine how to react to IPIs (avoid races with in-flight IPIs). + + Warning: this creates a lot of information in the debug trace. Only + recommended when you are debugging preemption-related races. + + If unsure, say No. + endmenu 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) /* Litmus tasks should never be subject to a remote * set_tsk_need_resched(). */ BUG_ON(is_realtime(tsk)); +#ifdef CONFIG_PREEMPT_STATE_TRACE TRACE_TASK(tsk, "set_tsk_need_resched() ret:%p\n", __builtin_return_address(0)); +#endif } /* Called by the IPI handler after another CPU called smp_send_resched(). */ -- cgit v1.2.2