]> Pileus Git - ~andy/linux/blobdiff - kernel/trace/ftrace.c
ftrace: Have control op function callback only trace when RCU is watching
[~andy/linux] / kernel / trace / ftrace.c
index 44e826a79665830bbfda0c007322fb39f99b7c57..080b7d41e17f7ce9d4c6aba759a3ae9e2e6e2ab0 100644 (file)
@@ -4388,12 +4388,21 @@ ftrace_ops_control_func(unsigned long ip, unsigned long parent_ip,
         */
        preempt_disable_notrace();
        trace_recursion_set(TRACE_CONTROL_BIT);
+
+       /*
+        * Control funcs (perf) uses RCU. Only trace if
+        * RCU is currently active.
+        */
+       if (!rcu_is_watching())
+               goto out;
+
        do_for_each_ftrace_op(op, ftrace_control_list) {
                if (!(op->flags & FTRACE_OPS_FL_STUB) &&
                    !ftrace_function_local_disabled(op) &&
                    ftrace_ops_test(op, ip, regs))
                        op->func(ip, parent_ip, op, regs);
        } while_for_each_ftrace_op(op);
+ out:
        trace_recursion_clear(TRACE_CONTROL_BIT);
        preempt_enable_notrace();
 }