tracing: Fixes for 4.11
Subsystems (6)
Steven Rostedt
maintainercover tracing: Fixes for 4.11
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(-)
Steven Rostedt
maintainerPATCH 1/7 tracing: Fix code comment for ftrace_ops_get_func()
From: Chunyu Hu <[email protected]>
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.
--- kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ftrace.c +1 -1
@@ -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. */
Signature · 1 line
2.10.2
Steven Rostedt
maintainerPATCH 2/7 ftrace/graph: Do not modify the EMPTY_HASH for the function_graph filter
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
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.
--- kernel/trace/ftrace.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +8 -4
@@ -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 */
Signature · 1 line
2.10.2
Steven Rostedt
maintainerPATCH 3/7 module: set __jump_table alignment to 8
In reply to Steven RostedtFrom: David Daney <[email protected]>
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.
--- scripts/module-common.lds | 2 ++ 1 file changed, 2 insertions(+)
scripts/module-common.lds +2 -0
@@ -19,4 +19,6 @@ SECTIONS { . = ALIGN(8); .init_array 0 : { *(SORT(.init_array.*)) *(.init_array) } + + __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } }
Signature · 1 line
2.10.2
Steven Rostedt
maintainerPATCH 4/7 jump_label: Fix anonymous union initialization
In reply to Steven RostedtFrom: Boris Ostrovsky <[email protected]>
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.
--- include/linux/jump_label.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/jump_label.h +2 -2
@@ -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 */
Signature · 1 line
2.10.2
Steven Rostedt
maintainerPATCH 5/7 jump_label: Add comment about initialization order for anonymous unions
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
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.
--- include/linux/jump_label.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/jump_label.h +7 -0
@@ -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
Signature · 1 line
2.10.2
Steven Rostedt
maintainerPATCH 6/7 tracing: Add #undef to fix compile error
In reply to Steven RostedtFrom: Rik van Riel <[email protected]>
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.
--- include/trace/events/syscalls.h | 1 + 1 file changed, 1 insertion(+)
include/trace/events/syscalls.h +1 -0
@@ -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 )
Signature · 1 line
2.10.2
Steven Rostedt
maintainerPATCH 7/7 ftrace/graph: Add ftrace_graph_max_depth kernel parameter
In reply to Steven RostedtFrom: Todd Brandt <[email protected]>
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.
--- Documentation/admin-guide/kernel-parameters.txt | 6 ++++++ kernel/trace/ftrace.c | 9 +++++++++ 2 files changed, 15 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +6 -0
@@ -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)
kernel/trace/ftrace.c +9 -0
@@ -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;
Signature · 1 line
2.10.2