public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] [GIT PULL] for tip/tracing/core
@ 2009-04-06 16:37 Steven Rostedt
  2009-04-06 16:37 ` [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer Steven Rostedt
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton


Ingo,

These are the same patches I sent out earlier, but I rebased them to
tip/tracing/core. I also changed my S-o-B to be rostedt@goodmis.org since
I prefer email going to that address instead.

-- Steve

Please pull the latest tip/tracing/core tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/core


Frederic Weisbecker (2):
      tracing/ftrace: fix missing include string.h
      tracing/ftrace: factorize the tracing files creation

Huang Weiyi (1):
      tracing, x86: remove duplicated #include

Lai Jiangshan (1):
      tracing: fix incorrect return type of ns2usecs() V2

Li Zefan (1):
      tracing: use macros to denote usec and nsec per second

Steven Rostedt (3):
      tracing: remove CALLER_ADDR2 from wakeup tracer
      function-graph: add proper initialization for init task
      function-graph: use int instead of atomic for ftrace_graph_active

Zhaolei (2):
      ftrace: Add check of sched_stopped for probe_sched_wakeup
      ftrace: Clean up enable logic for sched_switch

----
 arch/x86/kernel/ftrace.c           |    1 -
 include/linux/ftrace.h             |    8 ++-
 include/linux/init_task.h          |    2 +
 kernel/trace/ftrace.c              |   53 ++++--------
 kernel/trace/ring_buffer.c         |    7 +-
 kernel/trace/trace.c               |  163 ++++++++++++++----------------------
 kernel/trace/trace.h               |    8 ++-
 kernel/trace/trace_boot.c          |    5 +-
 kernel/trace/trace_event_profile.c |    3 +-
 kernel/trace/trace_mmiotrace.c     |    6 +-
 kernel/trace/trace_output.c        |    2 +-
 kernel/trace/trace_printk.c        |    6 +-
 kernel/trace/trace_sched_switch.c  |   11 ++-
 kernel/trace/trace_sched_wakeup.c  |    8 ++-
 kernel/trace/trace_stack.c         |   13 +--
 kernel/trace/trace_sysprof.c       |    6 +-
 16 files changed, 128 insertions(+), 174 deletions(-)


-- 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 02/10] tracing: use macros to denote usec and nsec per second Steven Rostedt
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

[-- Attachment #1: 0001-tracing-remove-CALLER_ADDR2-from-wakeup-tracer.patch --]
[-- Type: text/plain, Size: 2922 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Maneesh Soni was getting a crash when running the wakeup tracer.
We debugged it down to the recording of the function with the
CALLER_ADDR2 macro.  This is used to get the location of the caller
to schedule.

But the problem comes when schedule is called by assmebly. In the case
that Maneesh had, retint_careful would call schedule. But retint_careful
does not set up a proper frame pointer. CALLER_ADDR2 is defined as
__builtin_return_address(2). This produces the following assembly in
the wakeup tracer code.

   mov    0x0(%rbp),%rcx  <--- get the frame pointer of the caller
   mov    %r14d,%r8d
   mov    0xf2de8e(%rip),%rdi

   mov    0x8(%rcx),%rsi  <-- this is __builtin_return_address(1)
   mov    0x28(%rdi,%rax,8),%rbx

   mov    (%rcx),%rax  <-- get the frame pointer of the caller's caller
   mov    %r12,%rcx
   mov    0x8(%rax),%rdx <-- this is __builtin_return_address(2)

At the reading of 0x8(%rax) Maneesh's machine would take a fault.
The reason is that retint_careful did not set up the return address
and the content of %rax here was zero.

To verify this, I sent Maneesh a patch to create a frame pointer
in retint_careful. He ran the test again but this time he would take
the same type of fault from sysret_careful. The retint_careful was no
longer an issue, but there are other callers that still have issues.

Instead of adding frame pointers for all callers to schedule (in possibly
all archs), it is much safer to simply not use CALLER_ADDR2. This
loses out on knowing what called schedule, but the function tracer
will help there if needed.

Reported-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_sched_wakeup.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index 3c5ad6b..5bc00e8 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -154,7 +154,7 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev,
 	if (unlikely(!tracer_enabled || next != wakeup_task))
 		goto out_unlock;
 
-	trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc);
+	trace_function(wakeup_trace, CALLER_ADDR0, CALLER_ADDR1, flags, pc);
 	tracing_sched_switch_trace(wakeup_trace, prev, next, flags, pc);
 
 	/*
@@ -257,6 +257,12 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
 	data = wakeup_trace->data[wakeup_cpu];
 	data->preempt_timestamp = ftrace_now(cpu);
 	tracing_sched_wakeup_trace(wakeup_trace, p, current, flags, pc);
+
+	/*
+	 * We must be careful in using CALLER_ADDR2. But since wake_up
+	 * is not called by an assembly function  (where as schedule is)
+	 * it should be safe to use it here.
+	 */
 	trace_function(wakeup_trace, CALLER_ADDR1, CALLER_ADDR2, flags, pc);
 
 out_locked:
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/10] tracing: use macros to denote usec and nsec per second
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
  2009-04-06 16:37 ` [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2 Steven Rostedt
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Li Zefan, Frederic Weisbecker

[-- Attachment #1: 0002-tracing-use-macros-to-denote-usec-and-nsec-per-seco.patch --]
[-- Type: text/plain, Size: 2554 bytes --]

From: Li Zefan <lizf@cn.fujitsu.com>

Impact: cleanup

Use USEC_PER_SEC and NSEC_PER_SEC instead of 1000000 and 1000000000.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <49CC7870.9000309@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_boot.c      |    5 +++--
 kernel/trace/trace_mmiotrace.c |    6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index 7a30fc4..a29ef23 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -9,6 +9,7 @@
 #include <linux/debugfs.h>
 #include <linux/ftrace.h>
 #include <linux/kallsyms.h>
+#include <linux/time.h>
 
 #include "trace.h"
 #include "trace_output.h"
@@ -67,7 +68,7 @@ initcall_call_print_line(struct trace_iterator *iter)
 	trace_assign_type(field, entry);
 	call = &field->boot_call;
 	ts = iter->ts;
-	nsec_rem = do_div(ts, 1000000000);
+	nsec_rem = do_div(ts, NSEC_PER_SEC);
 
 	ret = trace_seq_printf(s, "[%5ld.%09ld] calling  %s @ %i\n",
 			(unsigned long)ts, nsec_rem, call->func, call->caller);
@@ -92,7 +93,7 @@ initcall_ret_print_line(struct trace_iterator *iter)
 	trace_assign_type(field, entry);
 	init_ret = &field->boot_ret;
 	ts = iter->ts;
-	nsec_rem = do_div(ts, 1000000000);
+	nsec_rem = do_div(ts, NSEC_PER_SEC);
 
 	ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s "
 			"returned %d after %llu msecs\n",
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index 8e37fcd..d53b45e 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -9,6 +9,8 @@
 #include <linux/kernel.h>
 #include <linux/mmiotrace.h>
 #include <linux/pci.h>
+#include <linux/time.h>
+
 #include <asm/atomic.h>
 
 #include "trace.h"
@@ -174,7 +176,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter)
 	struct mmiotrace_rw *rw;
 	struct trace_seq *s	= &iter->seq;
 	unsigned long long t	= ns2usecs(iter->ts);
-	unsigned long usec_rem	= do_div(t, 1000000ULL);
+	unsigned long usec_rem	= do_div(t, USEC_PER_SEC);
 	unsigned secs		= (unsigned long)t;
 	int ret = 1;
 
@@ -221,7 +223,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter)
 	struct mmiotrace_map *m;
 	struct trace_seq *s	= &iter->seq;
 	unsigned long long t	= ns2usecs(iter->ts);
-	unsigned long usec_rem	= do_div(t, 1000000ULL);
+	unsigned long usec_rem	= do_div(t, USEC_PER_SEC);
 	unsigned secs		= (unsigned long)t;
 	int ret;
 
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
  2009-04-06 16:37 ` [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer Steven Rostedt
  2009-04-06 16:37 ` [PATCH 02/10] tracing: use macros to denote usec and nsec per second Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 04/10] tracing/ftrace: fix missing include string.h Steven Rostedt
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Lai Jiangshan, Frederic Weisbecker

[-- Attachment #1: 0003-tracing-fix-incorrect-return-type-of-ns2usecs-V2.patch --]
[-- Type: text/plain, Size: 2883 bytes --]

From: Lai Jiangshan <laijs@cn.fujitsu.com>

Impact: fix time output bug in 32bits system

ns2usecs() returns 'long', it's incorrect.

(In i386)
...
          <idle>-0     [000]   521.442100: _spin_lock <-tick_do_update_jiffies64
          <idle>-0     [000]   521.442101: do_timer <-tick_do_update_jiffies64
          <idle>-0     [000]   521.442102: update_wall_time <-do_timer
          <idle>-0     [000]   521.442102: update_xtime_cache <-update_wall_time
....
(It always print the time less than 2200 seconds besides ...)
Because 'long' is 32bits in i386. ( (1<<31) useconds is about 2200 seconds)

...
          <idle>-0     [001] 4154502640.134759: rcu_bh_qsctr_inc <-__do_softirq
          <idle>-0     [001] 4154502640.134760: _local_bh_enable <-__do_softirq
          <idle>-0     [001] 4154502640.134761: idle_cpu <-irq_exit
...
(very large value)
Because 'long' is a signed type and it is 32bits in i386.

Changed from V1:
return 'unsigned long long' instead of 'cycle_t'

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
LKML-Reference: <49D05D10.4030009@cn.fujitsu.com>
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c        |    3 +--
 kernel/trace/trace.h        |    2 +-
 kernel/trace/trace_output.c |    2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2a81dec..5232201 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -147,8 +147,7 @@ static int __init set_ftrace_dump_on_oops(char *str)
 }
 __setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops);
 
-long
-ns2usecs(cycle_t nsec)
+unsigned long long ns2usecs(cycle_t nsec)
 {
 	nsec += 500;
 	do_div(nsec, 1000);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index fec6521..47aa6d0 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -602,7 +602,7 @@ extern int trace_selftest_startup_branch(struct tracer *trace,
 #endif /* CONFIG_FTRACE_STARTUP_TEST */
 
 extern void *head_page(struct trace_array_cpu *data);
-extern long ns2usecs(cycle_t nsec);
+extern unsigned long long ns2usecs(cycle_t nsec);
 extern int
 trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
 extern int
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index aeac358..0e70fb0 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -433,7 +433,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
 
 		trace_find_cmdline(entry->pid, comm);
 
-		ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]"
+		ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08llx]"
 				       " %ld.%03ldms (+%ld.%03ldms): ", comm,
 				       entry->pid, iter->cpu, entry->flags,
 				       entry->preempt_count, iter->idx,
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/10] tracing/ftrace: fix missing include string.h
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (2 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2 Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 05/10] tracing/ftrace: factorize the tracing files creation Steven Rostedt
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker

[-- Attachment #1: 0004-tracing-ftrace-fix-missing-include-string.h.patch --]
[-- Type: text/plain, Size: 913 bytes --]

From: Frederic Weisbecker <fweisbec@gmail.com>

Building a kernel with tracing can raise the following warning on
tip/master:

kernel/trace/trace.c:1249: error: implicit declaration of function 'vbin_printf'

We are missing an include to string.h

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1238160130-7437-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5232201..6f15d85 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -30,6 +30,7 @@
 #include <linux/percpu.h>
 #include <linux/splice.h>
 #include <linux/kdebug.h>
+#include <linux/string.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
 #include <linux/poll.h>
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/10] tracing/ftrace: factorize the tracing files creation
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (3 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 04/10] tracing/ftrace: fix missing include string.h Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-07 12:23   ` Ingo Molnar
  2009-04-06 16:37 ` [PATCH 06/10] function-graph: add proper initialization for init task Steven Rostedt
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker

[-- Attachment #1: 0005-tracing-ftrace-factorize-the-tracing-files-creation.patch --]
[-- Type: text/plain, Size: 15038 bytes --]

From: Frederic Weisbecker <fweisbec@gmail.com>

Impact: cleanup

Most of the tracing files creation follow the same pattern:

ret = debugfs_create_file(...)
if (!ret)
	pr_warning("Couldn't create ... entry\n")

Unify it!

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1238109938-11840-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c              |   39 ++-------
 kernel/trace/ring_buffer.c         |    7 +-
 kernel/trace/trace.c               |  159 ++++++++++++++----------------------
 kernel/trace/trace.h               |    6 ++
 kernel/trace/trace_event_profile.c |    3 +-
 kernel/trace/trace_printk.c        |    6 +-
 kernel/trace/trace_stack.c         |   13 +--
 kernel/trace/trace_sysprof.c       |    6 +-
 8 files changed, 88 insertions(+), 151 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 678e3d6..6ea5a1a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2698,38 +2698,23 @@ static const struct file_operations ftrace_graph_fops = {
 
 static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
 {
-	struct dentry *entry;
 
-	entry = debugfs_create_file("available_filter_functions", 0444,
-				    d_tracer, NULL, &ftrace_avail_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'available_filter_functions' entry\n");
+	trace_create_file("available_filter_functions", 0444,
+			d_tracer, NULL, &ftrace_avail_fops);
 
-	entry = debugfs_create_file("failures", 0444,
-				    d_tracer, NULL, &ftrace_failures_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'failures' entry\n");
+	trace_create_file("failures", 0444,
+			d_tracer, NULL, &ftrace_failures_fops);
 
-	entry = debugfs_create_file("set_ftrace_filter", 0644, d_tracer,
-				    NULL, &ftrace_filter_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'set_ftrace_filter' entry\n");
+	trace_create_file("set_ftrace_filter", 0644, d_tracer,
+			NULL, &ftrace_filter_fops);
 
-	entry = debugfs_create_file("set_ftrace_notrace", 0644, d_tracer,
+	trace_create_file("set_ftrace_notrace", 0644, d_tracer,
 				    NULL, &ftrace_notrace_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'set_ftrace_notrace' entry\n");
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
-	entry = debugfs_create_file("set_graph_function", 0444, d_tracer,
+	trace_create_file("set_graph_function", 0444, d_tracer,
 				    NULL,
 				    &ftrace_graph_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'set_graph_function' entry\n");
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 
 	return 0;
@@ -2987,7 +2972,6 @@ static const struct file_operations ftrace_pid_fops = {
 static __init int ftrace_init_debugfs(void)
 {
 	struct dentry *d_tracer;
-	struct dentry *entry;
 
 	d_tracer = tracing_init_dentry();
 	if (!d_tracer)
@@ -2995,11 +2979,8 @@ static __init int ftrace_init_debugfs(void)
 
 	ftrace_init_dyn_debugfs(d_tracer);
 
-	entry = debugfs_create_file("set_ftrace_pid", 0644, d_tracer,
-				    NULL, &ftrace_pid_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'set_ftrace_pid' entry\n");
+	trace_create_file("set_ftrace_pid", 0644, d_tracer,
+			    NULL, &ftrace_pid_fops);
 
 	ftrace_profile_debugfs(d_tracer);
 
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 960cbf4..74a1180 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2845,14 +2845,11 @@ static const struct file_operations rb_simple_fops = {
 static __init int rb_init_debugfs(void)
 {
 	struct dentry *d_tracer;
-	struct dentry *entry;
 
 	d_tracer = tracing_init_dentry();
 
-	entry = debugfs_create_file("tracing_on", 0644, d_tracer,
-				    &ring_buffer_flags, &rb_simple_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'tracing_on' entry\n");
+	trace_create_file("tracing_on", 0644, d_tracer,
+			    &ring_buffer_flags, &rb_simple_fops);
 
 	return 0;
 }
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 6f15d85..d64a162 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3570,7 +3570,7 @@ struct dentry *tracing_dentry_percpu(void)
 static void tracing_init_debugfs_percpu(long cpu)
 {
 	struct dentry *d_percpu = tracing_dentry_percpu();
-	struct dentry *entry, *d_cpu;
+	struct dentry *d_cpu;
 	/* strlen(cpu) + MAX(log10(cpu)) + '\0' */
 	char cpu_dir[7];
 
@@ -3585,21 +3585,15 @@ static void tracing_init_debugfs_percpu(long cpu)
 	}
 
 	/* per cpu trace_pipe */
-	entry = debugfs_create_file("trace_pipe", 0444, d_cpu,
-				(void *) cpu, &tracing_pipe_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace_pipe' entry\n");
+	trace_create_file("trace_pipe", 0444, d_cpu,
+			(void *) cpu, &tracing_pipe_fops);
 
 	/* per cpu trace */
-	entry = debugfs_create_file("trace", 0644, d_cpu,
-				(void *) cpu, &tracing_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace' entry\n");
+	trace_create_file("trace", 0644, d_cpu,
+			(void *) cpu, &tracing_fops);
 
-	entry = debugfs_create_file("trace_pipe_raw", 0444, d_cpu,
-				    (void *) cpu, &tracing_buffers_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace_pipe_raw' entry\n");
+	trace_create_file("trace_pipe_raw", 0444, d_cpu,
+			(void *) cpu, &tracing_buffers_fops);
 }
 
 #ifdef CONFIG_FTRACE_SELFTEST
@@ -3755,6 +3749,22 @@ static const struct file_operations trace_options_core_fops = {
 	.write = trace_options_core_write,
 };
 
+struct dentry *trace_create_file(const char *name,
+				 mode_t mode,
+				 struct dentry *parent,
+				 void *data,
+				 const struct file_operations *fops)
+{
+	struct dentry *ret;
+
+	ret = debugfs_create_file(name, mode, parent, data, fops);
+	if (!ret)
+		pr_warning("Could not create debugfs '%s' entry\n", name);
+
+	return ret;
+}
+
+
 static struct dentry *trace_options_init_dentry(void)
 {
 	struct dentry *d_tracer;
@@ -3782,7 +3792,6 @@ create_trace_option_file(struct trace_option_dentry *topt,
 			 struct tracer_opt *opt)
 {
 	struct dentry *t_options;
-	struct dentry *entry;
 
 	t_options = trace_options_init_dentry();
 	if (!t_options)
@@ -3791,11 +3800,9 @@ create_trace_option_file(struct trace_option_dentry *topt,
 	topt->flags = flags;
 	topt->opt = opt;
 
-	entry = debugfs_create_file(opt->name, 0644, t_options, topt,
+	topt->entry = trace_create_file(opt->name, 0644, t_options, topt,
 				    &trace_options_fops);
 
-	topt->entry = entry;
-
 }
 
 static struct trace_option_dentry *
@@ -3850,123 +3857,81 @@ static struct dentry *
 create_trace_option_core_file(const char *option, long index)
 {
 	struct dentry *t_options;
-	struct dentry *entry;
 
 	t_options = trace_options_init_dentry();
 	if (!t_options)
 		return NULL;
 
-	entry = debugfs_create_file(option, 0644, t_options, (void *)index,
+	return trace_create_file(option, 0644, t_options, (void *)index,
 				    &trace_options_core_fops);
-
-	return entry;
 }
 
 static __init void create_trace_options_dir(void)
 {
 	struct dentry *t_options;
-	struct dentry *entry;
 	int i;
 
 	t_options = trace_options_init_dentry();
 	if (!t_options)
 		return;
 
-	for (i = 0; trace_options[i]; i++) {
-		entry = create_trace_option_core_file(trace_options[i], i);
-		if (!entry)
-			pr_warning("Could not create debugfs %s entry\n",
-				   trace_options[i]);
-	}
+	for (i = 0; trace_options[i]; i++)
+		create_trace_option_core_file(trace_options[i], i);
 }
 
 static __init int tracer_init_debugfs(void)
 {
 	struct dentry *d_tracer;
-	struct dentry *entry;
 	int cpu;
 
 	d_tracer = tracing_init_dentry();
 
-	entry = debugfs_create_file("tracing_enabled", 0644, d_tracer,
-				    &global_trace, &tracing_ctrl_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'tracing_enabled' entry\n");
+	trace_create_file("tracing_enabled", 0644, d_tracer,
+			&global_trace, &tracing_ctrl_fops);
 
-	entry = debugfs_create_file("trace_options", 0644, d_tracer,
-				    NULL, &tracing_iter_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace_options' entry\n");
+	trace_create_file("trace_options", 0644, d_tracer,
+			NULL, &tracing_iter_fops);
 
-	create_trace_options_dir();
+	trace_create_file("tracing_cpumask", 0644, d_tracer,
+			NULL, &tracing_cpumask_fops);
+
+	trace_create_file("trace", 0644, d_tracer,
+			(void *) TRACE_PIPE_ALL_CPU, &tracing_fops);
+
+	trace_create_file("available_tracers", 0444, d_tracer,
+			&global_trace, &show_traces_fops);
+
+	trace_create_file("current_tracer", 0444, d_tracer,
+			&global_trace, &set_tracer_fops);
+
+	trace_create_file("tracing_max_latency", 0644, d_tracer,
+			&tracing_max_latency, &tracing_max_lat_fops);
+
+	trace_create_file("tracing_thresh", 0644, d_tracer,
+			&tracing_thresh, &tracing_max_lat_fops);
 
-	entry = debugfs_create_file("tracing_cpumask", 0644, d_tracer,
-				    NULL, &tracing_cpumask_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'tracing_cpumask' entry\n");
-
-	entry = debugfs_create_file("trace", 0644, d_tracer,
-				 (void *) TRACE_PIPE_ALL_CPU, &tracing_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'trace' entry\n");
-
-	entry = debugfs_create_file("available_tracers", 0444, d_tracer,
-				    &global_trace, &show_traces_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'available_tracers' entry\n");
-
-	entry = debugfs_create_file("current_tracer", 0444, d_tracer,
-				    &global_trace, &set_tracer_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'current_tracer' entry\n");
-
-	entry = debugfs_create_file("tracing_max_latency", 0644, d_tracer,
-				    &tracing_max_latency,
-				    &tracing_max_lat_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'tracing_max_latency' entry\n");
-
-	entry = debugfs_create_file("tracing_thresh", 0644, d_tracer,
-				    &tracing_thresh, &tracing_max_lat_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'tracing_thresh' entry\n");
-	entry = debugfs_create_file("README", 0644, d_tracer,
-				    NULL, &tracing_readme_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'README' entry\n");
-
-	entry = debugfs_create_file("trace_pipe", 0444, d_tracer,
+	trace_create_file("README", 0644, d_tracer,
+			NULL, &tracing_readme_fops);
+
+	trace_create_file("trace_pipe", 0444, d_tracer,
 			(void *) TRACE_PIPE_ALL_CPU, &tracing_pipe_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'trace_pipe' entry\n");
-
-	entry = debugfs_create_file("buffer_size_kb", 0644, d_tracer,
-				    &global_trace, &tracing_entries_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'buffer_size_kb' entry\n");
-
-	entry = debugfs_create_file("trace_marker", 0220, d_tracer,
-				    NULL, &tracing_mark_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'trace_marker' entry\n");
+
+	trace_create_file("buffer_size_kb", 0644, d_tracer,
+			&global_trace, &tracing_entries_fops);
+
+	trace_create_file("trace_marker", 0220, d_tracer,
+			NULL, &tracing_mark_fops);
 
 #ifdef CONFIG_DYNAMIC_FTRACE
-	entry = debugfs_create_file("dyn_ftrace_total_info", 0444, d_tracer,
-				    &ftrace_update_tot_cnt,
-				    &tracing_dyn_info_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'dyn_ftrace_total_info' entry\n");
+	trace_create_file("dyn_ftrace_total_info", 0444, d_tracer,
+			&ftrace_update_tot_cnt, &tracing_dyn_info_fops);
 #endif
 #ifdef CONFIG_SYSPROF_TRACER
 	init_tracer_sysprof_debugfs(d_tracer);
 #endif
 
+	create_trace_options_dir();
+
 	for_each_tracing_cpu(cpu)
 		tracing_init_debugfs_percpu(cpu);
 
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 47aa6d0..f76a8f8 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -470,6 +470,12 @@ void trace_wake_up(void);
 void tracing_reset(struct trace_array *tr, int cpu);
 void tracing_reset_online_cpus(struct trace_array *tr);
 int tracing_open_generic(struct inode *inode, struct file *filp);
+struct dentry *trace_create_file(const char *name,
+				 mode_t mode,
+				 struct dentry *parent,
+				 void *data,
+				 const struct file_operations *fops);
+
 struct dentry *tracing_init_dentry(void);
 void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
 
diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
index 22cba99..5d84b28 100644
--- a/kernel/trace/trace_event_profile.c
+++ b/kernel/trace/trace_event_profile.c
@@ -6,7 +6,7 @@
  */
 
 #include "trace.h"
-
+#if 0
 int ftrace_profile_enable(int event_id)
 {
 	struct ftrace_event_call *event;
@@ -29,3 +29,4 @@ void ftrace_profile_disable(int event_id)
 	}
 }
 
+#endif
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index eb81556..9bece96 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -245,17 +245,13 @@ static const struct file_operations ftrace_formats_fops = {
 static __init int init_trace_printk_function_export(void)
 {
 	struct dentry *d_tracer;
-	struct dentry *entry;
 
 	d_tracer = tracing_init_dentry();
 	if (!d_tracer)
 		return 0;
 
-	entry = debugfs_create_file("printk_formats", 0444, d_tracer,
+	trace_create_file("printk_formats", 0444, d_tracer,
 				    NULL, &ftrace_formats_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs "
-			   "'printk_formats' entry\n");
 
 	return 0;
 }
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index c750f65..1796f00 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -352,19 +352,14 @@ __setup("stacktrace", enable_stacktrace);
 static __init int stack_trace_init(void)
 {
 	struct dentry *d_tracer;
-	struct dentry *entry;
 
 	d_tracer = tracing_init_dentry();
 
-	entry = debugfs_create_file("stack_max_size", 0644, d_tracer,
-				    &max_stack_size, &stack_max_size_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'stack_max_size' entry\n");
+	trace_create_file("stack_max_size", 0644, d_tracer,
+			&max_stack_size, &stack_max_size_fops);
 
-	entry = debugfs_create_file("stack_trace", 0444, d_tracer,
-				    NULL, &stack_trace_fops);
-	if (!entry)
-		pr_warning("Could not create debugfs 'stack_trace' entry\n");
+	trace_create_file("stack_trace", 0444, d_tracer,
+			NULL, &stack_trace_fops);
 
 	if (stack_tracer_enabled)
 		register_ftrace_function(&trace_ops);
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c
index 91fd19c..e04b76c 100644
--- a/kernel/trace/trace_sysprof.c
+++ b/kernel/trace/trace_sysprof.c
@@ -321,11 +321,7 @@ static const struct file_operations sysprof_sample_fops = {
 
 void init_tracer_sysprof_debugfs(struct dentry *d_tracer)
 {
-	struct dentry *entry;
 
-	entry = debugfs_create_file("sysprof_sample_period", 0644,
+	trace_create_file("sysprof_sample_period", 0644,
 			d_tracer, NULL, &sysprof_sample_fops);
-	if (entry)
-		return;
-	pr_warning("Could not create debugfs 'sysprof_sample_period' entry\n");
 }
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/10] function-graph: add proper initialization for init task
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (4 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 05/10] tracing/ftrace: factorize the tracing files creation Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active Steven Rostedt
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

[-- Attachment #1: 0006-function-graph-add-proper-initialization-for-init-t.patch --]
[-- Type: text/plain, Size: 2474 bytes --]

From: Steven Rostedt <rostedt@goodmis.org>

Impact: fix to crash going to kexec

The init task did not properly initialize the function graph pointers.
Altough these pointers are NULL, they can not be assumed to be NULL
for the init task, and must still be properly initialize.

This usually is not an issue since a problem only arises when a task
exits, and the init tasks do not usually exit. But when doing tests
with kexec, the init tasks do exit, and the bug appears.

This patch properly initializes the init tasks function graph data
structures.

Reported-and-Tested-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <alpine.DEB.2.00.0903252053080.5675@gandalf.stny.rr.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/ftrace.h    |    8 ++++++--
 include/linux/init_task.h |    2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 9e0a8d2..6aea54d 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -356,6 +356,9 @@ struct ftrace_graph_ret {
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 
+/* for init task */
+#define INIT_FTRACE_GRAPH		.ret_stack = NULL
+
 /*
  * Stack of return addresses for functions
  * of a thread.
@@ -429,10 +432,11 @@ static inline void unpause_graph_tracing(void)
 {
 	atomic_dec(&current->tracing_graph_pause);
 }
-#else
+#else /* !CONFIG_FUNCTION_GRAPH_TRACER */
 
 #define __notrace_funcgraph
 #define __irq_entry
+#define INIT_FTRACE_GRAPH
 
 static inline void ftrace_graph_init_task(struct task_struct *t) { }
 static inline void ftrace_graph_exit_task(struct task_struct *t) { }
@@ -444,7 +448,7 @@ static inline int task_curr_ret_stack(struct task_struct *tsk)
 
 static inline void pause_graph_tracing(void) { }
 static inline void unpause_graph_tracing(void) { }
-#endif
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 
 #ifdef CONFIG_TRACING
 #include <linux/sched.h>
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index af1de95..dcfb933 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -5,6 +5,7 @@
 #include <linux/irqflags.h>
 #include <linux/utsname.h>
 #include <linux/lockdep.h>
+#include <linux/ftrace.h>
 #include <linux/ipc.h>
 #include <linux/pid_namespace.h>
 #include <linux/user_namespace.h>
@@ -185,6 +186,7 @@ extern struct cred init_cred;
 	INIT_IDS							\
 	INIT_TRACE_IRQFLAGS						\
 	INIT_LOCKDEP							\
+	INIT_FTRACE_GRAPH						\
 }
 
 
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (5 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 06/10] function-graph: add proper initialization for init task Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 08/10] ftrace: Add check of sched_stopped for probe_sched_wakeup Steven Rostedt
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

[-- Attachment #1: 0007-function-graph-use-int-instead-of-atomic-for-ftrace.patch --]
[-- Type: text/plain, Size: 2318 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Impact: cleanup

The variable ftrace_graph_active is only modified under the
ftrace_lock mutex, thus an atomic is not necessary for modification.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 6ea5a1a..8e6a0b5 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3092,7 +3092,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 
-static atomic_t ftrace_graph_active;
+static int ftrace_graph_active;
 static struct notifier_block ftrace_suspend_notifier;
 
 int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
@@ -3244,7 +3244,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
 	mutex_lock(&ftrace_lock);
 
 	/* we currently allow only one tracer registered at a time */
-	if (atomic_read(&ftrace_graph_active)) {
+	if (ftrace_graph_active) {
 		ret = -EBUSY;
 		goto out;
 	}
@@ -3252,10 +3252,10 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
 	ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call;
 	register_pm_notifier(&ftrace_suspend_notifier);
 
-	atomic_inc(&ftrace_graph_active);
+	ftrace_graph_active++;
 	ret = start_graph_tracing();
 	if (ret) {
-		atomic_dec(&ftrace_graph_active);
+		ftrace_graph_active--;
 		goto out;
 	}
 
@@ -3273,10 +3273,10 @@ void unregister_ftrace_graph(void)
 {
 	mutex_lock(&ftrace_lock);
 
-	if (!unlikely(atomic_read(&ftrace_graph_active)))
+	if (unlikely(!ftrace_graph_active))
 		goto out;
 
-	atomic_dec(&ftrace_graph_active);
+	ftrace_graph_active--;
 	unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
 	ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
 	ftrace_graph_entry = ftrace_graph_entry_stub;
@@ -3290,7 +3290,7 @@ void unregister_ftrace_graph(void)
 /* Allocate a return stack for newly created task */
 void ftrace_graph_init_task(struct task_struct *t)
 {
-	if (atomic_read(&ftrace_graph_active)) {
+	if (ftrace_graph_active) {
 		t->ret_stack = kmalloc(FTRACE_RETFUNC_DEPTH
 				* sizeof(struct ftrace_ret_stack),
 				GFP_KERNEL);
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/10] ftrace: Add check of sched_stopped for probe_sched_wakeup
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (6 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 09/10] ftrace: Clean up enable logic for sched_switch Steven Rostedt
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Zhao Lei

[-- Attachment #1: 0008-ftrace-Add-check-of-sched_stopped-for-probe_sched_w.patch --]
[-- Type: text/plain, Size: 962 bytes --]

From: Zhaolei <zhaolei@cn.fujitsu.com>

The wakeup tracing in sched_switch does not stop when a user
disables tracing. This is because the probe_sched_wakeup() is missing
the check to prevent the wakeup from being traced.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
LKML-Reference: <49D1C543.3010307@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_sched_switch.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index de35f20..9117cea 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -62,6 +62,9 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success)
 	pc = preempt_count();
 	tracing_record_cmdline(current);
 
+	if (sched_stopped)
+		return;
+
 	local_irq_save(flags);
 	cpu = raw_smp_processor_id();
 	data = ctx_trace->data[cpu];
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/10] ftrace: Clean up enable logic for sched_switch
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (7 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 08/10] ftrace: Add check of sched_stopped for probe_sched_wakeup Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-06 16:37 ` [PATCH 10/10] tracing, x86: remove duplicated #include Steven Rostedt
  2009-04-07 11:56 ` [PATCH 00/10] [GIT PULL] for tip/tracing/core Ingo Molnar
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Zhao Lei

[-- Attachment #1: 0009-ftrace-Clean-up-enable-logic-for-sched_switch.patch --]
[-- Type: text/plain, Size: 1483 bytes --]

From: Zhaolei <zhaolei@cn.fujitsu.com>

Unify sched_switch and sched_wakeup's action to following logic:
Do record_cmdline when start_cmdline_record() is called.
Start tracing events when the tracer is started.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
LKML-Reference: <49D1C596.5050203@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_sched_switch.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 9117cea..9d8cccd 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -29,13 +29,13 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
 	int cpu;
 	int pc;
 
-	if (!sched_ref || sched_stopped)
+	if (unlikely(!sched_ref))
 		return;
 
 	tracing_record_cmdline(prev);
 	tracing_record_cmdline(next);
 
-	if (!tracer_enabled)
+	if (!tracer_enabled || sched_stopped)
 		return;
 
 	pc = preempt_count();
@@ -56,15 +56,15 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success)
 	unsigned long flags;
 	int cpu, pc;
 
-	if (!likely(tracer_enabled))
+	if (unlikely(!sched_ref))
 		return;
 
-	pc = preempt_count();
 	tracing_record_cmdline(current);
 
-	if (sched_stopped)
+	if (!tracer_enabled || sched_stopped)
 		return;
 
+	pc = preempt_count();
 	local_irq_save(flags);
 	cpu = raw_smp_processor_id();
 	data = ctx_trace->data[cpu];
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/10] tracing, x86: remove duplicated #include
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (8 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 09/10] ftrace: Clean up enable logic for sched_switch Steven Rostedt
@ 2009-04-06 16:37 ` Steven Rostedt
  2009-04-07 11:56 ` [PATCH 00/10] [GIT PULL] for tip/tracing/core Ingo Molnar
  10 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-06 16:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Huang Weiyi

[-- Attachment #1: 0010-tracing-x86-remove-duplicated-include.patch --]
[-- Type: text/plain, Size: 688 bytes --]

From: Huang Weiyi <weiyi.huang@gmail.com>

Remove duplicated #include in arch/x86/kernel/ftrace.c.

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
LKML-Reference: <1238503291-2532-1-git-send-email-weiyi.huang@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/ftrace.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 61df775..70a10ca 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -20,7 +20,6 @@
 
 #include <asm/cacheflush.h>
 #include <asm/ftrace.h>
-#include <linux/ftrace.h>
 #include <asm/nops.h>
 #include <asm/nmi.h>
 
-- 
1.6.2.1

-- 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 00/10] [GIT PULL] for tip/tracing/core
  2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
                   ` (9 preceding siblings ...)
  2009-04-06 16:37 ` [PATCH 10/10] tracing, x86: remove duplicated #include Steven Rostedt
@ 2009-04-07 11:56 ` Ingo Molnar
  10 siblings, 0 replies; 14+ messages in thread
From: Ingo Molnar @ 2009-04-07 11:56 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Andrew Morton


* Steven Rostedt <rostedt@goodmis.org> wrote:

> Ingo,
> 
> These are the same patches I sent out earlier, but I rebased them 
> to tip/tracing/core. I also changed my S-o-B to be 
> rostedt@goodmis.org since I prefer email going to that address 
> instead.
> 
> -- Steve
> 
> Please pull the latest tip/tracing/core tree, which can be found at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> tip/tracing/core
> 
> 
> Frederic Weisbecker (2):
>       tracing/ftrace: fix missing include string.h
>       tracing/ftrace: factorize the tracing files creation
> 
> Huang Weiyi (1):
>       tracing, x86: remove duplicated #include
> 
> Lai Jiangshan (1):
>       tracing: fix incorrect return type of ns2usecs() V2
> 
> Li Zefan (1):
>       tracing: use macros to denote usec and nsec per second
> 
> Steven Rostedt (3):
>       tracing: remove CALLER_ADDR2 from wakeup tracer
>       function-graph: add proper initialization for init task
>       function-graph: use int instead of atomic for ftrace_graph_active
> 
> Zhaolei (2):
>       ftrace: Add check of sched_stopped for probe_sched_wakeup
>       ftrace: Clean up enable logic for sched_switch
> 
> ----
>  arch/x86/kernel/ftrace.c           |    1 -
>  include/linux/ftrace.h             |    8 ++-
>  include/linux/init_task.h          |    2 +
>  kernel/trace/ftrace.c              |   53 ++++--------
>  kernel/trace/ring_buffer.c         |    7 +-
>  kernel/trace/trace.c               |  163 ++++++++++++++----------------------
>  kernel/trace/trace.h               |    8 ++-
>  kernel/trace/trace_boot.c          |    5 +-
>  kernel/trace/trace_event_profile.c |    3 +-
>  kernel/trace/trace_mmiotrace.c     |    6 +-
>  kernel/trace/trace_output.c        |    2 +-
>  kernel/trace/trace_printk.c        |    6 +-
>  kernel/trace/trace_sched_switch.c  |   11 ++-
>  kernel/trace/trace_sched_wakeup.c  |    8 ++-
>  kernel/trace/trace_stack.c         |   13 +--
>  kernel/trace/trace_sysprof.c       |    6 +-
>  16 files changed, 128 insertions(+), 174 deletions(-)

Pulled, thanks Steve!

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 05/10] tracing/ftrace: factorize the tracing files creation
  2009-04-06 16:37 ` [PATCH 05/10] tracing/ftrace: factorize the tracing files creation Steven Rostedt
@ 2009-04-07 12:23   ` Ingo Molnar
  2009-04-07 19:19     ` Steven Rostedt
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2009-04-07 12:23 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Andrew Morton, Frederic Weisbecker


* Steven Rostedt <rostedt@goodmis.org> wrote:

> --- a/kernel/trace/trace_event_profile.c
> +++ b/kernel/trace/trace_event_profile.c
> @@ -6,7 +6,7 @@
>   */
>  
>  #include "trace.h"
> -
> +#if 0
>  int ftrace_profile_enable(int event_id)
>  {
>  	struct ftrace_event_call *event;
> @@ -29,3 +29,4 @@ void ftrace_profile_disable(int event_id)
>  	}
>  }
>  
> +#endif

uhm, that's not a very nice to do ;-)

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 05/10] tracing/ftrace: factorize the tracing files creation
  2009-04-07 12:23   ` Ingo Molnar
@ 2009-04-07 19:19     ` Steven Rostedt
  0 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2009-04-07 19:19 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Andrew Morton, Frederic Weisbecker



On Tue, 7 Apr 2009, Ingo Molnar wrote:

> 
> * Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> > --- a/kernel/trace/trace_event_profile.c
> > +++ b/kernel/trace/trace_event_profile.c
> > @@ -6,7 +6,7 @@
> >   */
> >  
> >  #include "trace.h"
> > -
> > +#if 0
> >  int ftrace_profile_enable(int event_id)
> >  {
> >  	struct ftrace_event_call *event;
> > @@ -29,3 +29,4 @@ void ftrace_profile_disable(int event_id)
> >  	}
> >  }
> >  
> > +#endif
> 
> uhm, that's not a very nice to do ;-)

Ug! I mssed that :-p

-- Steve


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-04-07 19:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
2009-04-06 16:37 ` [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer Steven Rostedt
2009-04-06 16:37 ` [PATCH 02/10] tracing: use macros to denote usec and nsec per second Steven Rostedt
2009-04-06 16:37 ` [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2 Steven Rostedt
2009-04-06 16:37 ` [PATCH 04/10] tracing/ftrace: fix missing include string.h Steven Rostedt
2009-04-06 16:37 ` [PATCH 05/10] tracing/ftrace: factorize the tracing files creation Steven Rostedt
2009-04-07 12:23   ` Ingo Molnar
2009-04-07 19:19     ` Steven Rostedt
2009-04-06 16:37 ` [PATCH 06/10] function-graph: add proper initialization for init task Steven Rostedt
2009-04-06 16:37 ` [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active Steven Rostedt
2009-04-06 16:37 ` [PATCH 08/10] ftrace: Add check of sched_stopped for probe_sched_wakeup Steven Rostedt
2009-04-06 16:37 ` [PATCH 09/10] ftrace: Clean up enable logic for sched_switch Steven Rostedt
2009-04-06 16:37 ` [PATCH 10/10] tracing, x86: remove duplicated #include Steven Rostedt
2009-04-07 11:56 ` [PATCH 00/10] [GIT PULL] for tip/tracing/core Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox