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