xref: /openbmc/linux/include/trace/events/ipi.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2f6d9804dSNicolas Pitre #undef TRACE_SYSTEM
3f6d9804dSNicolas Pitre #define TRACE_SYSTEM ipi
4f6d9804dSNicolas Pitre 
5f6d9804dSNicolas Pitre #if !defined(_TRACE_IPI_H) || defined(TRACE_HEADER_MULTI_READ)
6f6d9804dSNicolas Pitre #define _TRACE_IPI_H
7f6d9804dSNicolas Pitre 
8f6d9804dSNicolas Pitre #include <linux/tracepoint.h>
9f6d9804dSNicolas Pitre 
10f6d9804dSNicolas Pitre /**
11f6d9804dSNicolas Pitre  * ipi_raise - called when a smp cross call is made
12f6d9804dSNicolas Pitre  *
13f6d9804dSNicolas Pitre  * @mask: mask of recipient CPUs for the IPI
14f6d9804dSNicolas Pitre  * @reason: string identifying the IPI purpose
15f6d9804dSNicolas Pitre  *
16f6d9804dSNicolas Pitre  * It is necessary for @reason to be a static string declared with
17f6d9804dSNicolas Pitre  * __tracepoint_string.
18f6d9804dSNicolas Pitre  */
19f6d9804dSNicolas Pitre TRACE_EVENT(ipi_raise,
20f6d9804dSNicolas Pitre 
21f6d9804dSNicolas Pitre 	TP_PROTO(const struct cpumask *mask, const char *reason),
22f6d9804dSNicolas Pitre 
23f6d9804dSNicolas Pitre 	TP_ARGS(mask, reason),
24f6d9804dSNicolas Pitre 
25f6d9804dSNicolas Pitre 	TP_STRUCT__entry(
26f6d9804dSNicolas Pitre 		__bitmask(target_cpus, nr_cpumask_bits)
27f6d9804dSNicolas Pitre 		__field(const char *, reason)
28f6d9804dSNicolas Pitre 	),
29f6d9804dSNicolas Pitre 
30f6d9804dSNicolas Pitre 	TP_fast_assign(
31f6d9804dSNicolas Pitre 		__assign_bitmask(target_cpus, cpumask_bits(mask), nr_cpumask_bits);
32f6d9804dSNicolas Pitre 		__entry->reason = reason;
33f6d9804dSNicolas Pitre 	),
34f6d9804dSNicolas Pitre 
35f6d9804dSNicolas Pitre 	TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason)
36f6d9804dSNicolas Pitre );
37f6d9804dSNicolas Pitre 
38*68e2d17cSPeter Zijlstra TRACE_EVENT(ipi_send_cpu,
39*68e2d17cSPeter Zijlstra 
40*68e2d17cSPeter Zijlstra 	TP_PROTO(const unsigned int cpu, unsigned long callsite, void *callback),
41*68e2d17cSPeter Zijlstra 
42*68e2d17cSPeter Zijlstra 	TP_ARGS(cpu, callsite, callback),
43*68e2d17cSPeter Zijlstra 
44*68e2d17cSPeter Zijlstra 	TP_STRUCT__entry(
45*68e2d17cSPeter Zijlstra 		__field(unsigned int, cpu)
46*68e2d17cSPeter Zijlstra 		__field(void *, callsite)
47*68e2d17cSPeter Zijlstra 		__field(void *, callback)
48*68e2d17cSPeter Zijlstra 	),
49*68e2d17cSPeter Zijlstra 
50*68e2d17cSPeter Zijlstra 	TP_fast_assign(
51*68e2d17cSPeter Zijlstra 		__entry->cpu = cpu;
52*68e2d17cSPeter Zijlstra 		__entry->callsite = (void *)callsite;
53*68e2d17cSPeter Zijlstra 		__entry->callback = callback;
54*68e2d17cSPeter Zijlstra 	),
55*68e2d17cSPeter Zijlstra 
56*68e2d17cSPeter Zijlstra 	TP_printk("cpu=%u callsite=%pS callback=%pS",
57*68e2d17cSPeter Zijlstra 		  __entry->cpu, __entry->callsite, __entry->callback)
58*68e2d17cSPeter Zijlstra );
59*68e2d17cSPeter Zijlstra 
6056eb0598SValentin Schneider TRACE_EVENT(ipi_send_cpumask,
6156eb0598SValentin Schneider 
6256eb0598SValentin Schneider 	TP_PROTO(const struct cpumask *cpumask, unsigned long callsite, void *callback),
6356eb0598SValentin Schneider 
6456eb0598SValentin Schneider 	TP_ARGS(cpumask, callsite, callback),
6556eb0598SValentin Schneider 
6656eb0598SValentin Schneider 	TP_STRUCT__entry(
6756eb0598SValentin Schneider 		__cpumask(cpumask)
6856eb0598SValentin Schneider 		__field(void *, callsite)
6956eb0598SValentin Schneider 		__field(void *, callback)
7056eb0598SValentin Schneider 	),
7156eb0598SValentin Schneider 
7256eb0598SValentin Schneider 	TP_fast_assign(
7356eb0598SValentin Schneider 		__assign_cpumask(cpumask, cpumask_bits(cpumask));
7456eb0598SValentin Schneider 		__entry->callsite = (void *)callsite;
7556eb0598SValentin Schneider 		__entry->callback = callback;
7656eb0598SValentin Schneider 	),
7756eb0598SValentin Schneider 
7856eb0598SValentin Schneider 	TP_printk("cpumask=%s callsite=%pS callback=%pS",
7956eb0598SValentin Schneider 		  __get_cpumask(cpumask), __entry->callsite, __entry->callback)
8056eb0598SValentin Schneider );
8156eb0598SValentin Schneider 
82f6d9804dSNicolas Pitre DECLARE_EVENT_CLASS(ipi_handler,
83f6d9804dSNicolas Pitre 
84f6d9804dSNicolas Pitre 	TP_PROTO(const char *reason),
85f6d9804dSNicolas Pitre 
86f6d9804dSNicolas Pitre 	TP_ARGS(reason),
87f6d9804dSNicolas Pitre 
88f6d9804dSNicolas Pitre 	TP_STRUCT__entry(
89f6d9804dSNicolas Pitre 		__field(const char *, reason)
90f6d9804dSNicolas Pitre 	),
91f6d9804dSNicolas Pitre 
92f6d9804dSNicolas Pitre 	TP_fast_assign(
93f6d9804dSNicolas Pitre 		__entry->reason = reason;
94f6d9804dSNicolas Pitre 	),
95f6d9804dSNicolas Pitre 
96f6d9804dSNicolas Pitre 	TP_printk("(%s)", __entry->reason)
97f6d9804dSNicolas Pitre );
98f6d9804dSNicolas Pitre 
99f6d9804dSNicolas Pitre /**
100f6d9804dSNicolas Pitre  * ipi_entry - called immediately before the IPI handler
101f6d9804dSNicolas Pitre  *
102f6d9804dSNicolas Pitre  * @reason: string identifying the IPI purpose
103f6d9804dSNicolas Pitre  *
104f6d9804dSNicolas Pitre  * It is necessary for @reason to be a static string declared with
105f6d9804dSNicolas Pitre  * __tracepoint_string, ideally the same as used with trace_ipi_raise
106f6d9804dSNicolas Pitre  * for that IPI.
107f6d9804dSNicolas Pitre  */
108f6d9804dSNicolas Pitre DEFINE_EVENT(ipi_handler, ipi_entry,
109f6d9804dSNicolas Pitre 
110f6d9804dSNicolas Pitre 	TP_PROTO(const char *reason),
111f6d9804dSNicolas Pitre 
112f6d9804dSNicolas Pitre 	TP_ARGS(reason)
113f6d9804dSNicolas Pitre );
114f6d9804dSNicolas Pitre 
115f6d9804dSNicolas Pitre /**
116f6d9804dSNicolas Pitre  * ipi_exit - called immediately after the IPI handler returns
117f6d9804dSNicolas Pitre  *
118f6d9804dSNicolas Pitre  * @reason: string identifying the IPI purpose
119f6d9804dSNicolas Pitre  *
120f6d9804dSNicolas Pitre  * It is necessary for @reason to be a static string declared with
121f6d9804dSNicolas Pitre  * __tracepoint_string, ideally the same as used with trace_ipi_raise for
122f6d9804dSNicolas Pitre  * that IPI.
123f6d9804dSNicolas Pitre  */
124f6d9804dSNicolas Pitre DEFINE_EVENT(ipi_handler, ipi_exit,
125f6d9804dSNicolas Pitre 
126f6d9804dSNicolas Pitre 	TP_PROTO(const char *reason),
127f6d9804dSNicolas Pitre 
128f6d9804dSNicolas Pitre 	TP_ARGS(reason)
129f6d9804dSNicolas Pitre );
130f6d9804dSNicolas Pitre 
131f6d9804dSNicolas Pitre #endif /* _TRACE_IPI_H */
132f6d9804dSNicolas Pitre 
133f6d9804dSNicolas Pitre /* This part must be outside protection */
134f6d9804dSNicolas Pitre #include <trace/define_trace.h>
135