[RFC PATCH v2 0/8] Generic IPI sending tracepoint

2022-11-02 Thread Valentin Schneider
Background == Detecting IPI *reception* is relatively easy, e.g. using trace_irq_handler_{entry,exit} or even just function-trace flush_smp_call_function_queue() for SMP calls. Figuring out their *origin*, is trickier as there is no generic tracepoint tied to e.g. smp_call_function():

[RFC PATCH v2 7/8] smp: reword smp call IPI comment

2022-11-02 Thread Valentin Schneider
Accessing the call_single_queue hasn't involved a spinlock since 2014: 6897fc22ea01 ("kernel: use lockless list for smp_call_function_single") The llist operations (namely cmpxchg() and xchg()) provide similar ordering guarantees, update the comment to lessen confusion. Signed-off-by: Valentin

[RFC PATCH v2 8/8] sched, smp: Trace smp callback causing an IPI

2022-11-02 Thread Valentin Schneider
The newly-introduced ipi_send_cpumask tracepoint has a "callback" parameter which so far has only been fed with NULL. While CSD_TYPE_SYNC/ASYNC and CSD_TYPE_IRQ_WORK share a similar backing struct layout (meaning their callback func can be accessed without caring about the actual CSD type), CSD_TY

[RFC PATCH v2 6/8] treewide: Trace IPIs sent via smp_send_reschedule()

2022-11-02 Thread Valentin Schneider
To be able to trace invocations of smp_send_reschedule(), rename the arch-specific definitions of it to arch_smp_send_reschedule() and wrap it into an smp_send_reschedule() that contains a tracepoint. Signed-off-by: Valentin Schneider [csky bits] Acked-by: Guo Ren --- arch/alpha/kernel/smp.c

[RFC PATCH v2 5/8] irq_work: Trace self-IPIs sent via arch_irq_work_raise()

2022-11-02 Thread Valentin Schneider
IPIs sent to remove CPUs via irq_work_queue_on() are now covered by trace_ipi_send_cpumask(), add another instance of the tracepoint to cover self-IPIs. Signed-off-by: Valentin Schneider --- kernel/irq_work.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kern

[RFC PATCH v2 4/8] smp: Trace IPIs sent via arch_send_call_function_ipi_mask()

2022-11-02 Thread Valentin Schneider
This simply wraps around the arch function and prepends it with a tracepoint, similar to send_call_function_single_ipi(). Signed-off-by: Valentin Schneider --- kernel/smp.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/smp.c b/kernel/smp.c index e2ca1e2f31274

[RFC PATCH v2 3/8] sched, smp: Trace IPIs sent via send_call_function_single_ipi()

2022-11-02 Thread Valentin Schneider
send_call_function_single_ipi() is the thing that sends IPIs at the bottom of smp_call_function*() via either generic_exec_single() or smp_call_function_many_cond(). Give it an IPI-related tracepoint. Note that this ends up tracing any IPI sent via __smp_call_single_queue(), which covers __ttwu_qu

[RFC PATCH v2 2/8] trace: Add trace_ipi_send_cpumask()

2022-11-02 Thread Valentin Schneider
trace_ipi_raise() is unsuitable for generically tracing IPI sources due to its "reason" argument being an uninformative string (on arm64 all you get is "Function call interrupts" for SMP calls). Add a variant of it that takes a exports a target CPU, a callsite and a callback. Signed-off-by: Valen

[RFC PATCH v2 1/8] DO-NOT-MERGE: tracing: Add __cpumask to denote a trace event field that is a cpumask_t

2022-11-02 Thread Valentin Schneider
From: "Steven Rostedt (Google)" The trace events have a __bitmask field that can be used for anything that requires bitmasks. Although currently it is only used for CPU masks, it could be used in the future for any type of bitmasks. There is some user space tooling that wants to know if a field