irq.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM irq
  3. #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_IRQ_H
  5. #include <linux/tracepoint.h>
  6. #include <linux/interrupt.h>
  7. #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
  8. #define show_softirq_name(val) \
  9. __print_symbolic(val, \
  10. softirq_name(HI), \
  11. softirq_name(TIMER), \
  12. softirq_name(NET_TX), \
  13. softirq_name(NET_RX), \
  14. softirq_name(BLOCK), \
  15. softirq_name(BLOCK_IOPOLL), \
  16. softirq_name(TASKLET), \
  17. softirq_name(SCHED), \
  18. softirq_name(HRTIMER), \
  19. softirq_name(RCU))
  20. /**
  21. * irq_handler_entry - called immediately before the irq action handler
  22. * @irq: irq number
  23. * @action: pointer to struct irqaction
  24. *
  25. * The struct irqaction pointed to by @action contains various
  26. * information about the handler, including the device name,
  27. * @action->name, and the device id, @action->dev_id. When used in
  28. * conjunction with the irq_handler_exit tracepoint, we can figure
  29. * out irq handler latencies.
  30. */
  31. TRACE_EVENT(irq_handler_entry,
  32. TP_PROTO(int irq, struct irqaction *action),
  33. TP_ARGS(irq, action),
  34. TP_STRUCT__entry(
  35. __field( int, irq )
  36. __string( name, action->name )
  37. ),
  38. TP_fast_assign(
  39. __entry->irq = irq;
  40. __assign_str(name, action->name);
  41. ),
  42. TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
  43. );
  44. /**
  45. * irq_handler_exit - called immediately after the irq action handler returns
  46. * @irq: irq number
  47. * @action: pointer to struct irqaction
  48. * @ret: return value
  49. *
  50. * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
  51. * @action->handler scuccessully handled this irq. Otherwise, the irq might be
  52. * a shared irq line, or the irq was not handled successfully. Can be used in
  53. * conjunction with the irq_handler_entry to understand irq handler latencies.
  54. */
  55. TRACE_EVENT(irq_handler_exit,
  56. TP_PROTO(int irq, struct irqaction *action, int ret),
  57. TP_ARGS(irq, action, ret),
  58. TP_STRUCT__entry(
  59. __field( int, irq )
  60. __field( int, ret )
  61. ),
  62. TP_fast_assign(
  63. __entry->irq = irq;
  64. __entry->ret = ret;
  65. ),
  66. TP_printk("irq=%d ret=%s",
  67. __entry->irq, __entry->ret ? "handled" : "unhandled")
  68. );
  69. DECLARE_EVENT_CLASS(softirq,
  70. TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
  71. TP_ARGS(h, vec),
  72. TP_STRUCT__entry(
  73. __field( int, vec )
  74. ),
  75. TP_fast_assign(
  76. __entry->vec = (int)(h - vec);
  77. ),
  78. TP_printk("vec=%d [action=%s]", __entry->vec,
  79. show_softirq_name(__entry->vec))
  80. );
  81. /**
  82. * softirq_entry - called immediately before the softirq handler
  83. * @h: pointer to struct softirq_action
  84. * @vec: pointer to first struct softirq_action in softirq_vec array
  85. *
  86. * The @h parameter, contains a pointer to the struct softirq_action
  87. * which has a pointer to the action handler that is called. By subtracting
  88. * the @vec pointer from the @h pointer, we can determine the softirq
  89. * number. Also, when used in combination with the softirq_exit tracepoint
  90. * we can determine the softirq latency.
  91. */
  92. DEFINE_EVENT(softirq, softirq_entry,
  93. TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
  94. TP_ARGS(h, vec)
  95. );
  96. /**
  97. * softirq_exit - called immediately after the softirq handler returns
  98. * @h: pointer to struct softirq_action
  99. * @vec: pointer to first struct softirq_action in softirq_vec array
  100. *
  101. * The @h parameter contains a pointer to the struct softirq_action
  102. * that has handled the softirq. By subtracting the @vec pointer from
  103. * the @h pointer, we can determine the softirq number. Also, when used in
  104. * combination with the softirq_entry tracepoint we can determine the softirq
  105. * latency.
  106. */
  107. DEFINE_EVENT(softirq, softirq_exit,
  108. TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
  109. TP_ARGS(h, vec)
  110. );
  111. #endif /* _TRACE_IRQ_H */
  112. /* This part must be outside protection */
  113. #include <trace/define_trace.h>