tracing: Fix userstacktrace option for instances
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 4 Dec 2020 21:36:16 +0000 (16:36 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Dec 2020 12:25:03 +0000 (13:25 +0100)
commit bcee5278958802b40ee8b26679155a6d9231783e upstream.

When the instances were able to use their own options, the userstacktrace
option was left hardcoded for the top level. This made the instance
userstacktrace option bascially into a nop, and will confuse users that set
it, but nothing happens (I was confused when it happened to me!)

Cc: stable@vger.kernel.org
Fixes: 16270145ce6b ("tracing: Add trace options for core options to instances")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/trace.c
kernel/trace/trace.h

index c3cc6aaa6f79d8f1667db70297b91f84d06918d0..d6f1e305bb3dbd26ca8f79c9fb783a6870093384 100644 (file)
@@ -2416,7 +2416,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr,
         * two. They are not that meaningful.
         */
        ftrace_trace_stack(tr, buffer, flags, regs ? 0 : STACK_SKIP, pc, regs);
-       ftrace_trace_userstack(buffer, flags, pc);
+       ftrace_trace_userstack(tr, buffer, flags, pc);
 }
 
 /*
@@ -2736,14 +2736,15 @@ void trace_dump_stack(int skip)
 static DEFINE_PER_CPU(int, user_stack_count);
 
 void
-ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
+ftrace_trace_userstack(struct trace_array *tr,
+                      struct ring_buffer *buffer, unsigned long flags, int pc)
 {
        struct trace_event_call *call = &event_user_stack;
        struct ring_buffer_event *event;
        struct userstack_entry *entry;
        struct stack_trace trace;
 
-       if (!(global_trace.trace_flags & TRACE_ITER_USERSTACKTRACE))
+       if (!(tr->trace_flags & TRACE_ITER_USERSTACKTRACE))
                return;
 
        /*
index 01475411fd1b289d7da712c7affe358f783c8f85..afaeef6c15b306733c5028ae4f3087958f2ef041 100644 (file)
@@ -745,13 +745,15 @@ void update_max_tr_single(struct trace_array *tr,
 #endif /* CONFIG_TRACER_MAX_TRACE */
 
 #ifdef CONFIG_STACKTRACE
-void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags,
+void ftrace_trace_userstack(struct trace_array *tr,
+                           struct ring_buffer *buffer, unsigned long flags,
                            int pc);
 
 void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
                   int pc);
 #else
-static inline void ftrace_trace_userstack(struct ring_buffer *buffer,
+static inline void ftrace_trace_userstack(struct trace_array *tr,
+                                         struct ring_buffer *buffer,
                                          unsigned long flags, int pc)
 {
 }