blob: 32a9f7ef432bd63b2210d381af829513477993ff [file] [log] [blame]
Steven Rostedtea20d922009-04-10 08:54:16 -04001#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
Jason Baronaf392412009-02-26 10:11:05 -05002#define _TRACE_IRQ_H
3
Jason Baronaf392412009-02-26 10:11:05 -05004#include <linux/tracepoint.h>
Steven Rostedtea20d922009-04-10 08:54:16 -04005#include <linux/interrupt.h>
Jason Baronaf392412009-02-26 10:11:05 -05006
Steven Rostedtea20d922009-04-10 08:54:16 -04007#undef TRACE_SYSTEM
8#define TRACE_SYSTEM irq
9
Jason Baron9ee19832009-04-30 13:29:47 -040010/**
11 * irq_handler_entry - called immediately before the irq action handler
12 * @irq: irq number
13 * @action: pointer to struct irqaction
14 *
15 * The struct irqaction pointed to by @action contains various
16 * information about the handler, including the device name,
17 * @action->name, and the device id, @action->dev_id. When used in
18 * conjunction with the irq_handler_exit tracepoint, we can figure
19 * out irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040020 */
Steven Rostedt160031b2009-04-24 11:26:55 -040021TRACE_EVENT(irq_handler_entry,
22
Steven Rostedtea20d922009-04-10 08:54:16 -040023 TP_PROTO(int irq, struct irqaction *action),
Steven Rostedt160031b2009-04-24 11:26:55 -040024
Steven Rostedtea20d922009-04-10 08:54:16 -040025 TP_ARGS(irq, action),
Steven Rostedt160031b2009-04-24 11:26:55 -040026
27 TP_STRUCT__entry(
28 __field( int, irq )
29 __string( name, action->name )
30 ),
31
32 TP_fast_assign(
33 __entry->irq = irq;
34 __assign_str(name, action->name);
35 ),
36
37 TP_printk("irq=%d handler=%s", __entry->irq, __get_str(name))
38);
Steven Rostedtea20d922009-04-10 08:54:16 -040039
Jason Baron9ee19832009-04-30 13:29:47 -040040/**
41 * irq_handler_exit - called immediately after the irq action handler returns
42 * @irq: irq number
43 * @action: pointer to struct irqaction
44 * @ret: return value
45 *
46 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
47 * @action->handler scuccessully handled this irq. Otherwise, the irq might be
48 * a shared irq line, or the irq was not handled successfully. Can be used in
49 * conjunction with the irq_handler_entry to understand irq handler latencies.
Steven Rostedtea20d922009-04-10 08:54:16 -040050 */
51TRACE_EVENT(irq_handler_exit,
52
53 TP_PROTO(int irq, struct irqaction *action, int ret),
54
55 TP_ARGS(irq, action, ret),
56
57 TP_STRUCT__entry(
58 __field( int, irq )
59 __field( int, ret )
60 ),
61
62 TP_fast_assign(
63 __entry->irq = irq;
64 __entry->ret = ret;
65 ),
66
67 TP_printk("irq=%d return=%s",
68 __entry->irq, __entry->ret ? "handled" : "unhandled")
69);
70
Jason Baron9ee19832009-04-30 13:29:47 -040071/**
72 * softirq_entry - called immediately before the softirq handler
73 * @h: pointer to struct softirq_action
74 * @vec: pointer to first struct softirq_action in softirq_vec array
75 *
76 * The @h parameter, contains a pointer to the struct softirq_action
77 * which has a pointer to the action handler that is called. By subtracting
78 * the @vec pointer from the @h pointer, we can determine the softirq
79 * number. Also, when used in combination with the softirq_exit tracepoint
80 * we can determine the softirq latency.
81 */
Steven Rostedt160031b2009-04-24 11:26:55 -040082TRACE_EVENT(softirq_entry,
Steven Rostedtea20d922009-04-10 08:54:16 -040083
Steven Rostedtea20d922009-04-10 08:54:16 -040084 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
Steven Rostedt160031b2009-04-24 11:26:55 -040085
Steven Rostedtea20d922009-04-10 08:54:16 -040086 TP_ARGS(h, vec),
Steven Rostedt160031b2009-04-24 11:26:55 -040087
88 TP_STRUCT__entry(
89 __field( int, vec )
90 __string( name, softirq_to_name[h-vec] )
91 ),
92
93 TP_fast_assign(
94 __entry->vec = (int)(h - vec);
95 __assign_str(name, softirq_to_name[h-vec]);
96 ),
97
98 TP_printk("softirq=%d action=%s", __entry->vec, __get_str(name))
99);
100
Jason Baron9ee19832009-04-30 13:29:47 -0400101/**
102 * softirq_exit - called immediately after the softirq handler returns
103 * @h: pointer to struct softirq_action
104 * @vec: pointer to first struct softirq_action in softirq_vec array
105 *
106 * The @h parameter contains a pointer to the struct softirq_action
107 * that has handled the softirq. By subtracting the @vec pointer from
108 * the @h pointer, we can determine the softirq number. Also, when used in
109 * combination with the softirq_entry tracepoint we can determine the softirq
110 * latency.
111 */
Steven Rostedt160031b2009-04-24 11:26:55 -0400112TRACE_EVENT(softirq_exit,
113
114 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
115
116 TP_ARGS(h, vec),
117
118 TP_STRUCT__entry(
119 __field( int, vec )
120 __string( name, softirq_to_name[h-vec] )
121 ),
122
123 TP_fast_assign(
124 __entry->vec = (int)(h - vec);
125 __assign_str(name, softirq_to_name[h-vec]);
126 ),
127
128 TP_printk("softirq=%d action=%s", __entry->vec, __get_str(name))
129);
Jason Baronaf392412009-02-26 10:11:05 -0500130
Steven Rostedta8d154b2009-04-10 09:36:00 -0400131#endif /* _TRACE_IRQ_H */
132
133/* This part must be outside protection */
134#include <trace/define_trace.h>