All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Stack trace fix and ftrace documentation fixes
@ 2014-04-20 15:10 Jiaxing Wang
  2014-04-20 15:10 ` [PATCH 1/2] tracing/trace_stack:Skip 4 instead of 3 when using ftrace_ops_list_func Jiaxing Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiaxing Wang @ 2014-04-20 15:10 UTC (permalink / raw)
  To: Steven Rostedt, Frederic Weisbecker, Ingo Molnar
  Cc: linux-kernel, Jiaxing Wang

The first patch makes trace_stack to skip 4 instead of 3 function 
return addresses on the stack when ftrace_ops_list_func is used in ftrace,
and added a function to check for this.

The second correct the documentation of two functions in ftrace.c

Jiaxing Wang (2):
  tracing/trace_stack:Skip 4 instead of 3 when using
    ftrace_ops_list_func
  Correct documentation of ftrace_set_global_filter and
    ftrace_set_global_notrace

 kernel/trace/ftrace.c      | 11 +++++++----
 kernel/trace/trace.h       |  1 +
 kernel/trace/trace_stack.c |  8 ++++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

-- 
1.8.3.2


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

* [PATCH 1/2] tracing/trace_stack:Skip 4 instead of 3 when using ftrace_ops_list_func
  2014-04-20 15:10 [PATCH 0/2] Stack trace fix and ftrace documentation fixes Jiaxing Wang
@ 2014-04-20 15:10 ` Jiaxing Wang
  2014-04-20 15:10 ` [PATCH 2/2] Correct documentation of ftrace_set_global_filter and ftrace_set_global_notrace Jiaxing Wang
  2014-04-23 12:21 ` [PATCH 0/2] Stack trace fix and ftrace documentation fixes Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Jiaxing Wang @ 2014-04-20 15:10 UTC (permalink / raw)
  To: Steven Rostedt, Frederic Weisbecker, Ingo Molnar
  Cc: linux-kernel, Jiaxing Wang

When using ftrace_ops_list_func, we should skip 4 instead of 3,
to avoid ftrace_call+0x5/0xb appearing in the stack trace:

        Depth    Size   Location    (110 entries)
        -----    ----   --------
  0)     2956       0   update_curr+0xe/0x1e0
  1)     2956      68   ftrace_call+0x5/0xb
  2)     2888      92   enqueue_entity+0x53/0xe80
  3)     2796      80   enqueue_task_fair+0x47/0x7e0
  4)     2716      28   enqueue_task+0x45/0x70
  5)     2688      12   activate_task+0x22/0x30

Add a function using_ftrace_ops_list_func() to test for this while keeping
ftrace_ops_list_func to remain static.

Signed-off-by: Jiaxing Wang <wangjiaxing@insigma.com.cn>
---
 kernel/trace/ftrace.c      | 5 +++++
 kernel/trace/trace.h       | 1 +
 kernel/trace/trace_stack.c | 8 ++++++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 1fd4b94..e7e7302 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -373,6 +373,11 @@ static void update_ftrace_function(void)
 	ftrace_trace_function = func;
 }
 
+int using_ftrace_ops_list_func(void)
+{
+	return ftrace_trace_function == ftrace_ops_list_func;
+}
+
 static void add_ftrace_ops(struct ftrace_ops **list, struct ftrace_ops *ops)
 {
 	ops->next = *list;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index ffc314b..920c0a5 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -822,6 +822,7 @@ extern int ftrace_is_dead(void);
 int ftrace_create_function_files(struct trace_array *tr,
 				 struct dentry *parent);
 void ftrace_destroy_function_files(struct trace_array *tr);
+int using_ftrace_ops_list_func(void);
 #else
 static inline int ftrace_trace_task(struct task_struct *task)
 {
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 21b320e..5aa9a5b 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -85,8 +85,12 @@ check_stack(unsigned long ip, unsigned long *stack)
 
 	max_stack_size = this_size;
 
-	max_stack_trace.nr_entries	= 0;
-	max_stack_trace.skip		= 3;
+	max_stack_trace.nr_entries = 0;
+
+	if (using_ftrace_ops_list_func())
+		max_stack_trace.skip = 4;
+	else
+		max_stack_trace.skip = 3;
 
 	save_stack_trace(&max_stack_trace);
 
-- 
1.8.3.2


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

* [PATCH 2/2] Correct documentation of ftrace_set_global_filter and ftrace_set_global_notrace
  2014-04-20 15:10 [PATCH 0/2] Stack trace fix and ftrace documentation fixes Jiaxing Wang
  2014-04-20 15:10 ` [PATCH 1/2] tracing/trace_stack:Skip 4 instead of 3 when using ftrace_ops_list_func Jiaxing Wang
@ 2014-04-20 15:10 ` Jiaxing Wang
  2014-04-23 12:21 ` [PATCH 0/2] Stack trace fix and ftrace documentation fixes Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Jiaxing Wang @ 2014-04-20 15:10 UTC (permalink / raw)
  To: Steven Rostedt, Frederic Weisbecker, Ingo Molnar
  Cc: linux-kernel, Jiaxing Wang

Signed-off-by: Jiaxing Wang <wangjiaxing@insigma.com.cn>
---
 kernel/trace/ftrace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index e7e7302..57cdaba 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3644,8 +3644,7 @@ int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
 }
 EXPORT_SYMBOL_GPL(ftrace_set_notrace);
 /**
- * ftrace_set_filter - set a function to filter on in ftrace
- * @ops - the ops to set the filter with
+ * ftrace_set_global_filter - set a function to filter on with global tracers
  * @buf - the string that holds the function filter text.
  * @len - the length of the string.
  * @reset - non zero to reset all filters before applying this filter.
@@ -3660,8 +3659,7 @@ void ftrace_set_global_filter(unsigned char *buf, int len, int reset)
 EXPORT_SYMBOL_GPL(ftrace_set_global_filter);
 
 /**
- * ftrace_set_notrace - set a function to not trace in ftrace
- * @ops - the ops to set the notrace filter with
+ * ftrace_set_global_notrace - set a function to not trace with global tracers
  * @buf - the string that holds the function notrace text.
  * @len - the length of the string.
  * @reset - non zero to reset all filters before applying this filter.
-- 
1.8.3.2


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

* Re: [PATCH 0/2] Stack trace fix and ftrace documentation fixes
  2014-04-20 15:10 [PATCH 0/2] Stack trace fix and ftrace documentation fixes Jiaxing Wang
  2014-04-20 15:10 ` [PATCH 1/2] tracing/trace_stack:Skip 4 instead of 3 when using ftrace_ops_list_func Jiaxing Wang
  2014-04-20 15:10 ` [PATCH 2/2] Correct documentation of ftrace_set_global_filter and ftrace_set_global_notrace Jiaxing Wang
@ 2014-04-23 12:21 ` Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2014-04-23 12:21 UTC (permalink / raw)
  To: Jiaxing Wang; +Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel

On Sun, 20 Apr 2014 23:10:42 +0800
Jiaxing Wang <wangjiaxing@insigma.com.cn> wrote:

> The first patch makes trace_stack to skip 4 instead of 3 function 
> return addresses on the stack when ftrace_ops_list_func is used in ftrace,
> and added a function to check for this.
> 
> The second correct the documentation of two functions in ftrace.c
> 
> Jiaxing Wang (2):
>   tracing/trace_stack:Skip 4 instead of 3 when using
>     ftrace_ops_list_func
>   Correct documentation of ftrace_set_global_filter and
>     ftrace_set_global_notrace
> 
>  kernel/trace/ftrace.c      | 11 +++++++----
>  kernel/trace/trace.h       |  1 +
>  kernel/trace/trace_stack.c |  8 ++++++--
>  3 files changed, 14 insertions(+), 6 deletions(-)
> 

I'm a bit busy right now, but I have this in my todo list to look at.

Thanks,

-- Steve

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

end of thread, other threads:[~2014-04-23 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-20 15:10 [PATCH 0/2] Stack trace fix and ftrace documentation fixes Jiaxing Wang
2014-04-20 15:10 ` [PATCH 1/2] tracing/trace_stack:Skip 4 instead of 3 when using ftrace_ops_list_func Jiaxing Wang
2014-04-20 15:10 ` [PATCH 2/2] Correct documentation of ftrace_set_global_filter and ftrace_set_global_notrace Jiaxing Wang
2014-04-23 12:21 ` [PATCH 0/2] Stack trace fix and ftrace documentation fixes Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.