irq.h 3.8 KB

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