aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-11-02 17:17:59 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-01-22 23:38:00 -0500
commitc29f122cd7fc178b72b1335b1fce0dff2e5c0f5d (patch)
tree450f3888c9f663298231a29d6a1e63269f815fd0 /kernel/trace/trace.h
parent0a016409e42f273415f8225ddf2c58eb2df88034 (diff)
ftrace: Add context level recursion bit checking
Currently for recursion checking in the function tracer, ftrace tests a task_struct bit to determine if the function tracer had recursed or not. If it has, then it will will return without going further. But this leads to races. If an interrupt came in after the bit was set, the functions being traced would see that bit set and think that the function tracer recursed on itself, and would return. Instead add a bit for each context (normal, softirq, irq and nmi). A check of which context the task is in is made before testing the associated bit. Now if an interrupt preempts the function tracer after the previous context has been set, the interrupt functions can still be traced. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index c75d7988902c..fe6ccff9cc70 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -299,8 +299,14 @@ struct tracer {
299 299
300/* for function tracing recursion */ 300/* for function tracing recursion */
301#define TRACE_INTERNAL_BIT (1<<11) 301#define TRACE_INTERNAL_BIT (1<<11)
302#define TRACE_GLOBAL_BIT (1<<12) 302#define TRACE_INTERNAL_NMI_BIT (1<<12)
303#define TRACE_CONTROL_BIT (1<<13) 303#define TRACE_INTERNAL_IRQ_BIT (1<<13)
304#define TRACE_INTERNAL_SIRQ_BIT (1<<14)
305#define TRACE_GLOBAL_BIT (1<<15)
306#define TRACE_GLOBAL_NMI_BIT (1<<16)
307#define TRACE_GLOBAL_IRQ_BIT (1<<17)
308#define TRACE_GLOBAL_SIRQ_BIT (1<<18)
309#define TRACE_CONTROL_BIT (1<<19)
304 310
305/* 311/*
306 * Abuse of the trace_recursion. 312 * Abuse of the trace_recursion.
@@ -309,7 +315,7 @@ struct tracer {
309 * was called in irq context but we have irq tracing off. Since this 315 * was called in irq context but we have irq tracing off. Since this
310 * can only be modified by current, we can reuse trace_recursion. 316 * can only be modified by current, we can reuse trace_recursion.
311 */ 317 */
312#define TRACE_IRQ_BIT (1<<13) 318#define TRACE_IRQ_BIT (1<<20)
313 319
314#define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0) 320#define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0)
315#define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0) 321#define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0)