linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [for-next][PATCH 0/7] tracing: Fixes for 4.11
@ 2017-03-03 14:47 Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 1/7] tracing: Fix code comment for ftrace_ops_get_func() Steven Rostedt
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 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: 65a50c656276b0846bea09dd011c0a3d35b77f3e


Boris Ostrovsky (1):
      jump_label: Fix anonymous union initialization

Chunyu Hu (1):
      tracing: Fix code comment for ftrace_ops_get_func()

David Daney (1):
      module: set __jump_table alignment to 8

Rik van Riel (1):
      tracing: Add #undef to fix compile error

Steven Rostedt (VMware) (2):
      ftrace/graph: Do not modify the EMPTY_HASH for the function_graph filter
      jump_label: Add comment about initialization order for anonymous unions

Todd Brandt (1):
      ftrace/graph: Add ftrace_graph_max_depth kernel parameter

----
 Documentation/admin-guide/kernel-parameters.txt |  6 ++++++
 include/linux/jump_label.h                      | 11 +++++++++--
 include/trace/events/syscalls.h                 |  1 +
 kernel/trace/ftrace.c                           | 23 ++++++++++++++++++-----
 scripts/module-common.lds                       |  2 ++
 5 files changed, 36 insertions(+), 7 deletions(-)

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

* [for-next][PATCH 1/7] tracing: Fix code comment for ftrace_ops_get_func()
  2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
@ 2017-03-03 14:47 ` Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 2/7] ftrace/graph: Do not modify the EMPTY_HASH for the function_graph filter Steven Rostedt
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Chunyu Hu

[-- Attachment #1: 0001-tracing-Fix-code-comment-for-ftrace_ops_get_func.patch --]
[-- Type: text/plain, Size: 1189 bytes --]

From: Chunyu Hu <chuhu@redhat.com>

There is no function 'ftrace_ops_recurs_func' existing in the current code,
it was renamed to ftrace_ops_assist_func() in commit c68c0fa29341
("ftrace: Have ftrace_ops_get_func() handle RCU and PER_CPU flags too").
Update the comment to the correct function name.

Link: http://lkml.kernel.org/r/1487723366-14463-1-git-send-email-chuhu@redhat.com

Signed-off-by: Chunyu Hu <chuhu@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0c0609326391..fd84f2e30b6d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5487,7 +5487,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip,
  * Normally the mcount trampoline will call the ops->func, but there
  * are times that it should not. For example, if the ops does not
  * have its own recursion protection, then it should call the
- * ftrace_ops_recurs_func() instead.
+ * ftrace_ops_assist_func() instead.
  *
  * Returns the function that the trampoline should call for @ops.
  */
-- 
2.10.2

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

* [for-next][PATCH 2/7] ftrace/graph: Do not modify the EMPTY_HASH for the function_graph filter
  2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 1/7] tracing: Fix code comment for ftrace_ops_get_func() Steven Rostedt
@ 2017-03-03 14:47 ` Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 3/7] module: set __jump_table alignment to 8 Steven Rostedt
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Namhyung Kim, Todd Brandt

[-- Attachment #1: 0002-ftrace-graph-Do-not-modify-the-EMPTY_HASH-for-the-fu.patch --]
[-- Type: text/plain, Size: 2326 bytes --]

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

On boot up, if the kernel command line sets a graph funtion with the kernel
command line options "ftrace_graph_filter" or "ftrace_graph_notrace" then it
updates the corresponding function graph hash, ftrace_graph_hash or
ftrace_graph_notrace_hash respectively. Unfortunately, at boot up, these
variables are pointers to the "EMPTY_HASH" which is a constant used as a
placeholder when a hash has no entities. The problem was that the comand
line version to set the hashes updated the actual EMPTY_HASH instead of
creating a new hash for the function graph. This broke the EMPTY_HASH
because not only did it modify a constant (not sure how that was allowed to
happen, except maybe because it was done at early boot, const variables were
still mutable), but it made the filters have functions listed in them when
they were actually empty.

The kernel command line function needs to allocate a new hash for the
function graph filters and assign the necessary variables to that new hash
instead.

Link: http://lkml.kernel.org/r/1488420091.7212.17.camel@linux.intel.com

Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: b9b0c831bed2 ("ftrace: Convert graph filter to use hash tables")
Reported-by: Todd Brandt <todd.e.brandt@linux.intel.com>
Tested-by: Todd Brandt <todd.e.brandt@linux.intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index fd84f2e30b6d..44122e7a6418 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4421,10 +4421,9 @@ static void __init set_ftrace_early_graph(char *buf, int enable)
 	char *func;
 	struct ftrace_hash *hash;
 
-	if (enable)
-		hash = ftrace_graph_hash;
-	else
-		hash = ftrace_graph_notrace_hash;
+	hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
+	if (WARN_ON(!hash))
+		return;
 
 	while (buf) {
 		func = strsep(&buf, ",");
@@ -4434,6 +4433,11 @@ static void __init set_ftrace_early_graph(char *buf, int enable)
 			printk(KERN_DEBUG "ftrace: function %s not "
 					  "traceable\n", func);
 	}
+
+	if (enable)
+		ftrace_graph_hash = hash;
+	else
+		ftrace_graph_notrace_hash = hash;
 }
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 
-- 
2.10.2

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

* [for-next][PATCH 3/7] module: set __jump_table alignment to 8
  2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 1/7] tracing: Fix code comment for ftrace_ops_get_func() Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 2/7] ftrace/graph: Do not modify the EMPTY_HASH for the function_graph filter Steven Rostedt
@ 2017-03-03 14:47 ` Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 4/7] jump_label: Fix anonymous union initialization Steven Rostedt
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Jason Baron, Jessica Yu, Sachin Sant,
	David Daney

[-- Attachment #1: 0003-module-set-__jump_table-alignment-to-8.patch --]
[-- Type: text/plain, Size: 1320 bytes --]

From: David Daney <david.daney@cavium.com>

For powerpc the __jump_table section in modules is not aligned, this
causes a WARN_ON() splat when loading a module containing a __jump_table.

Strict alignment became necessary with commit 3821fd35b58d
("jump_label: Reduce the size of struct static_key"), currently in
linux-next, which uses the two least significant bits of pointers to
__jump_table elements.

Fix by forcing __jump_table to 8, which is the same alignment used for
this section in the kernel proper.

Link: http://lkml.kernel.org/r/20170301220453.4756-1-david.daney@cavium.com

Reviewed-by: Jason Baron <jbaron@akamai.com>
Acked-by: Jessica Yu <jeyu@redhat.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 scripts/module-common.lds | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/module-common.lds b/scripts/module-common.lds
index 73a2c7da0e55..53234e85192a 100644
--- a/scripts/module-common.lds
+++ b/scripts/module-common.lds
@@ -19,4 +19,6 @@ SECTIONS {
 
 	. = ALIGN(8);
 	.init_array		0 : { *(SORT(.init_array.*)) *(.init_array) }
+
+	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
 }
-- 
2.10.2

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

* [for-next][PATCH 4/7] jump_label: Fix anonymous union initialization
  2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
                   ` (2 preceding siblings ...)
  2017-03-03 14:47 ` [for-next][PATCH 3/7] module: set __jump_table alignment to 8 Steven Rostedt
@ 2017-03-03 14:47 ` Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 5/7] jump_label: Add comment about initialization order for anonymous unions Steven Rostedt
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Jason Baron, Boris Ostrovsky

[-- Attachment #1: 0004-jump_label-Fix-anonymous-union-initialization.patch --]
[-- Type: text/plain, Size: 1450 bytes --]

From: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Pre-4.6 gcc do not allow direct static initialization of members of
anonymous structs/unions. After commit 3821fd35b58d ("jump_label:
Reduce the size of struct static_key") STATIC_KEY_INIT_{TRUE|FALSE}
definitions cannot be compiled with those older compilers.

Placing initializers inside curved brackets works around this problem.

Link: http://lkml.kernel.org/r/1488299542-30765-1-git-send-email-boris.ostrovsky@oracle.com

Fixes: 3821fd35b58d ("jump_label: Reduce the size of struct static_key")
Reviewed-by: Jason Baron <jbaron@akamai.com>
Compiled-by: Chris Mason <clm@fb.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/linux/jump_label.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 680c98b2f41c..a7f90117cf7d 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -166,10 +166,10 @@ extern void static_key_disable(struct static_key *key);
  */
 #define STATIC_KEY_INIT_TRUE					\
 	{ .enabled = { 1 },					\
-	  .entries = (void *)JUMP_TYPE_TRUE }
+	  { .entries = (void *)JUMP_TYPE_TRUE } }
 #define STATIC_KEY_INIT_FALSE					\
 	{ .enabled = { 0 },					\
-	  .entries = (void *)JUMP_TYPE_FALSE }
+	  { .entries = (void *)JUMP_TYPE_FALSE } }
 
 #else  /* !HAVE_JUMP_LABEL */
 
-- 
2.10.2

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

* [for-next][PATCH 5/7] jump_label: Add comment about initialization order for anonymous unions
  2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
                   ` (3 preceding siblings ...)
  2017-03-03 14:47 ` [for-next][PATCH 4/7] jump_label: Fix anonymous union initialization Steven Rostedt
@ 2017-03-03 14:47 ` Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 6/7] tracing: Add #undef to fix compile error Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 7/7] ftrace/graph: Add ftrace_graph_max_depth kernel parameter Steven Rostedt
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Chris Mason

[-- Attachment #1: 0005-jump_label-Add-comment-about-initialization-order-fo.patch --]
[-- Type: text/plain, Size: 1439 bytes --]

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

Commit 3821fd35b58d ("jump_label: Reduce the size of struct static_key")
broke old compilers that could not handle static initialization of anonymous
unions. Boris fixed it with a patch that added brackets around the static
initializer. But this creates a dependency between those initializers and
the structure's order of its fields. Document this dependency in case new
fields are added to struct static_key in the future.

Noted-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Suggested-by: Chris Mason <clm@fb.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/linux/jump_label.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index a7f90117cf7d..28e04a33535a 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -90,6 +90,13 @@ extern bool static_key_initialized;
 struct static_key {
 	atomic_t enabled;
 /*
+ * Note:
+ *   To make anonymous unions work with old compilers, the static
+ *   initialization of them requires brackets. This creates a dependency
+ *   on the order of the struct with the initializers. If any fields
+ *   are added, STATIC_KEY_INIT_TRUE and STATIC_KEY_INIT_FALSE may need
+ *   to be modified.
+ *
  * bit 0 => 1 if key is initially true
  *	    0 if initially false
  * bit 1 => 1 if points to struct static_key_mod
-- 
2.10.2

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

* [for-next][PATCH 6/7] tracing: Add #undef to fix compile error
  2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
                   ` (4 preceding siblings ...)
  2017-03-03 14:47 ` [for-next][PATCH 5/7] jump_label: Add comment about initialization order for anonymous unions Steven Rostedt
@ 2017-03-03 14:47 ` Steven Rostedt
  2017-03-03 14:47 ` [for-next][PATCH 7/7] ftrace/graph: Add ftrace_graph_max_depth kernel parameter Steven Rostedt
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, stable, Rik van Riel

[-- Attachment #1: 0006-tracing-Add-undef-to-fix-compile-error.patch --]
[-- Type: text/plain, Size: 1262 bytes --]

From: Rik van Riel <riel@redhat.com>

There are several trace include files that define TRACE_INCLUDE_FILE.

Include several of them in the same .c file (as I currently have in
some code I am working on), and the compile will blow up with a
"warning: "TRACE_INCLUDE_FILE" redefined #define TRACE_INCLUDE_FILE syscalls"

Every other include file in include/trace/events/ avoids that issue
by having a #undef TRACE_INCLUDE_FILE before the #define; syscalls.h
should have one, too.

Link: http://lkml.kernel.org/r/20160928225554.13bd7ac6@annuminas.surriel.com

Cc: stable@vger.kernel.org
Fixes: b8007ef74222 ("tracing: Separate raw syscall from syscall tracer")
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/trace/events/syscalls.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h
index 14e49c798135..b35533b94277 100644
--- a/include/trace/events/syscalls.h
+++ b/include/trace/events/syscalls.h
@@ -1,5 +1,6 @@
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM raw_syscalls
+#undef TRACE_INCLUDE_FILE
 #define TRACE_INCLUDE_FILE syscalls
 
 #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
-- 
2.10.2

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

* [for-next][PATCH 7/7] ftrace/graph: Add ftrace_graph_max_depth kernel parameter
  2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
                   ` (5 preceding siblings ...)
  2017-03-03 14:47 ` [for-next][PATCH 6/7] tracing: Add #undef to fix compile error Steven Rostedt
@ 2017-03-03 14:47 ` Steven Rostedt
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2017-03-03 14:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Todd Brandt

[-- Attachment #1: 0007-ftrace-graph-Add-ftrace_graph_max_depth-kernel-param.patch --]
[-- Type: text/plain, Size: 2142 bytes --]

From: Todd Brandt <todd.e.brandt@linux.intel.com>

Early trace callgraphs can be extremely large on systems with
several seconds of boot time. The max_depth parameter limits how
deep the graph trace goes and reduces the output size. This
parameter is the same as the max_graph_depth file in tracefs.

Link: http://lkml.kernel.org/r/1488499935-23216-1-git-send-email-todd.e.brandt@linux.intel.com

Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
[ changed comments about debugfs to tracefs ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Documentation/admin-guide/kernel-parameters.txt | 6 ++++++
 kernel/trace/ftrace.c                           | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 21e2d8863705..1c9016b27ee9 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1173,6 +1173,12 @@
 			functions that can be changed at run time by the
 			set_graph_notrace file in the debugfs tracing directory.
 
+	ftrace_graph_max_depth=<uint>
+			[FTRACE] Used with the function graph tracer. This is
+			the max depth it will trace into a function. This value
+			can be changed at run time by the max_graph_depth file
+			in the tracefs tracing directory. default: 0 (no limit)
+
 	gamecon.map[2|3]=
 			[HW,JOY] Multisystem joystick and NES/SNES/PSX pad
 			support via parallel port (up to 5 devices per port)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 44122e7a6418..d129ae51329a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4415,6 +4415,15 @@ static int __init set_graph_notrace_function(char *str)
 }
 __setup("ftrace_graph_notrace=", set_graph_notrace_function);
 
+static int __init set_graph_max_depth_function(char *str)
+{
+	if (!str)
+		return 0;
+	fgraph_max_depth = simple_strtoul(str, NULL, 0);
+	return 1;
+}
+__setup("ftrace_graph_max_depth=", set_graph_max_depth_function);
+
 static void __init set_ftrace_early_graph(char *buf, int enable)
 {
 	int ret;
-- 
2.10.2

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

end of thread, other threads:[~2017-03-03 14:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 14:47 [for-next][PATCH 0/7] tracing: Fixes for 4.11 Steven Rostedt
2017-03-03 14:47 ` [for-next][PATCH 1/7] tracing: Fix code comment for ftrace_ops_get_func() Steven Rostedt
2017-03-03 14:47 ` [for-next][PATCH 2/7] ftrace/graph: Do not modify the EMPTY_HASH for the function_graph filter Steven Rostedt
2017-03-03 14:47 ` [for-next][PATCH 3/7] module: set __jump_table alignment to 8 Steven Rostedt
2017-03-03 14:47 ` [for-next][PATCH 4/7] jump_label: Fix anonymous union initialization Steven Rostedt
2017-03-03 14:47 ` [for-next][PATCH 5/7] jump_label: Add comment about initialization order for anonymous unions Steven Rostedt
2017-03-03 14:47 ` [for-next][PATCH 6/7] tracing: Add #undef to fix compile error Steven Rostedt
2017-03-03 14:47 ` [for-next][PATCH 7/7] ftrace/graph: Add ftrace_graph_max_depth kernel parameter 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).