irq.h 4.4 KB

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