Skip to content

Commit 1603dda

Browse files
Daniel Bristot de Oliveirarostedt
authored andcommitted
tracing/osnoise: Add PANIC_ON_STOP option
Often the latency observed in a CPU is not caused by the work being done in the CPU itself, but by work done on another CPU that causes the hardware to stall all CPUs. In this case, it is interesting to know what is happening on ALL CPUs, and the best way to do this is via crash dump analysis. Add the PANIC_ON_STOP option to osnoise/timerlat tracers. The default behavior is having this option off. When enabled by the user, the system will panic after hitting a stop tracing condition. This option was motivated by a real scenario that Juri Lelli and I were debugging. Link: https://lkml.kernel.org/r/249ce4287c6725543e6db845a6e0df621dc67db5.1670623111.git.bristot@kernel.org Cc: Juri Lelli <[email protected]> Cc: Clark Williams <[email protected]> Cc: Bagas Sanjaya <[email protected]> Cc: Daniel Bristot de Oliveira <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Daniel Bristot de Oliveira <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 0e162c6 commit 1603dda

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kernel/trace/trace_osnoise.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
enum osnoise_options_index {
5555
OSN_DEFAULTS = 0,
5656
OSN_WORKLOAD,
57+
OSN_PANIC_ON_STOP,
5758
OSN_MAX
5859
};
5960

60-
static const char * const osnoise_options_str[OSN_MAX] = { "DEFAULTS", "OSNOISE_WORKLOAD" };
61+
static const char * const osnoise_options_str[OSN_MAX] = { "DEFAULTS", "OSNOISE_WORKLOAD", "PANIC_ON_STOP" };
6162

6263
#define OSN_DEFAULT_OPTIONS 0x2
6364
static unsigned long osnoise_options = OSN_DEFAULT_OPTIONS;
@@ -1270,6 +1271,9 @@ static __always_inline void osnoise_stop_tracing(void)
12701271
trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_,
12711272
"stop tracing hit on cpu %d\n", smp_processor_id());
12721273

1274+
if (test_bit(OSN_PANIC_ON_STOP, &osnoise_options))
1275+
panic("tracer hit stop condition on CPU %d\n", smp_processor_id());
1276+
12731277
tracer_tracing_off(tr);
12741278
}
12751279
rcu_read_unlock();

0 commit comments

Comments
 (0)