preemptirq.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifdef CONFIG_PREEMPTIRQ_EVENTS
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM preemptirq
  4. #if !defined(_TRACE_PREEMPTIRQ_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_PREEMPTIRQ_H
  6. #include <linux/ktime.h>
  7. #include <linux/tracepoint.h>
  8. #include <linux/string.h>
  9. #include <asm/sections.h>
  10. DECLARE_EVENT_CLASS(preemptirq_template,
  11. TP_PROTO(unsigned long ip, unsigned long parent_ip),
  12. TP_ARGS(ip, parent_ip),
  13. TP_STRUCT__entry(
  14. __field(u32, caller_offs)
  15. __field(u32, parent_offs)
  16. ),
  17. TP_fast_assign(
  18. __entry->caller_offs = (u32)(ip - (unsigned long)_stext);
  19. __entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext);
  20. ),
  21. TP_printk("caller=%pF parent=%pF",
  22. (void *)((unsigned long)(_stext) + __entry->caller_offs),
  23. (void *)((unsigned long)(_stext) + __entry->parent_offs))
  24. );
  25. #ifndef CONFIG_PROVE_LOCKING
  26. DEFINE_EVENT(preemptirq_template, irq_disable,
  27. TP_PROTO(unsigned long ip, unsigned long parent_ip),
  28. TP_ARGS(ip, parent_ip));
  29. DEFINE_EVENT(preemptirq_template, irq_enable,
  30. TP_PROTO(unsigned long ip, unsigned long parent_ip),
  31. TP_ARGS(ip, parent_ip));
  32. #endif
  33. #ifdef CONFIG_DEBUG_PREEMPT
  34. DEFINE_EVENT(preemptirq_template, preempt_disable,
  35. TP_PROTO(unsigned long ip, unsigned long parent_ip),
  36. TP_ARGS(ip, parent_ip));
  37. DEFINE_EVENT(preemptirq_template, preempt_enable,
  38. TP_PROTO(unsigned long ip, unsigned long parent_ip),
  39. TP_ARGS(ip, parent_ip));
  40. #endif
  41. TRACE_EVENT(irqs_disable,
  42. TP_PROTO(u64 delta, unsigned long caddr0, unsigned long caddr1,
  43. unsigned long caddr2, unsigned long caddr3),
  44. TP_ARGS(delta, caddr0, caddr1, caddr2, caddr3),
  45. TP_STRUCT__entry(
  46. __field(u64, delta)
  47. __field(void*, caddr0)
  48. __field(void*, caddr1)
  49. __field(void*, caddr2)
  50. __field(void*, caddr3)
  51. ),
  52. TP_fast_assign(
  53. __entry->delta = delta;
  54. __entry->caddr0 = (void *)caddr0;
  55. __entry->caddr1 = (void *)caddr1;
  56. __entry->caddr2 = (void *)caddr2;
  57. __entry->caddr3 = (void *)caddr3;
  58. ),
  59. TP_printk("delta=%llu(ns) Callers:(%pf<-%pf<-%pf<-%pf)", __entry->delta,
  60. __entry->caddr0, __entry->caddr1,
  61. __entry->caddr2, __entry->caddr3)
  62. );
  63. #endif /* _TRACE_PREEMPTIRQ_H */
  64. #include <trace/define_trace.h>
  65. #endif /* !CONFIG_PREEMPTIRQ_EVENTS */
  66. #if !defined(CONFIG_PREEMPTIRQ_EVENTS) || defined(CONFIG_PROVE_LOCKING)
  67. #define trace_irq_enable(...)
  68. #define trace_irq_disable(...)
  69. #define trace_irq_enable_rcuidle(...)
  70. #define trace_irq_disable_rcuidle(...)
  71. #endif
  72. #if !defined(CONFIG_PREEMPTIRQ_EVENTS) || !defined(CONFIG_DEBUG_PREEMPT)
  73. #define trace_preempt_enable(...)
  74. #define trace_preempt_disable(...)
  75. #define trace_preempt_enable_rcuidle(...)
  76. #define trace_preempt_disable_rcuidle(...)
  77. #endif