[PATCH] tracing/ipi: Hide ARM specific IPI trace events from other architectures

From: Steven Rostedt
Date: Thu Jun 12 2025 - 09:45:59 EST


From: Steven Rostedt <rostedt@xxxxxxxxxxx>

The IPI trace events ipi_raise, ipi_handler, ipi_entry and ipi_exit are
only used by the arm and arm64 architectures. As each trace event can take
up to 5K in size, regardless if they are used or not, add #ifdef around
these events so that they are only defined for arm and they do not waste
memory in other architectures.

Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
Note, I'll be adding code soon that will make unused events cause a warning.

include/trace/events/ipi.h | 58 ++++++++++++++++++++------------------
1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h
index 3de9bfc982ce..e5c7998f636c 100644
--- a/include/trace/events/ipi.h
+++ b/include/trace/events/ipi.h
@@ -7,34 +7,6 @@

#include <linux/tracepoint.h>

-/**
- * ipi_raise - called when a smp cross call is made
- *
- * @mask: mask of recipient CPUs for the IPI
- * @reason: string identifying the IPI purpose
- *
- * It is necessary for @reason to be a static string declared with
- * __tracepoint_string.
- */
-TRACE_EVENT(ipi_raise,
-
- TP_PROTO(const struct cpumask *mask, const char *reason),
-
- TP_ARGS(mask, reason),
-
- TP_STRUCT__entry(
- __bitmask(target_cpus, nr_cpumask_bits)
- __field(const char *, reason)
- ),
-
- TP_fast_assign(
- __assign_bitmask(target_cpus, cpumask_bits(mask), nr_cpumask_bits);
- __entry->reason = reason;
- ),
-
- TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason)
-);
-
TRACE_EVENT(ipi_send_cpu,

TP_PROTO(const unsigned int cpu, unsigned long callsite, void *callback),
@@ -79,6 +51,35 @@ TRACE_EVENT(ipi_send_cpumask,
__get_cpumask(cpumask), __entry->callsite, __entry->callback)
);

+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
+/**
+ * ipi_raise - called when a smp cross call is made
+ *
+ * @mask: mask of recipient CPUs for the IPI
+ * @reason: string identifying the IPI purpose
+ *
+ * It is necessary for @reason to be a static string declared with
+ * __tracepoint_string.
+ */
+TRACE_EVENT(ipi_raise,
+
+ TP_PROTO(const struct cpumask *mask, const char *reason),
+
+ TP_ARGS(mask, reason),
+
+ TP_STRUCT__entry(
+ __bitmask(target_cpus, nr_cpumask_bits)
+ __field(const char *, reason)
+ ),
+
+ TP_fast_assign(
+ __assign_bitmask(target_cpus, cpumask_bits(mask), nr_cpumask_bits);
+ __entry->reason = reason;
+ ),
+
+ TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason)
+);
+
DECLARE_EVENT_CLASS(ipi_handler,

TP_PROTO(const char *reason),
@@ -127,6 +128,7 @@ DEFINE_EVENT(ipi_handler, ipi_exit,

TP_ARGS(reason)
);
+#endif /* defined(CONFIG_ARM) || defined(CONFIG_ARM64) */

#endif /* _TRACE_IPI_H */

--
2.47.2