irq.h 3.6 KB

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