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