irq.h 3.8 KB

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