Li Zefan | d0b6e04 | 2009-07-13 10:33:21 +0800 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM irq |
| 3 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 4 | #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ) |
Jason Baron | af39241 | 2009-02-26 10:11:05 -0500 | [diff] [blame] | 5 | #define _TRACE_IRQ_H |
| 6 | |
Jason Baron | af39241 | 2009-02-26 10:11:05 -0500 | [diff] [blame] | 7 | #include <linux/tracepoint.h> |
Lai Jiangshan | 2bf2160 | 2010-08-23 18:42:48 +0900 | [diff] [blame^] | 8 | |
| 9 | struct irqaction; |
| 10 | struct softirq_action; |
Jason Baron | af39241 | 2009-02-26 10:11:05 -0500 | [diff] [blame] | 11 | |
Steven Rostedt | 1d080d6 | 2009-06-01 12:20:40 -0400 | [diff] [blame] | 12 | #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } |
Li Zefan | 5dd4de5 | 2009-09-17 17:38:32 +0800 | [diff] [blame] | 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), \ |
Steven Rostedt | 1d080d6 | 2009-06-01 12:20:40 -0400 | [diff] [blame] | 24 | softirq_name(RCU)) |
Steven Rostedt | c2adae0 | 2009-05-20 19:56:19 -0400 | [diff] [blame] | 25 | |
Jason Baron | 9ee1983 | 2009-04-30 13:29:47 -0400 | [diff] [blame] | 26 | /** |
| 27 | * irq_handler_entry - called immediately before the irq action handler |
| 28 | * @irq: irq number |
| 29 | * @action: pointer to struct irqaction |
| 30 | * |
| 31 | * The struct irqaction pointed to by @action contains various |
| 32 | * information about the handler, including the device name, |
| 33 | * @action->name, and the device id, @action->dev_id. When used in |
| 34 | * conjunction with the irq_handler_exit tracepoint, we can figure |
| 35 | * out irq handler latencies. |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 36 | */ |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 37 | TRACE_EVENT(irq_handler_entry, |
| 38 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 39 | TP_PROTO(int irq, struct irqaction *action), |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 40 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 41 | TP_ARGS(irq, action), |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 42 | |
| 43 | TP_STRUCT__entry( |
| 44 | __field( int, irq ) |
| 45 | __string( name, action->name ) |
| 46 | ), |
| 47 | |
| 48 | TP_fast_assign( |
| 49 | __entry->irq = irq; |
| 50 | __assign_str(name, action->name); |
| 51 | ), |
| 52 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 53 | TP_printk("irq=%d name=%s", __entry->irq, __get_str(name)) |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 54 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 55 | |
Jason Baron | 9ee1983 | 2009-04-30 13:29:47 -0400 | [diff] [blame] | 56 | /** |
| 57 | * irq_handler_exit - called immediately after the irq action handler returns |
| 58 | * @irq: irq number |
| 59 | * @action: pointer to struct irqaction |
| 60 | * @ret: return value |
| 61 | * |
| 62 | * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding |
| 63 | * @action->handler scuccessully handled this irq. Otherwise, the irq might be |
| 64 | * a shared irq line, or the irq was not handled successfully. Can be used in |
| 65 | * conjunction with the irq_handler_entry to understand irq handler latencies. |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 66 | */ |
| 67 | TRACE_EVENT(irq_handler_exit, |
| 68 | |
| 69 | TP_PROTO(int irq, struct irqaction *action, int ret), |
| 70 | |
| 71 | TP_ARGS(irq, action, ret), |
| 72 | |
| 73 | TP_STRUCT__entry( |
| 74 | __field( int, irq ) |
| 75 | __field( int, ret ) |
| 76 | ), |
| 77 | |
| 78 | TP_fast_assign( |
| 79 | __entry->irq = irq; |
| 80 | __entry->ret = ret; |
| 81 | ), |
| 82 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 83 | TP_printk("irq=%d ret=%s", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 84 | __entry->irq, __entry->ret ? "handled" : "unhandled") |
| 85 | ); |
| 86 | |
Li Zefan | c467307 | 2009-11-26 15:04:31 +0800 | [diff] [blame] | 87 | DECLARE_EVENT_CLASS(softirq, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 88 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 89 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 90 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 91 | TP_ARGS(h, vec), |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 92 | |
| 93 | TP_STRUCT__entry( |
| 94 | __field( int, vec ) |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 95 | ), |
| 96 | |
| 97 | TP_fast_assign( |
Lai Jiangshan | 2bf2160 | 2010-08-23 18:42:48 +0900 | [diff] [blame^] | 98 | if (vec) |
| 99 | __entry->vec = (int)(h - vec); |
| 100 | else |
| 101 | __entry->vec = (int)(long)h; |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 102 | ), |
| 103 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 104 | TP_printk("vec=%d [action=%s]", __entry->vec, |
Steven Rostedt | c2adae0 | 2009-05-20 19:56:19 -0400 | [diff] [blame] | 105 | show_softirq_name(__entry->vec)) |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 106 | ); |
| 107 | |
Jason Baron | 9ee1983 | 2009-04-30 13:29:47 -0400 | [diff] [blame] | 108 | /** |
Li Zefan | c467307 | 2009-11-26 15:04:31 +0800 | [diff] [blame] | 109 | * softirq_entry - called immediately before the softirq handler |
| 110 | * @h: pointer to struct softirq_action |
| 111 | * @vec: pointer to first struct softirq_action in softirq_vec array |
| 112 | * |
| 113 | * The @h parameter, contains a pointer to the struct softirq_action |
| 114 | * which has a pointer to the action handler that is called. By subtracting |
| 115 | * the @vec pointer from the @h pointer, we can determine the softirq |
| 116 | * number. Also, when used in combination with the softirq_exit tracepoint |
| 117 | * we can determine the softirq latency. |
| 118 | */ |
| 119 | DEFINE_EVENT(softirq, softirq_entry, |
| 120 | |
| 121 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), |
| 122 | |
| 123 | TP_ARGS(h, vec) |
| 124 | ); |
| 125 | |
| 126 | /** |
Jason Baron | 9ee1983 | 2009-04-30 13:29:47 -0400 | [diff] [blame] | 127 | * softirq_exit - called immediately after the softirq handler returns |
| 128 | * @h: pointer to struct softirq_action |
| 129 | * @vec: pointer to first struct softirq_action in softirq_vec array |
| 130 | * |
| 131 | * The @h parameter contains a pointer to the struct softirq_action |
| 132 | * that has handled the softirq. By subtracting the @vec pointer from |
| 133 | * the @h pointer, we can determine the softirq number. Also, when used in |
| 134 | * combination with the softirq_entry tracepoint we can determine the softirq |
| 135 | * latency. |
| 136 | */ |
Li Zefan | c467307 | 2009-11-26 15:04:31 +0800 | [diff] [blame] | 137 | DEFINE_EVENT(softirq, softirq_exit, |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 138 | |
| 139 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), |
| 140 | |
Li Zefan | c467307 | 2009-11-26 15:04:31 +0800 | [diff] [blame] | 141 | TP_ARGS(h, vec) |
Steven Rostedt | 160031b | 2009-04-24 11:26:55 -0400 | [diff] [blame] | 142 | ); |
Jason Baron | af39241 | 2009-02-26 10:11:05 -0500 | [diff] [blame] | 143 | |
Lai Jiangshan | 2bf2160 | 2010-08-23 18:42:48 +0900 | [diff] [blame^] | 144 | /** |
| 145 | * softirq_raise - called immediately when a softirq is raised |
| 146 | * @h: pointer to struct softirq_action |
| 147 | * @vec: pointer to first struct softirq_action in softirq_vec array |
| 148 | * |
| 149 | * The @h parameter contains a pointer to the softirq vector number which is |
| 150 | * raised. @vec is NULL and it means @h includes vector number not |
| 151 | * softirq_action. When used in combination with the softirq_entry tracepoint |
| 152 | * we can determine the softirq raise latency. |
| 153 | */ |
| 154 | DEFINE_EVENT(softirq, softirq_raise, |
| 155 | |
| 156 | TP_PROTO(struct softirq_action *h, struct softirq_action *vec), |
| 157 | |
| 158 | TP_ARGS(h, vec) |
| 159 | ); |
| 160 | |
Steven Rostedt | a8d154b | 2009-04-10 09:36:00 -0400 | [diff] [blame] | 161 | #endif /* _TRACE_IRQ_H */ |
| 162 | |
| 163 | /* This part must be outside protection */ |
| 164 | #include <trace/define_trace.h> |