aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-09 04:35:12 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-09 04:35:12 -0500
commit44b0635481437140b0e29d6023f05e805d5e7620 (patch)
treeff31986115075410d0479df307a6b9841976026c /include/linux
parent4ad476e11f94fd3724c6e272d8220e99cd222b27 (diff)
parent57794a9d48b63e34acbe63282628c9f029603308 (diff)
Merge branch 'tip/tracing/core/devel' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
Conflicts: kernel/trace/trace_hw_branches.c
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ftrace.h2
-rw-r--r--include/linux/ftrace_irq.h2
-rw-r--r--include/linux/hardirq.h15
-rw-r--r--include/linux/ring_buffer.h9
4 files changed, 26 insertions, 2 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 7840e718c6c7..5e302d636fc2 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -140,7 +140,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
140#endif 140#endif
141 141
142/** 142/**
143 * ftrace_make_nop - convert code into top 143 * ftrace_make_nop - convert code into nop
144 * @mod: module structure if called by module load initialization 144 * @mod: module structure if called by module load initialization
145 * @rec: the mcount call site record 145 * @rec: the mcount call site record
146 * @addr: the address that the call site should be calling 146 * @addr: the address that the call site should be calling
diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h
index 366a054d0b05..dca7bf8cffe2 100644
--- a/include/linux/ftrace_irq.h
+++ b/include/linux/ftrace_irq.h
@@ -2,7 +2,7 @@
2#define _LINUX_FTRACE_IRQ_H 2#define _LINUX_FTRACE_IRQ_H
3 3
4 4
5#if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_GRAPH_TRACER) 5#ifdef CONFIG_FTRACE_NMI_ENTER
6extern void ftrace_nmi_enter(void); 6extern void ftrace_nmi_enter(void);
7extern void ftrace_nmi_exit(void); 7extern void ftrace_nmi_exit(void);
8#else 8#else
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index f83288347dda..f3cf86e1465b 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -61,6 +61,12 @@
61#error PREEMPT_ACTIVE is too low! 61#error PREEMPT_ACTIVE is too low!
62#endif 62#endif
63 63
64#define NMI_OFFSET (PREEMPT_ACTIVE << 1)
65
66#if NMI_OFFSET >= 0x80000000
67#error PREEMPT_ACTIVE too high!
68#endif
69
64#define hardirq_count() (preempt_count() & HARDIRQ_MASK) 70#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
65#define softirq_count() (preempt_count() & SOFTIRQ_MASK) 71#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
66#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) 72#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK))
@@ -73,6 +79,11 @@
73#define in_softirq() (softirq_count()) 79#define in_softirq() (softirq_count())
74#define in_interrupt() (irq_count()) 80#define in_interrupt() (irq_count())
75 81
82/*
83 * Are we in NMI context?
84 */
85#define in_nmi() (preempt_count() & NMI_OFFSET)
86
76#if defined(CONFIG_PREEMPT) 87#if defined(CONFIG_PREEMPT)
77# define PREEMPT_INATOMIC_BASE kernel_locked() 88# define PREEMPT_INATOMIC_BASE kernel_locked()
78# define PREEMPT_CHECK_OFFSET 1 89# define PREEMPT_CHECK_OFFSET 1
@@ -167,6 +178,8 @@ extern void irq_exit(void);
167#define nmi_enter() \ 178#define nmi_enter() \
168 do { \ 179 do { \
169 ftrace_nmi_enter(); \ 180 ftrace_nmi_enter(); \
181 BUG_ON(in_nmi()); \
182 add_preempt_count(NMI_OFFSET); \
170 lockdep_off(); \ 183 lockdep_off(); \
171 rcu_nmi_enter(); \ 184 rcu_nmi_enter(); \
172 __irq_enter(); \ 185 __irq_enter(); \
@@ -177,6 +190,8 @@ extern void irq_exit(void);
177 __irq_exit(); \ 190 __irq_exit(); \
178 rcu_nmi_exit(); \ 191 rcu_nmi_exit(); \
179 lockdep_on(); \ 192 lockdep_on(); \
193 BUG_ON(!in_nmi()); \
194 sub_preempt_count(NMI_OFFSET); \
180 ftrace_nmi_exit(); \ 195 ftrace_nmi_exit(); \
181 } while (0) 196 } while (0)
182 197
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 3110d92e7d81..3c103d636da3 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -121,9 +121,18 @@ unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
121u64 ring_buffer_time_stamp(int cpu); 121u64 ring_buffer_time_stamp(int cpu);
122void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); 122void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
123 123
124/*
125 * The below functions are fine to use outside the tracing facility.
126 */
127#ifdef CONFIG_RING_BUFFER
124void tracing_on(void); 128void tracing_on(void);
125void tracing_off(void); 129void tracing_off(void);
126void tracing_off_permanent(void); 130void tracing_off_permanent(void);
131#else
132static inline void tracing_on(void) { }
133static inline void tracing_off(void) { }
134static inline void tracing_off_permanent(void) { }
135#endif
127 136
128void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); 137void *ring_buffer_alloc_read_page(struct ring_buffer *buffer);
129void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); 138void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data);