mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 23/25] tracing: Make ftrace_trace_stack() depend on general trace_array flag
Date: Thu, 01 Oct 2015 07:55:47 -0400	[thread overview]
Message-ID: <20151001115639.869281620@goodmis.org> (raw)
In-Reply-To: <20151001115524.066462793@goodmis.org>

[-- Attachment #1: 0023-tracing-Make-ftrace_trace_stack-depend-on-general-tr.patch --]
[-- Type: text/plain, Size: 4758 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

In preparation for the multi buffer instances to have their own trace_flags,
the check in ftrace_trace_stack() needs to test the trace_array descriptor
flag that is for the current event, not the global_trace descriptor.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c        | 23 +++++++++++++----------
 kernel/trace/trace_events.c |  6 +++---
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5f481887e98b..51697b41f5d4 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -482,7 +482,8 @@ static inline void trace_access_lock_init(void)
 static void __ftrace_trace_stack(struct ring_buffer *buffer,
 				 unsigned long flags,
 				 int skip, int pc, struct pt_regs *regs);
-static inline void ftrace_trace_stack(struct ring_buffer *buffer,
+static inline void ftrace_trace_stack(struct trace_array *tr,
+				      struct ring_buffer *buffer,
 				      unsigned long flags,
 				      int skip, int pc, struct pt_regs *regs);
 
@@ -492,7 +493,8 @@ static inline void __ftrace_trace_stack(struct ring_buffer *buffer,
 					int skip, int pc, struct pt_regs *regs)
 {
 }
-static inline void ftrace_trace_stack(struct ring_buffer *buffer,
+static inline void ftrace_trace_stack(struct trace_array *tr,
+				      struct ring_buffer *buffer,
 				      unsigned long flags,
 				      int skip, int pc, struct pt_regs *regs)
 {
@@ -574,7 +576,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
 		entry->buf[size] = '\0';
 
 	__buffer_unlock_commit(buffer, event);
-	ftrace_trace_stack(buffer, irq_flags, 4, pc, NULL);
+	ftrace_trace_stack(&global_trace, buffer, irq_flags, 4, pc, NULL);
 
 	return size;
 }
@@ -614,7 +616,7 @@ int __trace_bputs(unsigned long ip, const char *str)
 	entry->str			= str;
 
 	__buffer_unlock_commit(buffer, event);
-	ftrace_trace_stack(buffer, irq_flags, 4, pc, NULL);
+	ftrace_trace_stack(&global_trace, buffer, irq_flags, 4, pc, NULL);
 
 	return 1;
 }
@@ -1691,7 +1693,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr,
 {
 	__buffer_unlock_commit(buffer, event);
 
-	ftrace_trace_stack(buffer, flags, 6, pc, NULL);
+	ftrace_trace_stack(tr, buffer, flags, 6, pc, NULL);
 	ftrace_trace_userstack(buffer, flags, pc);
 }
 EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit);
@@ -1743,7 +1745,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr,
 {
 	__buffer_unlock_commit(buffer, event);
 
-	ftrace_trace_stack(buffer, flags, 6, pc, regs);
+	ftrace_trace_stack(tr, buffer, flags, 6, pc, regs);
 	ftrace_trace_userstack(buffer, flags, pc);
 }
 EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit_regs);
@@ -1872,11 +1874,12 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer,
 
 }
 
-static inline void ftrace_trace_stack(struct ring_buffer *buffer,
+static inline void ftrace_trace_stack(struct trace_array *tr,
+				      struct ring_buffer *buffer,
 				      unsigned long flags,
 				      int skip, int pc, struct pt_regs *regs)
 {
-	if (!(global_trace.trace_flags & TRACE_ITER_STACKTRACE))
+	if (!(tr->trace_flags & TRACE_ITER_STACKTRACE))
 		return;
 
 	__ftrace_trace_stack(buffer, flags, skip, pc, regs);
@@ -2164,7 +2167,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
 	memcpy(entry->buf, tbuffer, sizeof(u32) * len);
 	if (!call_filter_check_discard(call, entry, buffer, event)) {
 		__buffer_unlock_commit(buffer, event);
-		ftrace_trace_stack(buffer, flags, 6, pc, NULL);
+		ftrace_trace_stack(tr, buffer, flags, 6, pc, NULL);
 	}
 
 out:
@@ -2216,7 +2219,7 @@ __trace_array_vprintk(struct ring_buffer *buffer,
 	memcpy(&entry->buf, tbuffer, len + 1);
 	if (!call_filter_check_discard(call, entry, buffer, event)) {
 		__buffer_unlock_commit(buffer, event);
-		ftrace_trace_stack(buffer, flags, 6, pc, NULL);
+		ftrace_trace_stack(&global_trace, buffer, flags, 6, pc, NULL);
 	}
  out:
 	preempt_enable_notrace();
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 0f394112a0a7..57c9e709772c 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2941,15 +2941,15 @@ static struct ftrace_ops trace_ops __initdata  =
 static __init void event_trace_self_test_with_function(void)
 {
 	int ret;
+	event_tr = top_trace_array();
+	if (WARN_ON(!event_tr))
+		return;
 	ret = register_ftrace_function(&trace_ops);
 	if (WARN_ON(ret < 0)) {
 		pr_info("Failed to enable function tracer for event tests\n");
 		return;
 	}
 	pr_info("Running tests again, along with the function tracer\n");
-	event_tr = top_trace_array();
-	if (WARN_ON(!event_tr))
-		return;
 	event_trace_self_tests();
 	unregister_ftrace_function(&trace_ops);
 }
-- 
2.5.1



  parent reply	other threads:[~2015-10-01 11:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 11:55 [for-next][PATCH 00/25] tracing: Have instances have their own options + clean ups Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 01/25] kernel/trace_probe: is_good_name can be boolean Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 02/25] tracing: Move non perf code out of perf.h Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 03/25] tracing: Remove ftrace_trace_stack_regs() Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 04/25] tracing: Remove unused function trace_current_buffer_lock_reserve() Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 05/25] tracing: Pass trace_array into trace_buffer_unlock_commit() Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 06/25] tracing: Make ftrace_trace_stack() static Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 07/25] tracing: Inject seq_print_userip_objs() into its only user Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 08/25] tracing: Turn seq_print_user_ip() into a static function Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 09/25] tracing: Move "display-graph" option to main options Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 10/25] tracing: Remove unused tracing option "ftrace_preempt" Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 11/25] tracing: Use enums instead of hard coded bitmasks for TRACE_ITER flags Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 12/25] tracing: Use TRACE_FLAGS macro to keep enums and strings matched Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 13/25] tracing: Only create function graph options when it is compiled in Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 14/25] tracing: Only create branch tracer options when " Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 15/25] tracing: Do not create function tracer options when not " Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 16/25] tracing: Only create stacktrace option when STACKTRACE is configured Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 17/25] tracing: Always show all tracer options in the options directory Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 18/25] tracing: Add build bug if we have more trace_flags than bits Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 19/25] tracing: Remove access to trace_flags in trace_printk.c Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 20/25] tracing: Move sleep-time and graph-time options out of the core trace_flags Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 21/25] tracing: Move trace_flags from global to a trace_array field Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 22/25] tracing: Add a method to pass in trace_array descriptor to option files Steven Rostedt
2015-10-01 11:55 ` Steven Rostedt [this message]
2015-10-01 11:55 ` [for-next][PATCH 24/25] tracing: Add trace options for core options to instances Steven Rostedt
2015-10-01 11:55 ` [for-next][PATCH 25/25] tracing: Add trace options for tracer " Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151001115639.869281620@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®