[RFC PATCH 1/5] trace: Add trace_ipi_send_{cpu, cpumask}

From: Valentin Schneider
Date: Fri Oct 07 2022 - 11:46:10 EST


trace_ipi_raise is unsuitable for generically tracing IPI sources; add a
variant of it that takes a callsite and a CPU. Define a macro helper for
handling IPIs sent to multiple CPUs.

Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
---
include/trace/events/ipi.h | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h
index 0be71dad6ec0..fd2f2aeb36fe 100644
--- a/include/trace/events/ipi.h
+++ b/include/trace/events/ipi.h
@@ -35,6 +35,33 @@ TRACE_EVENT(ipi_raise,
TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason)
);

+TRACE_EVENT(ipi_send_cpu,
+
+ TP_PROTO(unsigned long callsite, unsigned int cpu),
+
+ TP_ARGS(callsite, cpu),
+
+ TP_STRUCT__entry(
+ __field(unsigned long, callsite)
+ __field(unsigned int, cpu)
+ ),
+
+ TP_fast_assign(
+ __entry->callsite = callsite;
+ __entry->cpu = cpu;
+ ),
+
+ TP_printk("callsite=%pS target_cpu=%d", (void *)__entry->callsite, __entry->cpu)
+);
+
+#define trace_ipi_send_cpumask(callsite, mask) do { \
+ if (static_key_false(&__tracepoint_ipi_send_cpu.key)) { \
+ int cpu; \
+ for_each_cpu(cpu, mask) \
+ trace_ipi_send_cpu(callsite, cpu); \
+ } \
+} while (0)
+
DECLARE_EVENT_CLASS(ipi_handler,

TP_PROTO(const char *reason),
--
2.31.1