Re: [RFC][PATCH 13/18 v2] ftrace: Disable the RCU unsafe checkerwhen irqsoff is enabled
From: Paul E. McKenney
Date: Sat Aug 31 2013 - 15:58:44 EST
On Sat, Aug 31, 2013 at 01:11:30AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
>
> The irqsoff tracer can be called during some of the RCU unsafe
> regions. The proble is that some of the internal calls that it
s/proble/problem/
> makes may also be traced. For example, it uses spin locks. But if
> the spin lock gets traced and the RCU unsafe checker runs, it will
> trigger that RCU is not safe to use. But the only reason a spin lock
> is being used in an RCU unsafe region is because the irqsoff trace
> uses it, and causes a false positive.
>
> Disable the unsafe RCU checker when irqsoff is enabled.
>
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Looks like a good compromise, as did the previous one involving the
function graph tracer. Again, though, should we do something to
indicate that RCU safety checks have been disabled?
Thanx, Paul
> ---
> kernel/trace/trace_irqsoff.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
> index 2aefbee..62d603c 100644
> --- a/kernel/trace/trace_irqsoff.c
> +++ b/kernel/trace/trace_irqsoff.c
> @@ -584,9 +584,14 @@ static int start_irqsoff_tracer(struct trace_array *tr, int graph)
>
> ret = register_irqsoff_function(graph, 0);
>
> - if (!ret && tracing_is_enabled())
> + if (!ret && tracing_is_enabled()) {
> + /*
> + * irqsoff tracer can cause unsafe rcu checker
> + * to have false positives.
> + */
> + ftrace_unsafe_rcu_checker_disable();
> tracer_enabled = 1;
> - else
> + } else
> tracer_enabled = 0;
>
> return ret;
> @@ -594,6 +599,9 @@ static int start_irqsoff_tracer(struct trace_array *tr, int graph)
>
> static void stop_irqsoff_tracer(struct trace_array *tr, int graph)
> {
> + if (tracer_enabled)
> + ftrace_unsafe_rcu_checker_enable();
> +
> tracer_enabled = 0;
>
> unregister_irqsoff_function(graph);
> @@ -630,11 +638,15 @@ static void irqsoff_tracer_reset(struct trace_array *tr)
>
> static void irqsoff_tracer_start(struct trace_array *tr)
> {
> + if (!tracer_enabled)
> + ftrace_unsafe_rcu_checker_disable();
> tracer_enabled = 1;
> }
>
> static void irqsoff_tracer_stop(struct trace_array *tr)
> {
> + if (tracer_enabled)
> + ftrace_unsafe_rcu_checker_enable();
> tracer_enabled = 0;
> }
>
> --
> 1.7.10.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/