[PATCH] ftrace: Print a message when the rcu checker is disabled

From: Steven Rostedt (Red Hat)
Date: Tue Sep 03 2013 - 20:47:59 EST


Let the user know that the RCU safety checker for function tracing
has been disabled. The checker only runs when the user specifically
configures it in the kernel, and this is done to search for locations
in the kernel that may be unsafe for a function trace callback to
use rcu_read_lock()s. But if things like function graph tracing is
started, which can live lock the machine when the checker is running,
it is disabled. It would be nice if the kernel let the user know that
the checker is disabled, and when it is re-enabled again.

As the checker only gets disabled and re-enabled by user actions
(starting and stoping the function graph tracer or the irqsoff tracer)
it is fine to have a printk display that it is disabled or not.

Suggested-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/trace/trace_functions.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 0883069..dd59827 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -569,6 +569,8 @@ void ftrace_unsafe_rcu_checker_disable(void)
atomic_inc(&ftrace_unsafe_rcu_disabled);
/* Make sure the update is seen immediately */
smp_wmb();
+ pr_info("Disabled FTRACE RCU checker (%pS)\n",
+ __builtin_return_address(0));
}

void ftrace_unsafe_rcu_checker_enable(void)
@@ -576,6 +578,8 @@ void ftrace_unsafe_rcu_checker_enable(void)
atomic_dec(&ftrace_unsafe_rcu_disabled);
/* Make sure the update is seen immediately */
smp_wmb();
+ pr_info("Enabled FTRACE RCU checker (%pS)\n",
+ __builtin_return_address(0));
}

static DEFINE_PER_CPU(unsigned long, ftrace_rcu_func);
--
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/