blob: ae045ca7d356033d49c8a9650a618c206503f68c [file] [log] [blame]
Li Zefand0b6e042009-07-13 10:33:21 +08001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM irq
3
Steven Rostedtea20d922009-04-10 08:54:16 -04004#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
Jason Baronaf392412009-02-26 10:11:05 -05005#define _TRACE_IRQ_H
6
Jason Baronaf392412009-02-26 10:11:05 -05007#include <linux/tracepoint.h>
Lai Jiangshan2bf21602010-08-23 18:42:48 +09008
9struct irqaction;
10struct softirq_action;
Jason Baronaf392412009-02-26 10:11:05 -050011
Steven Rostedt1d080d62009-06-01 12:20:40 -040012#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
Li Zefan5dd4de52009-09-17 17:38:32 +080013#define show_softirq_name(val) \
14 __print_symbolic(val, \
15 softirq_name(HI), \
16 softirq_name(TIMER), \
17 softirq_name(NET_TX), \
18 softirq_name(NET_RX), \
19 softirq_name(BLOCK), \
20 softirq_name(BLOCK_IOPOLL), \
21 softirq_name(TASKLET), \
22 softirq_name(SCHED), \
Paul E. McKenneya26ac242011-01-12 14:10:23 -080023 softirq_name(HRTIMER))
Steven Rostedtc2adae02009-05-20 19:56:19 -040024
Jason Baron9ee19832009-04-30 13:29:47 -040025/**
26 * irq_handler_entry - called immediately before the irq action handler
27 * @irq: irq number
28 * @action: pointer to struct irqaction
29 *
30 * The struct irqaction pointed to by @action contains various
31 * information about the handler, including the device name,
32 * @action->name, and the device id, @action->dev_id. When used in
33 * conjunction with the irq_handler_exit tracepoint, we can figure
34 * out irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040035 */
Steven Rostedt160031b2009-04-24 11:26:55 -040036TRACE_EVENT(irq_handler_entry,
37
Steven Rostedtea20d922009-04-10 08:54:16 -040038 TP_PROTO(int irq, struct irqaction *action),
Steven Rostedt160031b2009-04-24 11:26:55 -040039
Steven Rostedtea20d922009-04-10 08:54:16 -040040 TP_ARGS(irq, action),
Steven Rostedt160031b2009-04-24 11:26:55 -040041
42 TP_STRUCT__entry(
43 __field( int, irq )
44 __string( name, action->name )
45 ),
46
47 TP_fast_assign(
48 __entry->irq = irq;
49 __assign_str(name, action->name);
50 ),
51
Ingo Molnar434a83c2009-10-15 11:50:39 +020052 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
Steven Rostedt160031b2009-04-24 11:26:55 -040053);
Steven Rostedtea20d922009-04-10 08:54:16 -040054
Jason Baron9ee19832009-04-30 13:29:47 -040055/**
56 * irq_handler_exit - called immediately after the irq action handler returns
57 * @irq: irq number
58 * @action: pointer to struct irqaction
59 * @ret: return value
60 *
61 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
62 * @action->handler scuccessully handled this irq. Otherwise, the irq might be
63 * a shared irq line, or the irq was not handled successfully. Can be used in
64 * conjunction with the irq_handler_entry to understand irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040065 */
66TRACE_EVENT(irq_handler_exit,
67
68 TP_PROTO(int irq, struct irqaction *action, int ret),
69
70 TP_ARGS(irq, action, ret),
71
72 TP_STRUCT__entry(
73 __field( int, irq )
74 __field( int, ret )
75 ),
76
77 TP_fast_assign(
78 __entry->irq = irq;
79 __entry->ret = ret;
80 ),
81
Ingo Molnar434a83c2009-10-15 11:50:39 +020082 TP_printk("irq=%d ret=%s",
Steven Rostedtea20d922009-04-10 08:54:16 -040083 __entry->irq, __entry->ret ? "handled" : "unhandled")
84);
85
Li Zefanc4673072009-11-26 15:04:31 +080086DECLARE_EVENT_CLASS(softirq,
Steven Rostedtea20d922009-04-10 08:54:16 -040087
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020088 TP_PROTO(unsigned int vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -040089
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020090 TP_ARGS(vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -040091
92 TP_STRUCT__entry(
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020093 __field( unsigned int, vec )
Steven Rostedt160031b2009-04-24 11:26:55 -040094 ),
95
96 TP_fast_assign(
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020097 __entry->vec = vec_nr;
Steven Rostedt160031b2009-04-24 11:26:55 -040098 ),
99
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200100 TP_printk("vec=%u [action=%s]", __entry->vec,
Steven Rostedtc2adae02009-05-20 19:56:19 -0400101 show_softirq_name(__entry->vec))
Steven Rostedt160031b2009-04-24 11:26:55 -0400102);
103
Jason Baron9ee19832009-04-30 13:29:47 -0400104/**
Li Zefanc4673072009-11-26 15:04:31 +0800105 * softirq_entry - called immediately before the softirq handler
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200106 * @vec_nr: softirq vector number
Li Zefanc4673072009-11-26 15:04:31 +0800107 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200108 * When used in combination with the softirq_exit tracepoint
109 * we can determine the softirq handler runtine.
Li Zefanc4673072009-11-26 15:04:31 +0800110 */
111DEFINE_EVENT(softirq, softirq_entry,
112
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200113 TP_PROTO(unsigned int vec_nr),
Li Zefanc4673072009-11-26 15:04:31 +0800114
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200115 TP_ARGS(vec_nr)
Li Zefanc4673072009-11-26 15:04:31 +0800116);
117
118/**
Jason Baron9ee19832009-04-30 13:29:47 -0400119 * softirq_exit - called immediately after the softirq handler returns
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200120 * @vec_nr: softirq vector number
Jason Baron9ee19832009-04-30 13:29:47 -0400121 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200122 * When used in combination with the softirq_entry tracepoint
123 * we can determine the softirq handler runtine.
Jason Baron9ee19832009-04-30 13:29:47 -0400124 */
Li Zefanc4673072009-11-26 15:04:31 +0800125DEFINE_EVENT(softirq, softirq_exit,
Steven Rostedt160031b2009-04-24 11:26:55 -0400126
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200127 TP_PROTO(unsigned int vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -0400128
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200129 TP_ARGS(vec_nr)
Steven Rostedt160031b2009-04-24 11:26:55 -0400130);
Jason Baronaf392412009-02-26 10:11:05 -0500131
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900132/**
133 * softirq_raise - called immediately when a softirq is raised
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200134 * @vec_nr: softirq vector number
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900135 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200136 * When used in combination with the softirq_entry tracepoint
137 * we can determine the softirq raise to run latency.
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900138 */
139DEFINE_EVENT(softirq, softirq_raise,
140
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200141 TP_PROTO(unsigned int vec_nr),
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900142
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200143 TP_ARGS(vec_nr)
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900144);
145
Steven Rostedta8d154b2009-04-10 09:36:00 -0400146#endif /* _TRACE_IRQ_H */
147
148/* This part must be outside protection */
149#include <trace/define_trace.h>