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@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <srostedt@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 02/10] ftrace: fix boot trace sched startup
Date: Fri, 07 Nov 2008 22:46:07 -0500	[thread overview]
Message-ID: <20081108034748.991813249@goodmis.org> (raw)
In-Reply-To: <20081108034605.289816911@goodmis.org>

[-- Attachment #1: 0002-ftrace-fix-boot-trace-sched-startup.patch --]
[-- Type: text/plain, Size: 3106 bytes --]

Impact: boot tracer startup modified

The boot tracer calls into some of the schedule tracing private functions
that should not be exported. This patch cleans it up, and makes
way for further changes in the ftrace infrastructure.

This patch adds a api to assign a tracer array to the schedule
context switch tracer.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
CC:  Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/trace/trace.h              |    2 +-
 kernel/trace/trace_boot.c         |    9 +++++++--
 kernel/trace/trace_sched_switch.c |   15 ++++++++++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 3422489..db12e16 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -49,7 +49,6 @@ struct ftrace_entry {
 	unsigned long		parent_ip;
 };
 extern struct tracer boot_tracer;
-extern struct tracer sched_switch_trace; /* Used by the boot tracer */
 
 /*
  * Context switch trace entry - which task (and prio) we switched from/to:
@@ -325,6 +324,7 @@ void trace_function(struct trace_array *tr,
 
 void tracing_start_cmdline_record(void);
 void tracing_stop_cmdline_record(void);
+void tracing_cmdline_assign_trace(struct trace_array *tr);
 int register_tracer(struct tracer *type);
 void unregister_tracer(struct tracer *type);
 
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index bd5046c..662cb91 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -39,7 +39,12 @@ void disable_boot_trace(void)
 
 static void reset_boot_trace(struct trace_array *tr)
 {
-	sched_switch_trace.reset(tr);
+	int cpu;
+
+	tr->time_start = ftrace_now(tr->cpu);
+
+	for_each_online_cpu(cpu)
+		tracing_reset(tr, cpu);
 }
 
 static void boot_trace_init(struct trace_array *tr)
@@ -50,7 +55,7 @@ static void boot_trace_init(struct trace_array *tr)
 	for_each_cpu_mask(cpu, cpu_possible_map)
 		tracing_reset(tr, cpu);
 
-	sched_switch_trace.init(tr);
+	tracing_cmdline_assign_trace(tr);
 }
 
 static void boot_trace_ctrl_update(struct trace_array *tr)
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 91c699b..fbf05df 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -152,6 +152,19 @@ void tracing_stop_cmdline_record(void)
 	tracing_stop_sched_switch();
 }
 
+/**
+ * tracing_cmdline_assign_trace - assign a trace array for ctx switch
+ * @tr: trace array pointer to assign
+ *
+ * Some tracers might want to record the context switches in their
+ * trace. This function lets those tracers assign the trace array
+ * to use.
+ */
+void tracing_cmdline_assign_trace(struct trace_array *tr)
+{
+	ctx_trace = tr;
+}
+
 static void start_sched_trace(struct trace_array *tr)
 {
 	sched_switch_reset(tr);
@@ -197,7 +210,7 @@ static void sched_switch_trace_stop(struct trace_array *tr)
 	tracing_stop_sched_switch();
 }
 
-struct tracer sched_switch_trace __read_mostly =
+static struct tracer sched_switch_trace __read_mostly =
 {
 	.name		= "sched_switch",
 	.init		= sched_switch_trace_init,
-- 
1.5.6.5

-- 

  parent reply	other threads:[~2008-11-08  3:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-08  3:46 [PATCH 00/10] ftrace: various updates Steven Rostedt
2008-11-08  3:46 ` [PATCH 01/10] ftrace: fix set_ftrace_filter Steven Rostedt
2008-11-08  3:46 ` Steven Rostedt [this message]
2008-11-08  4:12   ` [PATCH 02/10] ftrace: fix boot trace sched startup Frédéric Weisbecker
2008-11-08 12:17     ` Steven Rostedt
2008-11-08  3:46 ` [PATCH 03/10] ftrace: fix sched_switch API Steven Rostedt
2008-11-08  4:20   ` Frédéric Weisbecker
2008-11-08  3:46 ` [PATCH 04/10] ftrace: irqsoff tracer incorrect reset Steven Rostedt
2008-11-08  3:46 ` [PATCH 05/10] ftrace: enable trace_printk by default Steven Rostedt
2008-11-08  3:46 ` [PATCH 06/10] ftrace: remove ctrl_update method Steven Rostedt
2008-11-08  3:46 ` [PATCH 07/10] ftrace: remove trace array ctrl Steven Rostedt
2008-11-08  3:46 ` [PATCH 08/10] ftrace: Align __mcount_loc sections Steven Rostedt
2008-11-08  3:55   ` Steven Rostedt
2008-11-08  3:46 ` [PATCH 09/10] ftrace: force pass of preemptoff selftest Steven Rostedt
2008-11-08  3:46 ` [PATCH 10/10] ftrace: display start of CPU buffer in trace output Steven Rostedt
2008-11-08  8:42 ` [PATCH 00/10] ftrace: various updates Ingo Molnar

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=20081108034748.991813249@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    /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®