1c3bc8fd6SJoel Fernandes (Google) #ifdef CONFIG_PREEMPTIRQ_TRACEPOINTS
2d5915816SJoel Fernandes 
3d5915816SJoel Fernandes #undef TRACE_SYSTEM
4d5915816SJoel Fernandes #define TRACE_SYSTEM preemptirq
5d5915816SJoel Fernandes 
6d5915816SJoel Fernandes #if !defined(_TRACE_PREEMPTIRQ_H) || defined(TRACE_HEADER_MULTI_READ)
7d5915816SJoel Fernandes #define _TRACE_PREEMPTIRQ_H
8d5915816SJoel Fernandes 
9d5915816SJoel Fernandes #include <linux/ktime.h>
10d5915816SJoel Fernandes #include <linux/tracepoint.h>
11d5915816SJoel Fernandes #include <linux/string.h>
12d5915816SJoel Fernandes #include <asm/sections.h>
13d5915816SJoel Fernandes 
14d5915816SJoel Fernandes DECLARE_EVENT_CLASS(preemptirq_template,
15d5915816SJoel Fernandes 
16d5915816SJoel Fernandes 	TP_PROTO(unsigned long ip, unsigned long parent_ip),
17d5915816SJoel Fernandes 
18d5915816SJoel Fernandes 	TP_ARGS(ip, parent_ip),
19d5915816SJoel Fernandes 
20d5915816SJoel Fernandes 	TP_STRUCT__entry(
21bf44f488SJoel Fernandes (Google) 		__field(s32, caller_offs)
22bf44f488SJoel Fernandes (Google) 		__field(s32, parent_offs)
23d5915816SJoel Fernandes 	),
24d5915816SJoel Fernandes 
25d5915816SJoel Fernandes 	TP_fast_assign(
26bf44f488SJoel Fernandes (Google) 		__entry->caller_offs = (s32)(ip - (unsigned long)_stext);
27bf44f488SJoel Fernandes (Google) 		__entry->parent_offs = (s32)(parent_ip - (unsigned long)_stext);
28d5915816SJoel Fernandes 	),
29d5915816SJoel Fernandes 
30d75f773cSSakari Ailus 	TP_printk("caller=%pS parent=%pS",
31d5915816SJoel Fernandes 		  (void *)((unsigned long)(_stext) + __entry->caller_offs),
32d5915816SJoel Fernandes 		  (void *)((unsigned long)(_stext) + __entry->parent_offs))
33d5915816SJoel Fernandes );
34d5915816SJoel Fernandes 
35c3bc8fd6SJoel Fernandes (Google) #ifdef CONFIG_TRACE_IRQFLAGS
36d5915816SJoel Fernandes DEFINE_EVENT(preemptirq_template, irq_disable,
37d5915816SJoel Fernandes 	     TP_PROTO(unsigned long ip, unsigned long parent_ip),
38d5915816SJoel Fernandes 	     TP_ARGS(ip, parent_ip));
39d5915816SJoel Fernandes 
40d5915816SJoel Fernandes DEFINE_EVENT(preemptirq_template, irq_enable,
41d5915816SJoel Fernandes 	     TP_PROTO(unsigned long ip, unsigned long parent_ip),
42d5915816SJoel Fernandes 	     TP_ARGS(ip, parent_ip));
43c3bc8fd6SJoel Fernandes (Google) #else
44c3bc8fd6SJoel Fernandes (Google) #define trace_irq_enable(...)
45c3bc8fd6SJoel Fernandes (Google) #define trace_irq_disable(...)
46c3bc8fd6SJoel Fernandes (Google) #define trace_irq_enable_rcuidle(...)
47c3bc8fd6SJoel Fernandes (Google) #define trace_irq_disable_rcuidle(...)
48d5915816SJoel Fernandes #endif
49d5915816SJoel Fernandes 
50c3bc8fd6SJoel Fernandes (Google) #ifdef CONFIG_TRACE_PREEMPT_TOGGLE
51d5915816SJoel Fernandes DEFINE_EVENT(preemptirq_template, preempt_disable,
52d5915816SJoel Fernandes 	     TP_PROTO(unsigned long ip, unsigned long parent_ip),
53d5915816SJoel Fernandes 	     TP_ARGS(ip, parent_ip));
54d5915816SJoel Fernandes 
55d5915816SJoel Fernandes DEFINE_EVENT(preemptirq_template, preempt_enable,
56d5915816SJoel Fernandes 	     TP_PROTO(unsigned long ip, unsigned long parent_ip),
57d5915816SJoel Fernandes 	     TP_ARGS(ip, parent_ip));
58c3bc8fd6SJoel Fernandes (Google) #else
59c3bc8fd6SJoel Fernandes (Google) #define trace_preempt_enable(...)
60c3bc8fd6SJoel Fernandes (Google) #define trace_preempt_disable(...)
61c3bc8fd6SJoel Fernandes (Google) #define trace_preempt_enable_rcuidle(...)
62c3bc8fd6SJoel Fernandes (Google) #define trace_preempt_disable_rcuidle(...)
63d5915816SJoel Fernandes #endif
64d5915816SJoel Fernandes 
65d5915816SJoel Fernandes #endif /* _TRACE_PREEMPTIRQ_H */
66d5915816SJoel Fernandes 
67d5915816SJoel Fernandes #include <trace/define_trace.h>
68d5915816SJoel Fernandes 
69c3bc8fd6SJoel Fernandes (Google) #else /* !CONFIG_PREEMPTIRQ_TRACEPOINTS */
70d5915816SJoel Fernandes #define trace_irq_enable(...)
71d5915816SJoel Fernandes #define trace_irq_disable(...)
72d5915816SJoel Fernandes #define trace_irq_enable_rcuidle(...)
73d5915816SJoel Fernandes #define trace_irq_disable_rcuidle(...)
74250d0c77SArnd Bergmann #define trace_preempt_enable(...)
75250d0c77SArnd Bergmann #define trace_preempt_disable(...)
76d5915816SJoel Fernandes #define trace_preempt_enable_rcuidle(...)
77d5915816SJoel Fernandes #define trace_preempt_disable_rcuidle(...)
78d5915816SJoel Fernandes #endif
79