1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM irq
5 #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
11 struct softirq_action;
13 #define SOFTIRQ_NAME_LIST \
16 softirq_name(NET_TX) \
17 softirq_name(NET_RX) \
19 softirq_name(IRQ_POLL) \
20 softirq_name(TASKLET) \
22 softirq_name(HRTIMER) \
26 #undef softirq_name_end
28 #define softirq_name(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
29 #define softirq_name_end(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
34 #undef softirq_name_end
36 #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq },
37 #define softirq_name_end(sirq) { sirq##_SOFTIRQ, #sirq }
39 #define show_softirq_name(val) \
40 __print_symbolic(val, SOFTIRQ_NAME_LIST)
43 * irq_handler_entry - called immediately before the irq action handler
45 * @action: pointer to struct irqaction
47 * The struct irqaction pointed to by @action contains various
48 * information about the handler, including the device name,
49 * @action->name, and the device id, @action->dev_id. When used in
50 * conjunction with the irq_handler_exit tracepoint, we can figure
51 * out irq handler latencies.
53 TRACE_EVENT(irq_handler_entry,
55 TP_PROTO(int irq, struct irqaction *action),
61 __string( name, action->name )
66 __assign_str(name, action->name);
69 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
73 * irq_handler_exit - called immediately after the irq action handler returns
75 * @action: pointer to struct irqaction
78 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
79 * @action->handler successfully handled this irq. Otherwise, the irq might be
80 * a shared irq line, or the irq was not handled successfully. Can be used in
81 * conjunction with the irq_handler_entry to understand irq handler latencies.
83 TRACE_EVENT(irq_handler_exit,
85 TP_PROTO(int irq, struct irqaction *action, int ret),
87 TP_ARGS(irq, action, ret),
99 TP_printk("irq=%d ret=%s",
100 __entry->irq, __entry->ret ? "handled" : "unhandled")
103 DECLARE_EVENT_CLASS(softirq,
105 TP_PROTO(unsigned int vec_nr),
110 __field( unsigned int, vec )
114 __entry->vec = vec_nr;
117 TP_printk("vec=%u [action=%s]", __entry->vec,
118 show_softirq_name(__entry->vec))
122 * softirq_entry - called immediately before the softirq handler
123 * @vec_nr: softirq vector number
125 * When used in combination with the softirq_exit tracepoint
126 * we can determine the softirq handler routine.
128 DEFINE_EVENT(softirq, softirq_entry,
130 TP_PROTO(unsigned int vec_nr),
136 * softirq_exit - called immediately after the softirq handler returns
137 * @vec_nr: softirq vector number
139 * When used in combination with the softirq_entry tracepoint
140 * we can determine the softirq handler routine.
142 DEFINE_EVENT(softirq, softirq_exit,
144 TP_PROTO(unsigned int vec_nr),
150 * softirq_raise - called immediately when a softirq is raised
151 * @vec_nr: softirq vector number
153 * When used in combination with the softirq_entry tracepoint
154 * we can determine the softirq raise to run latency.
156 DEFINE_EVENT(softirq, softirq_raise,
158 TP_PROTO(unsigned int vec_nr),
163 #endif /* _TRACE_IRQ_H */
165 /* This part must be outside protection */
166 #include <trace/define_trace.h>