blob: 1c41b74581f725c8b3ce1afbdf8a37a5470aca39 [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 Rostedt (Red Hat)f0a91b32015-03-27 16:31:44 -040012#define SOFTIRQ_NAME_LIST \
13 softirq_name(HI) \
14 softirq_name(TIMER) \
15 softirq_name(NET_TX) \
16 softirq_name(NET_RX) \
17 softirq_name(BLOCK) \
Christoph Hellwig511cbce2015-11-10 14:56:14 +010018 softirq_name(IRQ_POLL) \
Steven Rostedt (Red Hat)f0a91b32015-03-27 16:31:44 -040019 softirq_name(TASKLET) \
20 softirq_name(SCHED) \
21 softirq_name(HRTIMER) \
22 softirq_name_end(RCU)
23
24#undef softirq_name
25#undef softirq_name_end
26
27#define softirq_name(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
28#define softirq_name_end(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
29
30SOFTIRQ_NAME_LIST
31
32#undef softirq_name
33#undef softirq_name_end
34
35#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq },
36#define softirq_name_end(sirq) { sirq##_SOFTIRQ, #sirq }
37
Li Zefan5dd4de52009-09-17 17:38:32 +080038#define show_softirq_name(val) \
Steven Rostedt (Red Hat)f0a91b32015-03-27 16:31:44 -040039 __print_symbolic(val, SOFTIRQ_NAME_LIST)
Steven Rostedtc2adae02009-05-20 19:56:19 -040040
Jason Baron9ee19832009-04-30 13:29:47 -040041/**
42 * irq_handler_entry - called immediately before the irq action handler
43 * @irq: irq number
44 * @action: pointer to struct irqaction
45 *
46 * The struct irqaction pointed to by @action contains various
47 * information about the handler, including the device name,
48 * @action->name, and the device id, @action->dev_id. When used in
49 * conjunction with the irq_handler_exit tracepoint, we can figure
50 * out irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040051 */
Steven Rostedt160031b2009-04-24 11:26:55 -040052TRACE_EVENT(irq_handler_entry,
53
Steven Rostedtea20d922009-04-10 08:54:16 -040054 TP_PROTO(int irq, struct irqaction *action),
Steven Rostedt160031b2009-04-24 11:26:55 -040055
Steven Rostedtea20d922009-04-10 08:54:16 -040056 TP_ARGS(irq, action),
Steven Rostedt160031b2009-04-24 11:26:55 -040057
58 TP_STRUCT__entry(
59 __field( int, irq )
60 __string( name, action->name )
61 ),
62
63 TP_fast_assign(
64 __entry->irq = irq;
65 __assign_str(name, action->name);
66 ),
67
Ingo Molnar434a83c2009-10-15 11:50:39 +020068 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
Steven Rostedt160031b2009-04-24 11:26:55 -040069);
Steven Rostedtea20d922009-04-10 08:54:16 -040070
Jason Baron9ee19832009-04-30 13:29:47 -040071/**
72 * irq_handler_exit - called immediately after the irq action handler returns
73 * @irq: irq number
74 * @action: pointer to struct irqaction
75 * @ret: return value
76 *
77 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
Masanari Iida3da7ffe2016-06-29 17:44:25 +090078 * @action->handler successfully handled this irq. Otherwise, the irq might be
Jason Baron9ee19832009-04-30 13:29:47 -040079 * a shared irq line, or the irq was not handled successfully. Can be used in
80 * conjunction with the irq_handler_entry to understand irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040081 */
82TRACE_EVENT(irq_handler_exit,
83
84 TP_PROTO(int irq, struct irqaction *action, int ret),
85
86 TP_ARGS(irq, action, ret),
87
88 TP_STRUCT__entry(
89 __field( int, irq )
90 __field( int, ret )
91 ),
92
93 TP_fast_assign(
94 __entry->irq = irq;
95 __entry->ret = ret;
96 ),
97
Ingo Molnar434a83c2009-10-15 11:50:39 +020098 TP_printk("irq=%d ret=%s",
Steven Rostedtea20d922009-04-10 08:54:16 -040099 __entry->irq, __entry->ret ? "handled" : "unhandled")
100);
101
Li Zefanc4673072009-11-26 15:04:31 +0800102DECLARE_EVENT_CLASS(softirq,
Steven Rostedtea20d922009-04-10 08:54:16 -0400103
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200104 TP_PROTO(unsigned int vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -0400105
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200106 TP_ARGS(vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -0400107
108 TP_STRUCT__entry(
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200109 __field( unsigned int, vec )
Steven Rostedt160031b2009-04-24 11:26:55 -0400110 ),
111
112 TP_fast_assign(
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200113 __entry->vec = vec_nr;
Steven Rostedt160031b2009-04-24 11:26:55 -0400114 ),
115
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200116 TP_printk("vec=%u [action=%s]", __entry->vec,
Steven Rostedtc2adae02009-05-20 19:56:19 -0400117 show_softirq_name(__entry->vec))
Steven Rostedt160031b2009-04-24 11:26:55 -0400118);
119
Jason Baron9ee19832009-04-30 13:29:47 -0400120/**
Li Zefanc4673072009-11-26 15:04:31 +0800121 * softirq_entry - called immediately before the softirq handler
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200122 * @vec_nr: softirq vector number
Li Zefanc4673072009-11-26 15:04:31 +0800123 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200124 * When used in combination with the softirq_exit tracepoint
Masanari Iidae793c0f2014-09-04 23:44:36 +0900125 * we can determine the softirq handler routine.
Li Zefanc4673072009-11-26 15:04:31 +0800126 */
127DEFINE_EVENT(softirq, softirq_entry,
128
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200129 TP_PROTO(unsigned int vec_nr),
Li Zefanc4673072009-11-26 15:04:31 +0800130
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200131 TP_ARGS(vec_nr)
Li Zefanc4673072009-11-26 15:04:31 +0800132);
133
134/**
Jason Baron9ee19832009-04-30 13:29:47 -0400135 * softirq_exit - called immediately after the softirq handler returns
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200136 * @vec_nr: softirq vector number
Jason Baron9ee19832009-04-30 13:29:47 -0400137 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200138 * When used in combination with the softirq_entry tracepoint
Masanari Iidae793c0f2014-09-04 23:44:36 +0900139 * we can determine the softirq handler routine.
Jason Baron9ee19832009-04-30 13:29:47 -0400140 */
Li Zefanc4673072009-11-26 15:04:31 +0800141DEFINE_EVENT(softirq, softirq_exit,
Steven Rostedt160031b2009-04-24 11:26:55 -0400142
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200143 TP_PROTO(unsigned int vec_nr),
Steven Rostedt160031b2009-04-24 11:26:55 -0400144
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200145 TP_ARGS(vec_nr)
Steven Rostedt160031b2009-04-24 11:26:55 -0400146);
Jason Baronaf392412009-02-26 10:11:05 -0500147
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900148/**
149 * softirq_raise - called immediately when a softirq is raised
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200150 * @vec_nr: softirq vector number
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900151 *
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200152 * When used in combination with the softirq_entry tracepoint
153 * we can determine the softirq raise to run latency.
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900154 */
155DEFINE_EVENT(softirq, softirq_raise,
156
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200157 TP_PROTO(unsigned int vec_nr),
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900158
Thomas Gleixnerf4bc6bb2010-10-19 15:00:13 +0200159 TP_ARGS(vec_nr)
Lai Jiangshan2bf21602010-08-23 18:42:48 +0900160);
161
Steven Rostedta8d154b2009-04-10 09:36:00 -0400162#endif /* _TRACE_IRQ_H */
163
164/* This part must be outside protection */
165#include <trace/define_trace.h>