irq.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. __field(void*, handler)
  39. ),
  40. TP_fast_assign(
  41. __entry->irq = irq;
  42. __assign_str(name, action->name);
  43. __entry->handler = action->handler;
  44. ),
  45. TP_printk("irq=%d name=%s handler=%pf",
  46. __entry->irq, __get_str(name), __entry->handler)
  47. );
  48. /**
  49. * irq_handler_exit - called immediately after the irq action handler returns
  50. * @irq: irq number
  51. * @action: pointer to struct irqaction
  52. * @ret: return value
  53. *
  54. * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
  55. * @action->handler scuccessully handled this irq. Otherwise, the irq might be
  56. * a shared irq line, or the irq was not handled successfully. Can be used in
  57. * conjunction with the irq_handler_entry to understand irq handler latencies.
  58. */
  59. TRACE_EVENT(irq_handler_exit,
  60. TP_PROTO(int irq, struct irqaction *action, int ret),
  61. TP_ARGS(irq, action, ret),
  62. TP_STRUCT__entry(
  63. __field( int, irq )
  64. __field( int, ret )
  65. ),
  66. TP_fast_assign(
  67. __entry->irq = irq;
  68. __entry->ret = ret;
  69. ),
  70. TP_printk("irq=%d ret=%s",
  71. __entry->irq, __entry->ret ? "handled" : "unhandled")
  72. );
  73. DECLARE_EVENT_CLASS(softirq,
  74. TP_PROTO(unsigned int vec_nr),
  75. TP_ARGS(vec_nr),
  76. TP_STRUCT__entry(
  77. __field( unsigned int, vec )
  78. ),
  79. TP_fast_assign(
  80. __entry->vec = vec_nr;
  81. ),
  82. TP_printk("vec=%u [action=%s]", __entry->vec,
  83. show_softirq_name(__entry->vec))
  84. );
  85. /**
  86. * softirq_entry - called immediately before the softirq handler
  87. * @vec_nr: softirq vector number
  88. *
  89. * When used in combination with the softirq_exit tracepoint
  90. * we can determine the softirq handler runtine.
  91. */
  92. DEFINE_EVENT(softirq, softirq_entry,
  93. TP_PROTO(unsigned int vec_nr),
  94. TP_ARGS(vec_nr)
  95. );
  96. /**
  97. * softirq_exit - called immediately after the softirq handler returns
  98. * @vec_nr: softirq vector number
  99. *
  100. * When used in combination with the softirq_entry tracepoint
  101. * we can determine the softirq handler runtine.
  102. */
  103. DEFINE_EVENT(softirq, softirq_exit,
  104. TP_PROTO(unsigned int vec_nr),
  105. TP_ARGS(vec_nr)
  106. );
  107. /**
  108. * softirq_raise - called immediately when a softirq is raised
  109. * @vec_nr: softirq vector number
  110. *
  111. * When used in combination with the softirq_entry tracepoint
  112. * we can determine the softirq raise to run latency.
  113. */
  114. DEFINE_EVENT(softirq, softirq_raise,
  115. TP_PROTO(unsigned int vec_nr),
  116. TP_ARGS(vec_nr)
  117. );
  118. #endif /* _TRACE_IRQ_H */
  119. /* This part must be outside protection */
  120. #include <trace/define_trace.h>