public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] tracing updates for 2.6.32
@ 2009-07-18  7:16 Frederic Weisbecker
  2009-07-18  7:16 ` [PATCH 1/4] ring_buffer: Fix warning while ignoring cmpxchg return value Frederic Weisbecker
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-07-18  7:16 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner
  Cc: LKML, Frederic Weisbecker, Steven Rostedt, Lai Jiangshan,
	Xiao Guangrong

Hi Ingo, Thomas,

Here are some fixes and enhancements for the 2.6.32 tracing tree.

Impacts:

- A spurious warning in the lockless ring buffer had been shutdown
- Simplifications of various ftrace code areas resulting in more deletions than
  additions.

These changes have been based against tip:tracing/core

Thanks,

Frederic.


The following changes since commit e202687927c132b1e1ff36b526b5e78ac33de840:
  Ingo Molnar (1):
        Merge branch 'tip/tracing/ring-buffer-3' of git://git.kernel.org/.../rostedt/linux-2.6-trace into tracing/core

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git tracing/core

Lai Jiangshan (1):
      ring_buffer: Fix warning while ignoring cmpxchg return value

Xiao Guangrong (3):
      tracing/function: Simplify __ftrace_replace_code()
      tracing/trace_stack: Cleanup for trace_lookup_stack()
      tracing/function: Cleanup for function tracer

 kernel/trace/ftrace.c          |   89 +++++++++------------------------------
 kernel/trace/ring_buffer.c     |    9 +++-
 kernel/trace/trace_functions.c |    4 +-
 kernel/trace/trace_stack.c     |    9 +----
 4 files changed, 30 insertions(+), 81 deletions(-)

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

* [PATCH 1/4] ring_buffer: Fix warning while ignoring cmpxchg return value
  2009-07-18  7:16 [GIT PULL] tracing updates for 2.6.32 Frederic Weisbecker
@ 2009-07-18  7:16 ` Frederic Weisbecker
  2009-07-18  7:16 ` [PATCH 2/4] tracing/function: Simplify __ftrace_replace_code() Frederic Weisbecker
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-07-18  7:16 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner
  Cc: LKML, Lai Jiangshan, Steven Rostedt, Xiao Guangrong,
	Frederic Weisbecker

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

kernel/trace/ring_buffer.c: In function 'rb_tail_page_update':
kernel/trace/ring_buffer.c:849: warning: value computed is not used
kernel/trace/ring_buffer.c:850: warning: value computed is not used

Add "(void)"s to fix this warning, because we don't need here to handle
the fail case of cmpxchg, it's fine if an interrupt already did the
job.

Changed from V1:
  Add a comment(which is written by Steven) for it.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/trace/ring_buffer.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index e648ba4..51633d7 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -845,9 +845,14 @@ static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,
 		 * This will only succeed if an interrupt did
 		 * not come in and change it. In which case, we
 		 * do not want to modify it.
+		 *
+		 * We add (void) to let the compiler know that we do not care
+		 * about the return value of these functions. We use the
+		 * cmpxchg to only update if an interrupt did not already
+		 * do it for us. If the cmpxchg fails, we don't care.
 		 */
-		local_cmpxchg(&next_page->write, old_write, val);
-		local_cmpxchg(&next_page->entries, old_entries, eval);
+		(void)local_cmpxchg(&next_page->write, old_write, val);
+		(void)local_cmpxchg(&next_page->entries, old_entries, eval);
 
 		/*
 		 * No need to worry about races with clearing out the commit.
-- 
1.6.2.3


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

* [PATCH 2/4] tracing/function: Simplify __ftrace_replace_code()
  2009-07-18  7:16 [GIT PULL] tracing updates for 2.6.32 Frederic Weisbecker
  2009-07-18  7:16 ` [PATCH 1/4] ring_buffer: Fix warning while ignoring cmpxchg return value Frederic Weisbecker
@ 2009-07-18  7:16 ` Frederic Weisbecker
  2009-07-18  7:17 ` [PATCH 3/4] tracing/trace_stack: Cleanup for trace_lookup_stack() Frederic Weisbecker
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-07-18  7:16 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner
  Cc: LKML, Xiao Guangrong, Steven Rostedt, Lai Jiangshan,
	Frederic Weisbecker

From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>

Rewrite the __ftrace_replace_code() function, simplify it, but don't
change the code's logic.

First, we get the state we want to set, if the record has the same
state, then do nothing, otherwise enable/disable it.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/trace/ftrace.c |   72 ++++++++++++------------------------------------
 1 files changed, 18 insertions(+), 54 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index bce9e01..217caec 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1017,71 +1017,35 @@ static int
 __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
 {
 	unsigned long ftrace_addr;
-	unsigned long ip, fl;
+	unsigned long flag = 0UL;
 
 	ftrace_addr = (unsigned long)FTRACE_ADDR;
 
-	ip = rec->ip;
-
 	/*
-	 * If this record is not to be traced and
-	 * it is not enabled then do nothing.
+	 * If this record is not to be traced or we want to disable it,
+	 * then disable it.
 	 *
-	 * If this record is not to be traced and
-	 * it is enabled then disable it.
+	 * If we want to enable it and filtering is off, then enable it.
 	 *
+	 * If we want to enable it and filtering is on, enable it only if
+	 * it's filtered
 	 */
-	if (rec->flags & FTRACE_FL_NOTRACE) {
-		if (rec->flags & FTRACE_FL_ENABLED)
-			rec->flags &= ~FTRACE_FL_ENABLED;
-		else
-			return 0;
-
-	} else if (ftrace_filtered && enable) {
-		/*
-		 * Filtering is on:
-		 */
-
-		fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_ENABLED);
-
-		/* Record is filtered and enabled, do nothing */
-		if (fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED))
-			return 0;
-
-		/* Record is not filtered or enabled, do nothing */
-		if (!fl)
-			return 0;
-
-		/* Record is not filtered but enabled, disable it */
-		if (fl == FTRACE_FL_ENABLED)
-			rec->flags &= ~FTRACE_FL_ENABLED;
-		else
-		/* Otherwise record is filtered but not enabled, enable it */
-			rec->flags |= FTRACE_FL_ENABLED;
-	} else {
-		/* Disable or not filtered */
-
-		if (enable) {
-			/* if record is enabled, do nothing */
-			if (rec->flags & FTRACE_FL_ENABLED)
-				return 0;
-
-			rec->flags |= FTRACE_FL_ENABLED;
-
-		} else {
+	if (enable && !(rec->flags & FTRACE_FL_NOTRACE)) {
+		if (!ftrace_filtered || (rec->flags & FTRACE_FL_FILTER))
+			flag = FTRACE_FL_ENABLED;
+	}
 
-			/* if record is not enabled, do nothing */
-			if (!(rec->flags & FTRACE_FL_ENABLED))
-				return 0;
+	/* If the state of this record hasn't changed, then do nothing */
+	if ((rec->flags & FTRACE_FL_ENABLED) == flag)
+		return 0;
 
-			rec->flags &= ~FTRACE_FL_ENABLED;
-		}
+	if (flag) {
+		rec->flags |= FTRACE_FL_ENABLED;
+		return ftrace_make_call(rec, ftrace_addr);
 	}
 
-	if (rec->flags & FTRACE_FL_ENABLED)
-		return ftrace_make_call(rec, ftrace_addr);
-	else
-		return ftrace_make_nop(NULL, rec, ftrace_addr);
+	rec->flags &= ~FTRACE_FL_ENABLED;
+	return ftrace_make_nop(NULL, rec, ftrace_addr);
 }
 
 static void ftrace_replace_code(int enable)
-- 
1.6.2.3


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

* [PATCH 3/4] tracing/trace_stack: Cleanup for trace_lookup_stack()
  2009-07-18  7:16 [GIT PULL] tracing updates for 2.6.32 Frederic Weisbecker
  2009-07-18  7:16 ` [PATCH 1/4] ring_buffer: Fix warning while ignoring cmpxchg return value Frederic Weisbecker
  2009-07-18  7:16 ` [PATCH 2/4] tracing/function: Simplify __ftrace_replace_code() Frederic Weisbecker
@ 2009-07-18  7:17 ` Frederic Weisbecker
  2009-07-18  7:17 ` [PATCH 4/4] tracing/function: Cleanup for function tracer Frederic Weisbecker
  2009-07-18  8:57 ` [GIT PULL] tracing updates for 2.6.32 Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-07-18  7:17 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner
  Cc: LKML, Xiao Guangrong, Steven Rostedt, Lai Jiangshan,
	Frederic Weisbecker

From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>

We can directly use %pF input format instead of sprint_symbol()
and %s input format.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/trace/trace_stack.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index e644af9..a4dc8d9 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -234,15 +234,8 @@ static void t_stop(struct seq_file *m, void *p)
 static int trace_lookup_stack(struct seq_file *m, long i)
 {
 	unsigned long addr = stack_dump_trace[i];
-#ifdef CONFIG_KALLSYMS
-	char str[KSYM_SYMBOL_LEN];
 
-	sprint_symbol(str, addr);
-
-	return seq_printf(m, "%s\n", str);
-#else
-	return seq_printf(m, "%p\n", (void*)addr);
-#endif
+	return seq_printf(m, "%pF\n", (void *)addr);
 }
 
 static void print_disabled(struct seq_file *m)
-- 
1.6.2.3


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

* [PATCH 4/4] tracing/function: Cleanup for function tracer
  2009-07-18  7:16 [GIT PULL] tracing updates for 2.6.32 Frederic Weisbecker
                   ` (2 preceding siblings ...)
  2009-07-18  7:17 ` [PATCH 3/4] tracing/trace_stack: Cleanup for trace_lookup_stack() Frederic Weisbecker
@ 2009-07-18  7:17 ` Frederic Weisbecker
  2009-07-18  8:57 ` [GIT PULL] tracing updates for 2.6.32 Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2009-07-18  7:17 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner
  Cc: LKML, Xiao Guangrong, Steven Rostedt, Lai Jiangshan,
	Frederic Weisbecker

From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>

We can directly use %pf input format instead of kallsyms_lookup()
and %s input format

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/trace/ftrace.c          |   17 +++--------------
 kernel/trace/trace_functions.c |    4 +---
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 217caec..80a97a5 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1403,18 +1403,13 @@ static int t_hash_show(struct seq_file *m, void *v)
 {
 	struct ftrace_func_probe *rec;
 	struct hlist_node *hnd = v;
-	char str[KSYM_SYMBOL_LEN];
 
 	rec = hlist_entry(hnd, struct ftrace_func_probe, node);
 
 	if (rec->ops->print)
 		return rec->ops->print(m, rec->ip, rec->ops, rec->data);
 
-	kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
-	seq_printf(m, "%s:", str);
-
-	kallsyms_lookup((unsigned long)rec->ops->func, NULL, NULL, NULL, str);
-	seq_printf(m, "%s", str);
+	seq_printf(m, "%pf:%pf", (void *)rec->ip, (void *)rec->ops->func);
 
 	if (rec->data)
 		seq_printf(m, ":%p", rec->data);
@@ -1512,7 +1507,6 @@ static int t_show(struct seq_file *m, void *v)
 {
 	struct ftrace_iterator *iter = m->private;
 	struct dyn_ftrace *rec = v;
-	char str[KSYM_SYMBOL_LEN];
 
 	if (iter->flags & FTRACE_ITER_HASH)
 		return t_hash_show(m, v);
@@ -1525,9 +1519,7 @@ static int t_show(struct seq_file *m, void *v)
 	if (!rec)
 		return 0;
 
-	kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
-
-	seq_printf(m, "%s\n", str);
+	seq_printf(m, "%pf\n", (void *)rec->ip);
 
 	return 0;
 }
@@ -2508,7 +2500,6 @@ static void g_stop(struct seq_file *m, void *p)
 static int g_show(struct seq_file *m, void *v)
 {
 	unsigned long *ptr = v;
-	char str[KSYM_SYMBOL_LEN];
 
 	if (!ptr)
 		return 0;
@@ -2518,9 +2509,7 @@ static int g_show(struct seq_file *m, void *v)
 		return 0;
 	}
 
-	kallsyms_lookup(*ptr, NULL, NULL, NULL, str);
-
-	seq_printf(m, "%s\n", str);
+	seq_printf(m, "%pf\n", v);
 
 	return 0;
 }
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 7402144..b53dc99 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -288,11 +288,9 @@ static int
 ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
 			 struct ftrace_probe_ops *ops, void *data)
 {
-	char str[KSYM_SYMBOL_LEN];
 	long count = (long)data;
 
-	kallsyms_lookup(ip, NULL, NULL, NULL, str);
-	seq_printf(m, "%s:", str);
+	seq_printf(m, "%pf:", (void *)ip);
 
 	if (ops == &traceon_probe_ops)
 		seq_printf(m, "traceon");
-- 
1.6.2.3


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

* Re: [GIT PULL] tracing updates for 2.6.32
  2009-07-18  7:16 [GIT PULL] tracing updates for 2.6.32 Frederic Weisbecker
                   ` (3 preceding siblings ...)
  2009-07-18  7:17 ` [PATCH 4/4] tracing/function: Cleanup for function tracer Frederic Weisbecker
@ 2009-07-18  8:57 ` Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2009-07-18  8:57 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Thomas Gleixner, LKML, Steven Rostedt, Lai Jiangshan,
	Xiao Guangrong


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> Hi Ingo, Thomas,
> 
> Here are some fixes and enhancements for the 2.6.32 tracing tree.
> 
> Impacts:
> 
> - A spurious warning in the lockless ring buffer had been shutdown
> - Simplifications of various ftrace code areas resulting in more deletions than
>   additions.
> 
> These changes have been based against tip:tracing/core
> 
> Thanks,
> 
> Frederic.
> 
> 
> The following changes since commit e202687927c132b1e1ff36b526b5e78ac33de840:
>   Ingo Molnar (1):
>         Merge branch 'tip/tracing/ring-buffer-3' of git://git.kernel.org/.../rostedt/linux-2.6-trace into tracing/core
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git tracing/core
> 
> Lai Jiangshan (1):
>       ring_buffer: Fix warning while ignoring cmpxchg return value
> 
> Xiao Guangrong (3):
>       tracing/function: Simplify __ftrace_replace_code()
>       tracing/trace_stack: Cleanup for trace_lookup_stack()
>       tracing/function: Cleanup for function tracer
> 
>  kernel/trace/ftrace.c          |   89 +++++++++------------------------------
>  kernel/trace/ring_buffer.c     |    9 +++-
>  kernel/trace/trace_functions.c |    4 +-
>  kernel/trace/trace_stack.c     |    9 +----
>  4 files changed, 30 insertions(+), 81 deletions(-)

Pulled, thanks a lot Frederic!

	Ingo

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

end of thread, other threads:[~2009-07-18  8:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-18  7:16 [GIT PULL] tracing updates for 2.6.32 Frederic Weisbecker
2009-07-18  7:16 ` [PATCH 1/4] ring_buffer: Fix warning while ignoring cmpxchg return value Frederic Weisbecker
2009-07-18  7:16 ` [PATCH 2/4] tracing/function: Simplify __ftrace_replace_code() Frederic Weisbecker
2009-07-18  7:17 ` [PATCH 3/4] tracing/trace_stack: Cleanup for trace_lookup_stack() Frederic Weisbecker
2009-07-18  7:17 ` [PATCH 4/4] tracing/function: Cleanup for function tracer Frederic Weisbecker
2009-07-18  8:57 ` [GIT PULL] tracing updates for 2.6.32 Ingo Molnar

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