Commit | Line | Data |
---|---|---|
d0b6e04a LZ |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM irq | |
3 | ||
ea20d929 | 4 | #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ) |
af39241b JB |
5 | #define _TRACE_IRQ_H |
6 | ||
af39241b | 7 | #include <linux/tracepoint.h> |
2bf2160d LJ |
8 | |
9 | struct irqaction; | |
10 | struct softirq_action; | |
ea20d929 | 11 | |
f0a91b3c SRRH |
12 | #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) \ | |
511cbce2 | 18 | softirq_name(IRQ_POLL) \ |
f0a91b3c SRRH |
19 | 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 | ||
30 | SOFTIRQ_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 | ||
5dd4de58 | 38 | #define show_softirq_name(val) \ |
f0a91b3c | 39 | __print_symbolic(val, SOFTIRQ_NAME_LIST) |
c2adae09 | 40 | |
9ee1983c JB |
41 | /** |
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. | |
ea20d929 | 51 | */ |
160031b5 SR |
52 | TRACE_EVENT(irq_handler_entry, |
53 | ||
ea20d929 | 54 | TP_PROTO(int irq, struct irqaction *action), |
160031b5 | 55 | |
ea20d929 | 56 | TP_ARGS(irq, action), |
160031b5 SR |
57 | |
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 | ||
434a83c3 | 68 | TP_printk("irq=%d name=%s", __entry->irq, __get_str(name)) |
160031b5 | 69 | ); |
ea20d929 | 70 | |
9ee1983c JB |
71 | /** |
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 | |
78 | * @action->handler scuccessully handled this irq. Otherwise, the irq might be | |
79 | * 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. | |
ea20d929 SR |
81 | */ |
82 | TRACE_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 | ||
434a83c3 | 98 | TP_printk("irq=%d ret=%s", |
ea20d929 SR |
99 | __entry->irq, __entry->ret ? "handled" : "unhandled") |
100 | ); | |
101 | ||
c467307c | 102 | DECLARE_EVENT_CLASS(softirq, |
160031b5 | 103 | |
f4bc6bb2 | 104 | TP_PROTO(unsigned int vec_nr), |
160031b5 | 105 | |
f4bc6bb2 | 106 | TP_ARGS(vec_nr), |
af39241b | 107 | |
160031b5 | 108 | TP_STRUCT__entry( |
f4bc6bb2 | 109 | __field( unsigned int, vec ) |
160031b5 SR |
110 | ), |
111 | ||
112 | TP_fast_assign( | |
f4bc6bb2 | 113 | __entry->vec = vec_nr; |
160031b5 SR |
114 | ), |
115 | ||
f4bc6bb2 | 116 | TP_printk("vec=%u [action=%s]", __entry->vec, |
c2adae09 | 117 | show_softirq_name(__entry->vec)) |
160031b5 SR |
118 | ); |
119 | ||
c467307c LZ |
120 | /** |
121 | * softirq_entry - called immediately before the softirq handler | |
f4bc6bb2 | 122 | * @vec_nr: softirq vector number |
c467307c | 123 | * |
f4bc6bb2 | 124 | * When used in combination with the softirq_exit tracepoint |
e793c0f7 | 125 | * we can determine the softirq handler routine. |
c467307c LZ |
126 | */ |
127 | DEFINE_EVENT(softirq, softirq_entry, | |
128 | ||
f4bc6bb2 | 129 | TP_PROTO(unsigned int vec_nr), |
c467307c | 130 | |
f4bc6bb2 | 131 | TP_ARGS(vec_nr) |
c467307c LZ |
132 | ); |
133 | ||
9ee1983c JB |
134 | /** |
135 | * softirq_exit - called immediately after the softirq handler returns | |
f4bc6bb2 | 136 | * @vec_nr: softirq vector number |
9ee1983c | 137 | * |
f4bc6bb2 | 138 | * When used in combination with the softirq_entry tracepoint |
e793c0f7 | 139 | * we can determine the softirq handler routine. |
9ee1983c | 140 | */ |
c467307c | 141 | DEFINE_EVENT(softirq, softirq_exit, |
160031b5 | 142 | |
f4bc6bb2 | 143 | TP_PROTO(unsigned int vec_nr), |
160031b5 | 144 | |
f4bc6bb2 | 145 | TP_ARGS(vec_nr) |
160031b5 | 146 | ); |
af39241b | 147 | |
2bf2160d LJ |
148 | /** |
149 | * softirq_raise - called immediately when a softirq is raised | |
f4bc6bb2 | 150 | * @vec_nr: softirq vector number |
2bf2160d | 151 | * |
f4bc6bb2 TG |
152 | * When used in combination with the softirq_entry tracepoint |
153 | * we can determine the softirq raise to run latency. | |
2bf2160d LJ |
154 | */ |
155 | DEFINE_EVENT(softirq, softirq_raise, | |
156 | ||
f4bc6bb2 | 157 | TP_PROTO(unsigned int vec_nr), |
2bf2160d | 158 | |
f4bc6bb2 | 159 | TP_ARGS(vec_nr) |
2bf2160d LJ |
160 | ); |
161 | ||
a8d154b0 SR |
162 | #endif /* _TRACE_IRQ_H */ |
163 | ||
164 | /* This part must be outside protection */ | |
165 | #include <trace/define_trace.h> |