blob: 1c09820df58564f8d0430d996998edc6f8d893c0 [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), \
Shaohua Li09223372011-06-14 13:26:25 +080023 softirq_name(HRTIMER), \
24 softirq_name(RCU))
Steven Rostedtc2adae02009-05-20 19:56:19 -040025
Jason Baron9ee19832009-04-30 13:29:47 -040026/**
27 * irq_handler_entry - called immediately before the irq action handler
28 * @irq: irq number
29 * @action: pointer to struct irqaction
30 *
31 * The struct irqaction pointed to by @action contains various
32 * information about the handler, including the device name,
33 * @action->name, and the device id, @action->dev_id. When used in
34 * conjunction with the irq_handler_exit tracepoint, we can figure
35 * out irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040036 */
Steven Rostedt160031b2009-04-24 11:26:55 -040037TRACE_EVENT(irq_handler_entry,
38
Steven Rostedtea20d922009-04-10 08:54:16 -040039 TP_PROTO(int irq, struct irqaction *action),
Steven Rostedt160031b2009-04-24 11:26:55 -040040
Steven Rostedtea20d922009-04-10 08:54:16 -040041 TP_ARGS(irq, action),
Steven Rostedt160031b2009-04-24 11:26:55 -040042
43 TP_STRUCT__entry(
44 __field( int, irq )
45 __string( name, action->name )
46 ),
47
48 TP_fast_assign(
49 __entry->irq = irq;
50 __assign_str(name, action->name);
51 ),
52
Ingo Molnar434a83c2009-10-15 11:50:39 +020053 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
Steven Rostedt160031b2009-04-24 11:26:55 -040054);
Steven Rostedtea20d922009-04-10 08:54:16 -040055
Jason Baron9ee19832009-04-30 13:29:47 -040056/**
57 * irq_handler_exit - called immediately after the irq action handler returns
58 * @irq: irq number
59 * @action: pointer to struct irqaction
60 * @ret: return value
61 *
62 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
63 * @action->handler scuccessully handled this irq. Otherwise, the irq might be
64 * a shared irq line, or the irq was not handled successfully. Can be used in
65 * conjunction with the irq_handler_entry to understand irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040066 */
67TRACE_EVENT(irq_handler_exit,
68
69 TP_PROTO(int irq, struct irqaction *action, int ret),
70
71 TP_ARGS(irq, action, ret),
72
73 TP_STRUCT__entry(
74 __field( int, irq )
75 __field( int, ret )
76 ),
77
78 TP_fast_assign(
79 __entry->irq = irq;
80 __entry->ret = ret;
81 ),
82
Ingo Molnar434a83c2009-10-15 11:50:39 +020083 TP_printk("irq=%d ret=%s",
Steven Rostedtea20d922009-04-10 08:54:16 -040084 __entry->irq, __entry->ret ? "handled" : "unhandled")
85);
86
Li Zefanc4673072009-11-26 15:04:31 +080087DECLARE_EVENT_CLASS(softirq,
Steven Rostedtea20d922009-04-10 08:54:16 -040088
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020089 TP_PROTO(unsigned int vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -040090
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020091 TP_ARGS(vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -040092
93 TP_STRUCT__entry(
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020094 __field( unsigned int, vec )
Steven Rostedt160031b2009-04-24 11:26:55 -040095 ),
96
97 TP_fast_assign(
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +020098 __entry->vec = vec_nr;
Steven Rostedt160031b2009-04-24 11:26:55 -040099 ),
100
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200101 TP_printk("vec=%u [action=%s]", __entry->vec,
Steven Rostedtc2adae02009-05-20 19:56:19 -0400102 show_softirq_name(__entry->vec))
Steven Rostedt160031b2009-04-24 11:26:55 -0400103);
104
Jason Baron9ee19832009-04-30 13:29:47 -0400105/**
Li Zefanc4673072009-11-26 15:04:31 +0800106 * softirq_entry - called immediately before the softirq handler
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200107 * @vec_nr: softirq vector number
Li Zefanc4673072009-11-26 15:04:31 +0800108 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200109 * When used in combination with the softirq_exit tracepoint
110 * we can determine the softirq handler runtine.
Li Zefanc4673072009-11-26 15:04:31 +0800111 */
112DEFINE_EVENT(softirq, softirq_entry,
113
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200114 TP_PROTO(unsigned int vec_nr),
Li Zefanc4673072009-11-26 15:04:31 +0800115
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200116 TP_ARGS(vec_nr)
Li Zefanc4673072009-11-26 15:04:31 +0800117);
118
119/**
Jason Baron9ee19832009-04-30 13:29:47 -0400120 * softirq_exit - called immediately after the softirq handler returns
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200121 * @vec_nr: softirq vector number
Jason Baron9ee19832009-04-30 13:29:47 -0400122 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200123 * When used in combination with the softirq_entry tracepoint
124 * we can determine the softirq handler runtine.
Jason Baron9ee19832009-04-30 13:29:47 -0400125 */
Li Zefanc4673072009-11-26 15:04:31 +0800126DEFINE_EVENT(softirq, softirq_exit,
Steven Rostedt160031b2009-04-24 11:26:55 -0400127
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200128 TP_PROTO(unsigned int vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -0400129
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200130 TP_ARGS(vec_nr)
Steven Rostedt160031b2009-04-24 11:26:55 -0400131);
Jason Baronaf392412009-02-26 10:11:05 -0500132
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900133/**
134 * softirq_raise - called immediately when a softirq is raised
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200135 * @vec_nr: softirq vector number
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900136 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200137 * When used in combination with the softirq_entry tracepoint
138 * we can determine the softirq raise to run latency.
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900139 */
140DEFINE_EVENT(softirq, softirq_raise,
141
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200142 TP_PROTO(unsigned int vec_nr),
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900143
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200144 TP_ARGS(vec_nr)
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900145);
146
Steven Rostedta8d154b2009-04-10 09:36:00 -0400147#endif /* _TRACE_IRQ_H */
148
149/* This part must be outside protection */
150#include <trace/define_trace.h>