1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM irq 3 #define TRACE_SYSTEM irq 4 4 5 #if !defined(_TRACE_IRQ_H) || defined(TRACE_HE 5 #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_IRQ_H 6 #define _TRACE_IRQ_H 7 7 8 #include <linux/tracepoint.h> 8 #include <linux/tracepoint.h> 9 9 10 struct irqaction; 10 struct irqaction; 11 struct softirq_action; 11 struct softirq_action; 12 12 13 #define SOFTIRQ_NAME_LIST 13 #define SOFTIRQ_NAME_LIST \ 14 softirq_name(HI) 14 softirq_name(HI) \ 15 softirq_name(TIMER) 15 softirq_name(TIMER) \ 16 softirq_name(NET_TX) 16 softirq_name(NET_TX) \ 17 softirq_name(NET_RX) 17 softirq_name(NET_RX) \ 18 softirq_name(BLOCK) 18 softirq_name(BLOCK) \ 19 softirq_name(IRQ_POLL 19 softirq_name(IRQ_POLL) \ 20 softirq_name(TASKLET) 20 softirq_name(TASKLET) \ 21 softirq_name(SCHED) 21 softirq_name(SCHED) \ 22 softirq_name(HRTIMER) 22 softirq_name(HRTIMER) \ 23 softirq_name_end(RCU) 23 softirq_name_end(RCU) 24 24 25 #undef softirq_name 25 #undef softirq_name 26 #undef softirq_name_end 26 #undef softirq_name_end 27 27 28 #define softirq_name(sirq) TRACE_DEFINE_ENUM(s 28 #define softirq_name(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ); 29 #define softirq_name_end(sirq) TRACE_DEFINE_E 29 #define softirq_name_end(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ); 30 30 31 SOFTIRQ_NAME_LIST 31 SOFTIRQ_NAME_LIST 32 32 33 #undef softirq_name 33 #undef softirq_name 34 #undef softirq_name_end 34 #undef softirq_name_end 35 35 36 #define softirq_name(sirq) { sirq##_SOFTIRQ, # 36 #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }, 37 #define softirq_name_end(sirq) { sirq##_SOFTIR 37 #define softirq_name_end(sirq) { sirq##_SOFTIRQ, #sirq } 38 38 39 #define show_softirq_name(val) 39 #define show_softirq_name(val) \ 40 __print_symbolic(val, SOFTIRQ_NAME_LIS 40 __print_symbolic(val, SOFTIRQ_NAME_LIST) 41 41 42 /** 42 /** 43 * irq_handler_entry - called immediately befo 43 * irq_handler_entry - called immediately before the irq action handler 44 * @irq: irq number 44 * @irq: irq number 45 * @action: pointer to struct irqaction 45 * @action: pointer to struct irqaction 46 * 46 * 47 * The struct irqaction pointed to by @action 47 * The struct irqaction pointed to by @action contains various 48 * information about the handler, including th 48 * information about the handler, including the device name, 49 * @action->name, and the device id, @action-> 49 * @action->name, and the device id, @action->dev_id. When used in 50 * conjunction with the irq_handler_exit trace 50 * conjunction with the irq_handler_exit tracepoint, we can figure 51 * out irq handler latencies. 51 * out irq handler latencies. 52 */ 52 */ 53 TRACE_EVENT(irq_handler_entry, 53 TRACE_EVENT(irq_handler_entry, 54 54 55 TP_PROTO(int irq, struct irqaction *ac 55 TP_PROTO(int irq, struct irqaction *action), 56 56 57 TP_ARGS(irq, action), 57 TP_ARGS(irq, action), 58 58 59 TP_STRUCT__entry( 59 TP_STRUCT__entry( 60 __field( int, irq 60 __field( int, irq ) 61 __string( name, action 61 __string( name, action->name ) 62 ), 62 ), 63 63 64 TP_fast_assign( 64 TP_fast_assign( 65 __entry->irq = irq; 65 __entry->irq = irq; 66 __assign_str(name); !! 66 __assign_str(name, action->name); 67 ), 67 ), 68 68 69 TP_printk("irq=%d name=%s", __entry->i 69 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name)) 70 ); 70 ); 71 71 72 /** 72 /** 73 * irq_handler_exit - called immediately after 73 * irq_handler_exit - called immediately after the irq action handler returns 74 * @irq: irq number 74 * @irq: irq number 75 * @action: pointer to struct irqaction 75 * @action: pointer to struct irqaction 76 * @ret: return value 76 * @ret: return value 77 * 77 * 78 * If the @ret value is set to IRQ_HANDLED, th 78 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding 79 * @action->handler successfully handled this 79 * @action->handler successfully handled this irq. Otherwise, the irq might be 80 * a shared irq line, or the irq was not handl 80 * a shared irq line, or the irq was not handled successfully. Can be used in 81 * conjunction with the irq_handler_entry to u 81 * conjunction with the irq_handler_entry to understand irq handler latencies. 82 */ 82 */ 83 TRACE_EVENT(irq_handler_exit, 83 TRACE_EVENT(irq_handler_exit, 84 84 85 TP_PROTO(int irq, struct irqaction *ac 85 TP_PROTO(int irq, struct irqaction *action, int ret), 86 86 87 TP_ARGS(irq, action, ret), 87 TP_ARGS(irq, action, ret), 88 88 89 TP_STRUCT__entry( 89 TP_STRUCT__entry( 90 __field( int, irq 90 __field( int, irq ) 91 __field( int, ret 91 __field( int, ret ) 92 ), 92 ), 93 93 94 TP_fast_assign( 94 TP_fast_assign( 95 __entry->irq = irq; 95 __entry->irq = irq; 96 __entry->ret = ret; 96 __entry->ret = ret; 97 ), 97 ), 98 98 99 TP_printk("irq=%d ret=%s", 99 TP_printk("irq=%d ret=%s", 100 __entry->irq, __entry->ret ? 100 __entry->irq, __entry->ret ? "handled" : "unhandled") 101 ); 101 ); 102 102 103 DECLARE_EVENT_CLASS(softirq, 103 DECLARE_EVENT_CLASS(softirq, 104 104 105 TP_PROTO(unsigned int vec_nr), 105 TP_PROTO(unsigned int vec_nr), 106 106 107 TP_ARGS(vec_nr), 107 TP_ARGS(vec_nr), 108 108 109 TP_STRUCT__entry( 109 TP_STRUCT__entry( 110 __field( unsigned int, 110 __field( unsigned int, vec ) 111 ), 111 ), 112 112 113 TP_fast_assign( 113 TP_fast_assign( 114 __entry->vec = vec_nr; 114 __entry->vec = vec_nr; 115 ), 115 ), 116 116 117 TP_printk("vec=%u [action=%s]", __entr 117 TP_printk("vec=%u [action=%s]", __entry->vec, 118 show_softirq_name(__entry->v 118 show_softirq_name(__entry->vec)) 119 ); 119 ); 120 120 121 /** 121 /** 122 * softirq_entry - called immediately before t 122 * softirq_entry - called immediately before the softirq handler 123 * @vec_nr: softirq vector number 123 * @vec_nr: softirq vector number 124 * 124 * 125 * When used in combination with the softirq_e 125 * When used in combination with the softirq_exit tracepoint 126 * we can determine the softirq handler routin 126 * we can determine the softirq handler routine. 127 */ 127 */ 128 DEFINE_EVENT(softirq, softirq_entry, 128 DEFINE_EVENT(softirq, softirq_entry, 129 129 130 TP_PROTO(unsigned int vec_nr), 130 TP_PROTO(unsigned int vec_nr), 131 131 132 TP_ARGS(vec_nr) 132 TP_ARGS(vec_nr) 133 ); 133 ); 134 134 135 /** 135 /** 136 * softirq_exit - called immediately after the 136 * softirq_exit - called immediately after the softirq handler returns 137 * @vec_nr: softirq vector number 137 * @vec_nr: softirq vector number 138 * 138 * 139 * When used in combination with the softirq_e 139 * When used in combination with the softirq_entry tracepoint 140 * we can determine the softirq handler routin 140 * we can determine the softirq handler routine. 141 */ 141 */ 142 DEFINE_EVENT(softirq, softirq_exit, 142 DEFINE_EVENT(softirq, softirq_exit, 143 143 144 TP_PROTO(unsigned int vec_nr), 144 TP_PROTO(unsigned int vec_nr), 145 145 146 TP_ARGS(vec_nr) 146 TP_ARGS(vec_nr) 147 ); 147 ); 148 148 149 /** 149 /** 150 * softirq_raise - called immediately when a s 150 * softirq_raise - called immediately when a softirq is raised 151 * @vec_nr: softirq vector number 151 * @vec_nr: softirq vector number 152 * 152 * 153 * When used in combination with the softirq_e 153 * When used in combination with the softirq_entry tracepoint 154 * we can determine the softirq raise to run l 154 * we can determine the softirq raise to run latency. 155 */ 155 */ 156 DEFINE_EVENT(softirq, softirq_raise, 156 DEFINE_EVENT(softirq, softirq_raise, 157 157 158 TP_PROTO(unsigned int vec_nr), 158 TP_PROTO(unsigned int vec_nr), 159 159 160 TP_ARGS(vec_nr) 160 TP_ARGS(vec_nr) 161 ); << 162 << 163 DECLARE_EVENT_CLASS(tasklet, << 164 << 165 TP_PROTO(struct tasklet_struct *t, voi << 166 << 167 TP_ARGS(t, func), << 168 << 169 TP_STRUCT__entry( << 170 __field( void *, taskle << 171 __field( void *, func) << 172 ), << 173 << 174 TP_fast_assign( << 175 __entry->tasklet = t; << 176 __entry->func = func; << 177 ), << 178 << 179 TP_printk("tasklet=%ps function=%ps", << 180 ); << 181 << 182 /** << 183 * tasklet_entry - called immediately before t << 184 * @t: tasklet pointer << 185 * @func: tasklet callback or function being r << 186 * << 187 * Used to find individual tasklet execution t << 188 */ << 189 DEFINE_EVENT(tasklet, tasklet_entry, << 190 << 191 TP_PROTO(struct tasklet_struct *t, voi << 192 << 193 TP_ARGS(t, func) << 194 ); << 195 << 196 /** << 197 * tasklet_exit - called immediately after the << 198 * @t: tasklet pointer << 199 * @func: tasklet callback or function being r << 200 * << 201 * Used to find individual tasklet execution t << 202 */ << 203 DEFINE_EVENT(tasklet, tasklet_exit, << 204 << 205 TP_PROTO(struct tasklet_struct *t, voi << 206 << 207 TP_ARGS(t, func) << 208 ); 161 ); 209 162 210 #endif /* _TRACE_IRQ_H */ 163 #endif /* _TRACE_IRQ_H */ 211 164 212 /* This part must be outside protection */ 165 /* This part must be outside protection */ 213 #include <trace/define_trace.h> 166 #include <trace/define_trace.h> 214 167
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.