blob: 0e4cfb694fe70630457af67e1b1bc568f56c9b09 [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>
Steven Rostedtea20d922009-04-10 08:54:16 -04008#include <linux/interrupt.h>
Jason Baronaf392412009-02-26 10:11:05 -05009
Steven Rostedt1d080d62009-06-01 12:20:40 -040010#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
Li Zefan5dd4de52009-09-17 17:38:32 +080011#define show_softirq_name(val) \
12 __print_symbolic(val, \
13 softirq_name(HI), \
14 softirq_name(TIMER), \
15 softirq_name(NET_TX), \
16 softirq_name(NET_RX), \
17 softirq_name(BLOCK), \
18 softirq_name(BLOCK_IOPOLL), \
19 softirq_name(TASKLET), \
20 softirq_name(SCHED), \
21 softirq_name(HRTIMER), \
Steven Rostedt1d080d62009-06-01 12:20:40 -040022 softirq_name(RCU))
Steven Rostedtc2adae02009-05-20 19:56:19 -040023
Jason Baron9ee19832009-04-30 13:29:47 -040024/**
25 * irq_handler_entry - called immediately before the irq action handler
26 * @irq: irq number
27 * @action: pointer to struct irqaction
28 *
29 * The struct irqaction pointed to by @action contains various
30 * information about the handler, including the device name,
31 * @action->name, and the device id, @action->dev_id. When used in
32 * conjunction with the irq_handler_exit tracepoint, we can figure
33 * out irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040034 */
Steven Rostedt160031b2009-04-24 11:26:55 -040035TRACE_EVENT(irq_handler_entry,
36
Steven Rostedtea20d922009-04-10 08:54:16 -040037 TP_PROTO(int irq, struct irqaction *action),
Steven Rostedt160031b2009-04-24 11:26:55 -040038
Steven Rostedtea20d922009-04-10 08:54:16 -040039 TP_ARGS(irq, action),
Steven Rostedt160031b2009-04-24 11:26:55 -040040
41 TP_STRUCT__entry(
42 __field( int, irq )
43 __string( name, action->name )
44 ),
45
46 TP_fast_assign(
47 __entry->irq = irq;
48 __assign_str(name, action->name);
49 ),
50
Ingo Molnar434a83c2009-10-15 11:50:39 +020051 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
Steven Rostedt160031b2009-04-24 11:26:55 -040052);
Steven Rostedtea20d922009-04-10 08:54:16 -040053
Jason Baron9ee19832009-04-30 13:29:47 -040054/**
55 * irq_handler_exit - called immediately after the irq action handler returns
56 * @irq: irq number
57 * @action: pointer to struct irqaction
58 * @ret: return value
59 *
60 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
61 * @action->handler scuccessully handled this irq. Otherwise, the irq might be
62 * a shared irq line, or the irq was not handled successfully. Can be used in
63 * conjunction with the irq_handler_entry to understand irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040064 */
65TRACE_EVENT(irq_handler_exit,
66
67 TP_PROTO(int irq, struct irqaction *action, int ret),
68
69 TP_ARGS(irq, action, ret),
70
71 TP_STRUCT__entry(
72 __field( int, irq )
73 __field( int, ret )
74 ),
75
76 TP_fast_assign(
77 __entry->irq = irq;
78 __entry->ret = ret;
79 ),
80
Ingo Molnar434a83c2009-10-15 11:50:39 +020081 TP_printk("irq=%d ret=%s",
Steven Rostedtea20d922009-04-10 08:54:16 -040082 __entry->irq, __entry->ret ? "handled" : "unhandled")
83);
84
Li Zefanc4673072009-11-26 15:04:31 +080085DECLARE_EVENT_CLASS(softirq,
Steven Rostedtea20d922009-04-10 08:54:16 -040086
Steven Rostedtea20d922009-04-10 08:54:16 -040087 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
Steven Rostedt160031b2009-04-24 11:26:55 -040088
Steven Rostedtea20d922009-04-10 08:54:16 -040089 TP_ARGS(h, vec),
Steven Rostedt160031b2009-04-24 11:26:55 -040090
91 TP_STRUCT__entry(
92 __field( int, vec )
Steven Rostedt160031b2009-04-24 11:26:55 -040093 ),
94
95 TP_fast_assign(
96 __entry->vec = (int)(h - vec);
Steven Rostedt160031b2009-04-24 11:26:55 -040097 ),
98
Ingo Molnar434a83c2009-10-15 11:50:39 +020099 TP_printk("vec=%d [action=%s]", __entry->vec,
Steven Rostedtc2adae02009-05-20 19:56:19 -0400100 show_softirq_name(__entry->vec))
Steven Rostedt160031b2009-04-24 11:26:55 -0400101);
102
Jason Baron9ee19832009-04-30 13:29:47 -0400103/**
Li Zefanc4673072009-11-26 15:04:31 +0800104 * softirq_entry - called immediately before the softirq handler
105 * @h: pointer to struct softirq_action
106 * @vec: pointer to first struct softirq_action in softirq_vec array
107 *
108 * The @h parameter, contains a pointer to the struct softirq_action
109 * which has a pointer to the action handler that is called. By subtracting
110 * the @vec pointer from the @h pointer, we can determine the softirq
111 * number. Also, when used in combination with the softirq_exit tracepoint
112 * we can determine the softirq latency.
113 */
114DEFINE_EVENT(softirq, softirq_entry,
115
116 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
117
118 TP_ARGS(h, vec)
119);
120
121/**
Jason Baron9ee19832009-04-30 13:29:47 -0400122 * softirq_exit - called immediately after the softirq handler returns
123 * @h: pointer to struct softirq_action
124 * @vec: pointer to first struct softirq_action in softirq_vec array
125 *
126 * The @h parameter contains a pointer to the struct softirq_action
127 * that has handled the softirq. By subtracting the @vec pointer from
128 * the @h pointer, we can determine the softirq number. Also, when used in
129 * combination with the softirq_entry tracepoint we can determine the softirq
130 * latency.
131 */
Li Zefanc4673072009-11-26 15:04:31 +0800132DEFINE_EVENT(softirq, softirq_exit,
Steven Rostedt160031b2009-04-24 11:26:55 -0400133
134 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
135
Li Zefanc4673072009-11-26 15:04:31 +0800136 TP_ARGS(h, vec)
Steven Rostedt160031b2009-04-24 11:26:55 -0400137);
Jason Baronaf392412009-02-26 10:11:05 -0500138
Steven Rostedta8d154b2009-04-10 09:36:00 -0400139#endif /* _TRACE_IRQ_H */
140
141/* This part must be outside protection */
142#include <trace/define_trace.h>