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