ipi.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM ipi
  4. #if !defined(_TRACE_IPI_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_IPI_H
  6. #include <linux/tracepoint.h>
  7. TRACE_EVENT(ipi_send_cpu,
  8. TP_PROTO(const unsigned int cpu, unsigned long callsite, void *callback),
  9. TP_ARGS(cpu, callsite, callback),
  10. TP_STRUCT__entry(
  11. __field(unsigned int, cpu)
  12. __field(void *, callsite)
  13. __field(void *, callback)
  14. ),
  15. TP_fast_assign(
  16. __entry->cpu = cpu;
  17. __entry->callsite = (void *)callsite;
  18. __entry->callback = callback;
  19. ),
  20. TP_printk("cpu=%u callsite=%pS callback=%pS",
  21. __entry->cpu, __entry->callsite, __entry->callback)
  22. );
  23. TRACE_EVENT(ipi_send_cpumask,
  24. TP_PROTO(const struct cpumask *cpumask, unsigned long callsite, void *callback),
  25. TP_ARGS(cpumask, callsite, callback),
  26. TP_STRUCT__entry(
  27. __cpumask(cpumask)
  28. __field(void *, callsite)
  29. __field(void *, callback)
  30. ),
  31. TP_fast_assign(
  32. __assign_cpumask(cpumask, cpumask_bits(cpumask));
  33. __entry->callsite = (void *)callsite;
  34. __entry->callback = callback;
  35. ),
  36. TP_printk("cpumask=%s callsite=%pS callback=%pS",
  37. __get_cpumask(cpumask), __entry->callsite, __entry->callback)
  38. );
  39. #ifdef CONFIG_HAVE_EXTRA_IPI_TRACEPOINTS
  40. /**
  41. * ipi_raise - called when a smp cross call is made
  42. *
  43. * @mask: mask of recipient CPUs for the IPI
  44. * @reason: string identifying the IPI purpose
  45. *
  46. * It is necessary for @reason to be a static string declared with
  47. * __tracepoint_string.
  48. */
  49. TRACE_EVENT(ipi_raise,
  50. TP_PROTO(const struct cpumask *mask, const char *reason),
  51. TP_ARGS(mask, reason),
  52. TP_STRUCT__entry(
  53. __bitmask(target_cpus, nr_cpumask_bits)
  54. __field(const char *, reason)
  55. ),
  56. TP_fast_assign(
  57. __assign_bitmask(target_cpus, cpumask_bits(mask), nr_cpumask_bits);
  58. __entry->reason = reason;
  59. ),
  60. TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason)
  61. );
  62. DECLARE_EVENT_CLASS(ipi_handler,
  63. TP_PROTO(const char *reason),
  64. TP_ARGS(reason),
  65. TP_STRUCT__entry(
  66. __field(const char *, reason)
  67. ),
  68. TP_fast_assign(
  69. __entry->reason = reason;
  70. ),
  71. TP_printk("(%s)", __entry->reason)
  72. );
  73. /**
  74. * ipi_entry - called immediately before the IPI handler
  75. *
  76. * @reason: string identifying the IPI purpose
  77. *
  78. * It is necessary for @reason to be a static string declared with
  79. * __tracepoint_string, ideally the same as used with trace_ipi_raise
  80. * for that IPI.
  81. */
  82. DEFINE_EVENT(ipi_handler, ipi_entry,
  83. TP_PROTO(const char *reason),
  84. TP_ARGS(reason)
  85. );
  86. /**
  87. * ipi_exit - called immediately after the IPI handler returns
  88. *
  89. * @reason: string identifying the IPI purpose
  90. *
  91. * It is necessary for @reason to be a static string declared with
  92. * __tracepoint_string, ideally the same as used with trace_ipi_raise for
  93. * that IPI.
  94. */
  95. DEFINE_EVENT(ipi_handler, ipi_exit,
  96. TP_PROTO(const char *reason),
  97. TP_ARGS(reason)
  98. );
  99. #endif /* CONFIG_HAVE_EXTRA_IPI_TRACEPOINTS */
  100. #endif /* _TRACE_IPI_H */
  101. /* This part must be outside protection */
  102. #include <trace/define_trace.h>