1 #undef TRACE_SYSTEM 2 #define TRACE_SYSTEM irq 3 4 #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ) 5 #define _TRACE_IRQ_H 6 7 #include <linux/tracepoint.h> 8 9 struct irqaction; 10 struct softirq_action; 11 12 #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } 13 #define show_softirq_name(val) \ 14 __print_symbolic(val, \ 15 softirq_name(HI), \ 16 softirq_name(TIMER), \ 17 softirq_name(NET_TX), \ 18 softirq_name(NET_RX), \ 19 softirq_name(BLOCK), \ 20 softirq_name(BLOCK_IOPOLL), \ 21 softirq_name(TASKLET), \ 22 softirq_name(SCHED), \ 23 softirq_name(HRTIMER)) 24 25 /** 26 * irq_handler_entry - called immediately before the irq action handler 27 * @irq: irq number 28 * @action: pointer to struct irqaction 29 * 30 * The struct irqaction pointed to by @action contains various 31 * information about the handler, including the device name, 32 * @action->name, and the device id, @action->dev_id. When used in 33 * conjunction with the irq_handler_exit tracepoint, we can figure 34 * out irq handler latencies. 35 */ 36 TRACE_EVENT(irq_handler_entry, 37 38 TP_PROTO(int irq, struct irqaction *action), 39 40 TP_ARGS(irq, action), 41 42 TP_STRUCT__entry( 43 __field( int, irq ) 44 __string( name, action->name ) 45 ), 46 47 TP_fast_assign( 48 __entry->irq = irq; 49 __assign_str(name, action->name); 50 ), 51 52 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name)) 53 ); 54 55 /** 56 * irq_handler_exit - called immediately after the irq action handler returns 57 * @irq: irq number 58 * @action: pointer to struct irqaction 59 * @ret: return value 60 * 61 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding 62 * @action->handler scuccessully handled this irq. Otherwise, the irq might be 63 * a shared irq line, or the irq was not handled successfully. Can be used in 64 * conjunction with the irq_handler_entry to understand irq handler latencies. 65 */ 66 TRACE_EVENT(irq_handler_exit, 67 68 TP_PROTO(int irq, struct irqaction *action, int ret), 69 70 TP_ARGS(irq, action, ret), 71 72 TP_STRUCT__entry( 73 __field( int, irq ) 74 __field( int, ret ) 75 ), 76 77 TP_fast_assign( 78 __entry->irq = irq; 79 __entry->ret = ret; 80 ), 81 82 TP_printk("irq=%d ret=%s", 83 __entry->irq, __entry->ret ? "handled" : "unhandled") 84 ); 85 86 DECLARE_EVENT_CLASS(softirq, 87 88 TP_PROTO(unsigned int vec_nr), 89 90 TP_ARGS(vec_nr), 91 92 TP_STRUCT__entry( 93 __field( unsigned int, vec ) 94 ), 95 96 TP_fast_assign( 97 __entry->vec = vec_nr; 98 ), 99 100 TP_printk("vec=%u [action=%s]", __entry->vec, 101 show_softirq_name(__entry->vec)) 102 ); 103 104 /** 105 * softirq_entry - called immediately before the softirq handler 106 * @vec_nr: softirq vector number 107 * 108 * When used in combination with the softirq_exit tracepoint 109 * we can determine the softirq handler runtine. 110 */ 111 DEFINE_EVENT(softirq, softirq_entry, 112 113 TP_PROTO(unsigned int vec_nr), 114 115 TP_ARGS(vec_nr) 116 ); 117 118 /** 119 * softirq_exit - called immediately after the softirq handler returns 120 * @vec_nr: softirq vector number 121 * 122 * When used in combination with the softirq_entry tracepoint 123 * we can determine the softirq handler runtine. 124 */ 125 DEFINE_EVENT(softirq, softirq_exit, 126 127 TP_PROTO(unsigned int vec_nr), 128 129 TP_ARGS(vec_nr) 130 ); 131 132 /** 133 * softirq_raise - called immediately when a softirq is raised 134 * @vec_nr: softirq vector number 135 * 136 * When used in combination with the softirq_entry tracepoint 137 * we can determine the softirq raise to run latency. 138 */ 139 DEFINE_EVENT(softirq, softirq_raise, 140 141 TP_PROTO(unsigned int vec_nr), 142 143 TP_ARGS(vec_nr) 144 ); 145 146 #endif /* _TRACE_IRQ_H */ 147 148 /* This part must be outside protection */ 149 #include <trace/define_trace.h> 150