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