linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [for-next][PATCH 0/5] tracing: function graph cleanups for the next merge window
@ 2019-04-25 16:28 Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 1/5] ftrace: Remove ASSIGN_OPS_HASH() macro from ftrace.c Steven Rostedt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Steven Rostedt @ 2019-04-25 16:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: 070ea1a24f403b68e76d9763cedd061917f6e1c1


Steven Rostedt (VMware) (5):
      ftrace: Remove ASSIGN_OPS_HASH() macro from ftrace.c
      ftrace: Do not process STUB functions in ftrace_ops_list_func()
      function_graph: Have selftest also emulate tr->reset() as it did with tr->init()
      function_graph: Use a ftrace_graph_ret_stub() for return
      function_graph: Place ftrace_graph_entry_stub() prototype in include/linux/ftrace.h

----
 arch/nds32/kernel/ftrace.c    | 1 -
 arch/parisc/kernel/ftrace.c   | 1 -
 include/linux/ftrace.h        | 2 ++
 kernel/trace/fgraph.c         | 9 ++++++---
 kernel/trace/ftrace.c         | 7 +++----
 kernel/trace/trace_selftest.c | 5 ++++-
 6 files changed, 15 insertions(+), 10 deletions(-)

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

* [for-next][PATCH 1/5] ftrace: Remove ASSIGN_OPS_HASH() macro from ftrace.c
  2019-04-25 16:28 [for-next][PATCH 0/5] tracing: function graph cleanups for the next merge window Steven Rostedt
@ 2019-04-25 16:28 ` Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 2/5] ftrace: Do not process STUB functions in ftrace_ops_list_func() Steven Rostedt
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2019-04-25 16:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

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

The ASSIGN_OPS_HASH() macro was moved to fgraph.c where it was used, but for
some reason it wasn't removed from ftrace.c, as it is no longer referenced
there.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 26c8ca9bd06b..bf11e0553450 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -69,12 +69,8 @@
 #define INIT_OPS_HASH(opsname)	\
 	.func_hash		= &opsname.local_hash,			\
 	.local_hash.regex_lock	= __MUTEX_INITIALIZER(opsname.local_hash.regex_lock),
-#define ASSIGN_OPS_HASH(opsname, val) \
-	.func_hash		= val, \
-	.local_hash.regex_lock	= __MUTEX_INITIALIZER(opsname.local_hash.regex_lock),
 #else
 #define INIT_OPS_HASH(opsname)
-#define ASSIGN_OPS_HASH(opsname, val)
 #endif
 
 enum {
-- 
2.20.1



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

* [for-next][PATCH 2/5] ftrace: Do not process STUB functions in ftrace_ops_list_func()
  2019-04-25 16:28 [for-next][PATCH 0/5] tracing: function graph cleanups for the next merge window Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 1/5] ftrace: Remove ASSIGN_OPS_HASH() macro from ftrace.c Steven Rostedt
@ 2019-04-25 16:28 ` Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 3/5] function_graph: Have selftest also emulate tr->reset() as it did with tr->init() Steven Rostedt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2019-04-25 16:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

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

The function_graph tracer has a stub function and its ops flag has the
FTRACE_OPS_FL_STUB set. As the function graph does not use the
ftrace_ops->func pointer but instead is called by a separate part of the
ftrace trampoline. The function_graph tracer still requires to pass in a
ftrace_ops that may also hold the hash of the functions to call. But there's
no reason to test that hash in the function tracing portion. Instead of
testing to see if we should call the stub function, just test if the ops has
FTRACE_OPS_FL_STUB set, and just skip it.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index bf11e0553450..433a64f49532 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6260,6 +6260,9 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
 	preempt_disable_notrace();
 
 	do_for_each_ftrace_op(op, ftrace_ops_list) {
+		/* Stub functions don't need to be called nor tested */
+		if (op->flags & FTRACE_OPS_FL_STUB)
+			continue;
 		/*
 		 * Check the following for each ops before calling their func:
 		 *  if RCU flag is set, then rcu_is_watching() must be true
-- 
2.20.1



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

* [for-next][PATCH 3/5] function_graph: Have selftest also emulate tr->reset() as it did with tr->init()
  2019-04-25 16:28 [for-next][PATCH 0/5] tracing: function graph cleanups for the next merge window Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 1/5] ftrace: Remove ASSIGN_OPS_HASH() macro from ftrace.c Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 2/5] ftrace: Do not process STUB functions in ftrace_ops_list_func() Steven Rostedt
@ 2019-04-25 16:28 ` Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 4/5] function_graph: Use a ftrace_graph_ret_stub() for return Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 5/5] function_graph: Place ftrace_graph_entry_stub() prototype in include/linux/ftrace.h Steven Rostedt
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2019-04-25 16:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

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

The function_graph boot up self test emulates the tr->init() function in
order to add a wrapper around the function graph tracer entry code to test
for lock ups and such. But it does not emulate the tr->reset(), and just
calls the function_graph tracer tr->reset() function which will use its own
fgraph_ops to unregister function tracing with. As the fgraph_ops is
becoming more meaningful with the register_ftrace_graph() and
unregister_ftrace_graph() functions, the two need to be the same. The
emulated tr->init() uses its own fgraph_ops descriptor, which means the
unregister_ftrace_graph() must use the same ftrace_ops, which the selftest
currently does not do. By emulating the tr->reset() as the selftest does
with the tr->init() it will be able to pass the same fgraph_ops descriptor
to the unregister_ftrace_graph() as it did with the register_ftrace_graph().

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_selftest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 9d402e7fc949..69ee8ef12cee 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -792,7 +792,10 @@ trace_selftest_startup_function_graph(struct tracer *trace,
 	/* check the trace buffer */
 	ret = trace_test_buffer(&tr->trace_buffer, &count);
 
-	trace->reset(tr);
+	/* Need to also simulate the tr->reset to remove this fgraph_ops */
+	tracing_stop_cmdline_record();
+	unregister_ftrace_graph(&fgraph_ops);
+
 	tracing_start();
 
 	if (!ret && !count) {
-- 
2.20.1



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

* [for-next][PATCH 4/5] function_graph: Use a ftrace_graph_ret_stub() for return
  2019-04-25 16:28 [for-next][PATCH 0/5] tracing: function graph cleanups for the next merge window Steven Rostedt
                   ` (2 preceding siblings ...)
  2019-04-25 16:28 ` [for-next][PATCH 3/5] function_graph: Have selftest also emulate tr->reset() as it did with tr->init() Steven Rostedt
@ 2019-04-25 16:28 ` Steven Rostedt
  2019-04-25 16:28 ` [for-next][PATCH 5/5] function_graph: Place ftrace_graph_entry_stub() prototype in include/linux/ftrace.h Steven Rostedt
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2019-04-25 16:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

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

There's a unique ftrace_graph_entry_stub() for the entryfunc of a
fgraph_ops, but the ftrace_stub is used for the retfunc(). To be consistent
and also to use the same type of function as the type being called for
retfunc(), create and use ftrace_graph_ret_stub().

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/fgraph.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 8dfd5021b933..580ce7534a49 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -327,14 +327,17 @@ void ftrace_graph_sleep_time_control(bool enable)
 	fgraph_sleep_time = enable;
 }
 
+static void ftrace_graph_ret_stub(struct ftrace_graph_ret *trace)
+{
+}
+
 int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
 {
 	return 0;
 }
 
 /* The callbacks that hook a function */
-trace_func_graph_ret_t ftrace_graph_return =
-			(trace_func_graph_ret_t)ftrace_stub;
+trace_func_graph_ret_t ftrace_graph_return = ftrace_graph_ret_stub;
 trace_func_graph_ent_t ftrace_graph_entry = ftrace_graph_entry_stub;
 static trace_func_graph_ent_t __ftrace_graph_entry = ftrace_graph_entry_stub;
 
@@ -614,7 +617,7 @@ void unregister_ftrace_graph(struct fgraph_ops *gops)
 		goto out;
 
 	ftrace_graph_active--;
-	ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
+	ftrace_graph_return = ftrace_graph_ret_stub;
 	ftrace_graph_entry = ftrace_graph_entry_stub;
 	__ftrace_graph_entry = ftrace_graph_entry_stub;
 	ftrace_shutdown(&graph_ops, FTRACE_STOP_FUNC_RET);
-- 
2.20.1



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

* [for-next][PATCH 5/5] function_graph: Place ftrace_graph_entry_stub() prototype in include/linux/ftrace.h
  2019-04-25 16:28 [for-next][PATCH 0/5] tracing: function graph cleanups for the next merge window Steven Rostedt
                   ` (3 preceding siblings ...)
  2019-04-25 16:28 ` [for-next][PATCH 4/5] function_graph: Use a ftrace_graph_ret_stub() for return Steven Rostedt
@ 2019-04-25 16:28 ` Steven Rostedt
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2019-04-25 16:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Greentime Hu, Vincent Chen,
	James E.J. Bottomley, Helge Deller, linux-parisc

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

ftrace_graph_entry_stub() is defined in generic code, its prototype should
be in the generic header and not defined throughout architecture specific
code in order to use it.

Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-parisc@vger.kernel.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 arch/nds32/kernel/ftrace.c  | 1 -
 arch/parisc/kernel/ftrace.c | 1 -
 include/linux/ftrace.h      | 2 ++
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/nds32/kernel/ftrace.c b/arch/nds32/kernel/ftrace.c
index 8a41372551ff..fd2a54b8cd57 100644
--- a/arch/nds32/kernel/ftrace.c
+++ b/arch/nds32/kernel/ftrace.c
@@ -7,7 +7,6 @@
 #ifndef CONFIG_DYNAMIC_FTRACE
 extern void (*ftrace_trace_function)(unsigned long, unsigned long,
 				     struct ftrace_ops*, struct pt_regs*);
-extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
 extern void ftrace_graph_caller(void);
 
 noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip,
diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
index e46a4157a894..a28f915993b1 100644
--- a/arch/parisc/kernel/ftrace.c
+++ b/arch/parisc/kernel/ftrace.c
@@ -51,7 +51,6 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent,
 				unsigned long org_sp_gr3)
 {
 	extern ftrace_func_t ftrace_trace_function;  /* depends on CONFIG_DYNAMIC_FTRACE */
-	extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
 
 	if (ftrace_trace_function != ftrace_stub) {
 		/* struct ftrace_ops *op, struct pt_regs *regs); */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 730876187344..9b28fce436ca 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -751,6 +751,8 @@ struct ftrace_graph_ret {
 typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
 typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
 
+extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
+
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 
 struct fgraph_ops {
-- 
2.20.1



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

end of thread, other threads:[~2019-04-25 16:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-25 16:28 [for-next][PATCH 0/5] tracing: function graph cleanups for the next merge window Steven Rostedt
2019-04-25 16:28 ` [for-next][PATCH 1/5] ftrace: Remove ASSIGN_OPS_HASH() macro from ftrace.c Steven Rostedt
2019-04-25 16:28 ` [for-next][PATCH 2/5] ftrace: Do not process STUB functions in ftrace_ops_list_func() Steven Rostedt
2019-04-25 16:28 ` [for-next][PATCH 3/5] function_graph: Have selftest also emulate tr->reset() as it did with tr->init() Steven Rostedt
2019-04-25 16:28 ` [for-next][PATCH 4/5] function_graph: Use a ftrace_graph_ret_stub() for return Steven Rostedt
2019-04-25 16:28 ` [for-next][PATCH 5/5] function_graph: Place ftrace_graph_entry_stub() prototype in include/linux/ftrace.h Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).