tracing: Disable tracing on warning
Add a traceoff_on_warning option in both the kernel command line as well as a sysctl option. When set, any WARN*() function that is hit will cause the tracing_on variable to be cleared, which disables writing to the ring buffer. This is useful especially when tracing a bug with function tracing. When a warning is hit, the print caused by the warning can flood the trace with the functions that producing the output for the warning. This can make the resulting trace useless by either hiding where the bug happened, or worse, by overflowing the buffer and losing the trace of the bug totally. Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:

کامیت شده توسط
Steven Rostedt

والد
c3e13c7c06
کامیت
de7edd3145
@@ -115,6 +115,9 @@ cpumask_var_t __read_mostly tracing_buffer_mask;
|
||||
|
||||
enum ftrace_dump_mode ftrace_dump_on_oops;
|
||||
|
||||
/* When set, tracing will stop when a WARN*() is hit */
|
||||
int __disable_trace_on_warning;
|
||||
|
||||
static int tracing_set_tracer(const char *buf);
|
||||
|
||||
#define MAX_TRACER_SIZE 100
|
||||
@@ -149,6 +152,13 @@ static int __init set_ftrace_dump_on_oops(char *str)
|
||||
}
|
||||
__setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops);
|
||||
|
||||
static int __init stop_trace_on_warning(char *str)
|
||||
{
|
||||
__disable_trace_on_warning = 1;
|
||||
return 1;
|
||||
}
|
||||
__setup("traceoff_on_warning=", stop_trace_on_warning);
|
||||
|
||||
static int __init boot_alloc_snapshot(char *str)
|
||||
{
|
||||
allocate_snapshot = true;
|
||||
@@ -170,6 +180,7 @@ static int __init set_trace_boot_options(char *str)
|
||||
}
|
||||
__setup("trace_options=", set_trace_boot_options);
|
||||
|
||||
|
||||
unsigned long long ns2usecs(cycle_t nsec)
|
||||
{
|
||||
nsec += 500;
|
||||
@@ -562,6 +573,12 @@ void tracing_off(void)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tracing_off);
|
||||
|
||||
void disable_trace_on_warning(void)
|
||||
{
|
||||
if (__disable_trace_on_warning)
|
||||
tracing_off();
|
||||
}
|
||||
|
||||
/**
|
||||
* tracing_is_on - show state of ring buffers enabled
|
||||
*/
|
||||
|
مرجع در شماره جدید
Block a user