aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-07-21 03:32:40 -0400
committerIngo Molnar <mingo@elte.hu>2011-07-21 03:32:40 -0400
commit40bcea7bbe8fe452a2d272e2ffd3dea281eec9ff (patch)
treeaedb6d02e53e3cf84cc32fd81db84032cee205e1 /kernel/trace/trace.h
parent492f73a303b488ffd67097b2351d54aa6e6c7c73 (diff)
parent14a8fd7ceea6915c613746203d6e9a2bf273f16c (diff)
Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h50
1 files changed, 34 insertions, 16 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 30a94c26dcb3..3f381d0b20a8 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -278,6 +278,29 @@ struct tracer {
278}; 278};
279 279
280 280
281/* Only current can touch trace_recursion */
282#define trace_recursion_inc() do { (current)->trace_recursion++; } while (0)
283#define trace_recursion_dec() do { (current)->trace_recursion--; } while (0)
284
285/* Ring buffer has the 10 LSB bits to count */
286#define trace_recursion_buffer() ((current)->trace_recursion & 0x3ff)
287
288/* for function tracing recursion */
289#define TRACE_INTERNAL_BIT (1<<11)
290#define TRACE_GLOBAL_BIT (1<<12)
291/*
292 * Abuse of the trace_recursion.
293 * As we need a way to maintain state if we are tracing the function
294 * graph in irq because we want to trace a particular function that
295 * was called in irq context but we have irq tracing off. Since this
296 * can only be modified by current, we can reuse trace_recursion.
297 */
298#define TRACE_IRQ_BIT (1<<13)
299
300#define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0)
301#define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0)
302#define trace_recursion_test(bit) ((current)->trace_recursion & (bit))
303
281#define TRACE_PIPE_ALL_CPU -1 304#define TRACE_PIPE_ALL_CPU -1
282 305
283int tracer_init(struct tracer *t, struct trace_array *tr); 306int tracer_init(struct tracer *t, struct trace_array *tr);
@@ -516,8 +539,18 @@ static inline int ftrace_graph_addr(unsigned long addr)
516 return 1; 539 return 1;
517 540
518 for (i = 0; i < ftrace_graph_count; i++) { 541 for (i = 0; i < ftrace_graph_count; i++) {
519 if (addr == ftrace_graph_funcs[i]) 542 if (addr == ftrace_graph_funcs[i]) {
543 /*
544 * If no irqs are to be traced, but a set_graph_function
545 * is set, and called by an interrupt handler, we still
546 * want to trace it.
547 */
548 if (in_irq())
549 trace_recursion_set(TRACE_IRQ_BIT);
550 else
551 trace_recursion_clear(TRACE_IRQ_BIT);
520 return 1; 552 return 1;
553 }
521 } 554 }
522 555
523 return 0; 556 return 0;
@@ -795,19 +828,4 @@ extern const char *__stop___trace_bprintk_fmt[];
795 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) 828 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))
796#include "trace_entries.h" 829#include "trace_entries.h"
797 830
798/* Only current can touch trace_recursion */
799#define trace_recursion_inc() do { (current)->trace_recursion++; } while (0)
800#define trace_recursion_dec() do { (current)->trace_recursion--; } while (0)
801
802/* Ring buffer has the 10 LSB bits to count */
803#define trace_recursion_buffer() ((current)->trace_recursion & 0x3ff)
804
805/* for function tracing recursion */
806#define TRACE_INTERNAL_BIT (1<<11)
807#define TRACE_GLOBAL_BIT (1<<12)
808
809#define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0)
810#define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0)
811#define trace_recursion_test(bit) ((current)->trace_recursion & (bit))
812
813#endif /* _LINUX_KERNEL_TRACE_H */ 831#endif /* _LINUX_KERNEL_TRACE_H */