irq.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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(unsigned int vec_nr),
  72. TP_ARGS(vec_nr),
  73. TP_STRUCT__entry(
  74. __field( unsigned int, vec )
  75. ),
  76. TP_fast_assign(
  77. __entry->vec = vec_nr;
  78. ),
  79. TP_printk("vec=%u [action=%s]", __entry->vec,
  80. show_softirq_name(__entry->vec))
  81. );
  82. /**
  83. * softirq_entry - called immediately before the softirq handler
  84. * @vec_nr: softirq vector number
  85. *
  86. * When used in combination with the softirq_exit tracepoint
  87. * we can determine the softirq handler runtine.
  88. */
  89. DEFINE_EVENT(softirq, softirq_entry,
  90. TP_PROTO(unsigned int vec_nr),
  91. TP_ARGS(vec_nr)
  92. );
  93. /**
  94. * softirq_exit - called immediately after the softirq handler returns
  95. * @vec_nr: softirq vector number
  96. *
  97. * When used in combination with the softirq_entry tracepoint
  98. * we can determine the softirq handler runtine.
  99. */
  100. DEFINE_EVENT(softirq, softirq_exit,
  101. TP_PROTO(unsigned int vec_nr),
  102. TP_ARGS(vec_nr)
  103. );
  104. /**
  105. * softirq_raise - called immediately when a softirq is raised
  106. * @vec_nr: softirq vector number
  107. *
  108. * When used in combination with the softirq_entry tracepoint
  109. * we can determine the softirq raise to run latency.
  110. */
  111. DEFINE_EVENT(softirq, softirq_raise,
  112. TP_PROTO(unsigned int vec_nr),
  113. TP_ARGS(vec_nr)
  114. );
  115. #endif /* _TRACE_IRQ_H */
  116. /* This part must be outside protection */
  117. #include <trace/define_trace.h>