tracing: small fixes for v2.6.32
Subsystems (4)
Steven Rostedt
maintainerPATCH 1/3 vsprintf: add %ps that is the same as %pS but is like %pf
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
On PowerPC64 function pointers do not point directly at the functions, but instead point to pointers to the functions. The output of %pF expects to point to a pointer to the function, whereas %pS will show the function itself.
mcount returns the direct pointer to the function and not the pointer to the pointer. Thus %pS must be used to show this. The function tracer requires printing of the functions without offsets and uses the %pf instead.
%pF produces run_local_timers+0x4/0x1f
%pf produces just run_local_timers
For PowerPC64, we need to use the direct pointer, and we only have %pS which will produce .run_local_timers+0x4/0x1f
This patch creates a %ps that matches the %pf as %pS matches %pF.
--- lib/vsprintf.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
lib/vsprintf.c +4 -2
@@ -580,7 +580,7 @@ static char *symbol_string(char *buf, char *end, void *ptr,unsigned long value = (unsigned long ) ptr;#ifdef CONFIG_KALLSYMS char sym[KSYM_SYMBOL_LEN ]; -if (ext !='f' ) +if (ext !='f' && ext !='s' )sprint_symbol (sym, value);else kallsyms_lookup (value,NULL ,NULL ,NULL , sym);
@@ -721,6 +721,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,case 'F' :case 'f' : ptr =dereference_function_descriptor (ptr); +case 's' :/* Fallthrough */ case 'S' :return symbol_string (buf, end, ptr, spec, *fmt);
@@ -958,7 +959,8 @@ qualifier:* @args: Arguments for the format string * * This function follows C99 vsnprintf, but has some extensions: -* %pS output the name of a text symbol +* %pS output the name of a text symbol with offset +* %ps output the name of a text symbol without offset * %pF output the name of a function pointer with its offset * %pf output the name of a function pointer without its offset * %pR output the address range in a struct resource
Signature · 1 line
1.6.3.3
Steven Rostedt
maintainerIngo,
Please pull the latest tip/tracing/core5 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/core5
Christian Borntraeger (1):
oprofile: fix oprofile regression: select RING_BUFFER_ALLOW_SWAP
Steven Rostedt (2):
vsprintf: add %ps that is the same as %pS but is like %pf
tracing: switch function prints from %pf to %ps
----
arch/Kconfig | 1 + kernel/trace/ftrace.c | 6 +++--- kernel/trace/trace_functions.c | 2 +- kernel/trace/trace_functions_graph.c | 6 +++--- lib/vsprintf.c | 6 ++++-- 5 files changed, 12 insertions(+), 9 deletions(-)
Steven Rostedt
maintainerPATCH 3/3 oprofile: fix oprofile regression: select RING_BUFFER_ALLOW_SWAP
From: Christian Borntraeger <[email protected]>
commit 85bac32c4a52c592b857f2c360cc5ec93a097d70
ring-buffer: only enable ring_buffer_swap_cpu when needed
broke oprofile (at least on s390, but likely on all platforms).
this patch lets oprofile select RING_BUFER_ALLOW_SWAP to make ring_buffer_swap_cpu usable for oprofile.
LKML-Reference: <[email protected]>
--- arch/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/Kconfig +1 -0
@@ -9,6 +9,7 @@ config OPROFILE depends on TRACING_SUPPORT select TRACING select RING_BUFFER + select RING_BUFFER_ALLOW_SWAP help OProfile is a profiling system capable of profiling the whole system, include the kernel, kernel modules, libraries,
Signature · 1 line
1.6.3.3
Steven Rostedt
maintainerPATCH 2/3 tracing: switch function prints from %pf to %ps
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
For direct function pointers (like what mcount provides) PowerPC64 requires the use of %ps, otherwise nothing is printed.
This patch converts all prints of functions retrieved through mcount to use the %ps format from the %pf.
--- kernel/trace/ftrace.c | 6 +++--- kernel/trace/trace_functions.c | 2 +- kernel/trace/trace_functions_graph.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
kernel/trace/ftrace.c +3 -3
@@ -1405,7 +1405,7 @@ static int t_hash_show(struct seq_file *m, void *v)if (rec->ops->print)return rec->ops->seq_printf (m,"%pf:%pf" , (void *)rec->ip, (void *)rec->ops->func); +seq_printf (m,"%ps:%ps" , (void *)rec->ip, (void *)rec->ops->func);if (rec->data)seq_printf (m,":%p" , rec->data);
@@ -1515,7 +1515,7 @@ static int t_show(struct seq_file *m, void *v)if (!rec)return 0 ; -seq_printf (m,"%pf\n" , (void *)rec->ip); +seq_printf (m,"%ps\n" , (void *)rec->ip);return 0 ; }
@@ -2456,7 +2456,7 @@ static int g_show(struct seq_file *m, void *v)return 0 ; } -seq_printf (m,"%pf\n" , (void *)*ptr); +seq_printf (m,"%ps\n" , (void *)*ptr);return 0 ; }
kernel/trace/trace_functions.c +1 -1
@@ -290,7 +290,7 @@ ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip, {long count = (long )data; -seq_printf (m,"%pf:" , (void *)ip); +seq_printf (m,"%ps:" , (void *)ip);if (ops == &traceon_probe_ops)seq_printf (m,"traceon" );
kernel/trace/trace_functions_graph.c +3 -3
@@ -124,7 +124,7 @@ ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret,if (unlikely (current->ret_stack[index].fp != frame_pointer)) {ftrace_graph_stop (); WARN(1, "Bad frame pointer: expected %lx, received %lx\n" - " from func %pF return to %lx\n", + " from func %ps return to %lx\n", current->ret_stack[index].fp, frame_pointer, (void *)current->ret_stack[index].func,
@@ -669,7 +669,7 @@ print_graph_entry_leaf(struct trace_iterator *iter,return TRACE_TYPE_PARTIAL_LINE ; } - ret =trace_seq_printf (s,"%pf();\n" , (void *)call->func); + ret =trace_seq_printf (s,"%ps();\n" , (void *)call->func);if (!ret)return TRACE_TYPE_PARTIAL_LINE ;
@@ -712,7 +712,7 @@ print_graph_entry_nested(struct trace_iterator *iter,return TRACE_TYPE_PARTIAL_LINE ; } - ret =trace_seq_printf (s,"%pf() {\n" , (void *)call->func); + ret =trace_seq_printf (s,"%ps() {\n" , (void *)call->func);if (!ret)return TRACE_TYPE_PARTIAL_LINE ;
Signature · 1 line
1.6.3.3
Re: [PATCH 1/3] [PATCH 1/3] vsprintf: add %ps that is the same as %pS but is like %pf
In reply to Steven RostedtQuoted 17 lines · Steven Rostedt
plain text document attachment (0001-vsprintf-add-ps-that-is-the-same-as-pS-but-is-like-p.patch)
From: Steven Rostedt <[email protected]>On PowerPC64 function pointers do not point directly at the functions, but instead point to pointers to the functions. The output of %pF expects to point to a pointer to the function, whereas %pS will show the function itself.
mcount returns the direct pointer to the function and not the pointer to the pointer. Thus %pS must be used to show this. The function tracer requires printing of the functions without offsets and uses the %pf instead.
%pF produces
run_local_timers+0x4/0x1f
%pf produces justrun_local_timers
Quoted 7 lines
For PowerPC64, we need to use the direct pointer, and we only have %pS which will produce .run_local_timers+0x4/0x1f
This patch creates a %ps that matches the %pf as %pS matches %pF.
Cc Linus Torvalds <[email protected]>Cc Zhao Lei <[email protected]>
Quoted 36 lines
Signed-off-by Steven Rostedt <[email protected]>--- lib/vsprintf.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)lib/vsprintf.c +4
-2@@ -580,7 +580,7 @@ static char *symbol_string(char *buf, char *end, void *ptr,unsigned long value = (unsigned long ) ptr;#ifdef CONFIG_KALLSYMS char sym[KSYM_SYMBOL_LEN ]; -if (ext !='f' ) +if (ext !='f' && ext !='s' )sprint_symbol (sym, value);else kallsyms_lookup (value,NULL ,NULL ,NULL , sym);@@ -721,6 +721,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,case 'F' :case 'f' : ptr =dereference_function_descriptor (ptr); +case 's' :/* Fallthrough */ case 'S' :return symbol_string (buf, end, ptr, spec, *fmt);@@ -958,7 +959,8 @@ qualifier:* @args: Arguments for the format string * * This function follows C99 vsnprintf, but has some extensions: -* %pS output the name of a text symbol +* %pS output the name of a text symbol with offset +* %ps output the name of a text symbol without offset * %pF output the name of a function pointer with its offset * %pf output the name of a function pointer without its offset * %pR output the address range in a struct resource
Re: [PATCH 1/3] [PATCH 1/3] vsprintf: add %ps that is the same as %pS but is like %pf
In reply to Steven RostedtQuoted 50 lines · Steven Rostedt
From: Steven Rostedt <[email protected]>
On PowerPC64 function pointers do not point directly at the functions, but instead point to pointers to the functions. The output of %pF expects to point to a pointer to the function, whereas %pS will show the function itself.
mcount returns the direct pointer to the function and not the pointer to the pointer. Thus %pS must be used to show this. The function tracer requires printing of the functions without offsets and uses the %pf instead.
%pF produces
run_local_timers+0x4/0x1f
%pf produces justrun_local_timersFor PowerPC64, we need to use the direct pointer, and we only have %pS which will produce .run_local_timers+0x4/0x1f
This patch creates a %ps that matches the %pf as %pS matches %pF.
Cc Linus Torvalds <[email protected]>Cc Zhao Lei <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Signed-off-by Steven Rostedt <[email protected]>--- lib/vsprintf.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)lib/vsprintf.c +2
-1@@ -580,7 +580,7 @@ static char *symbol_string(char *buf, char *end, void *ptr,unsigned long value = (unsigned long ) ptr;#ifdef CONFIG_KALLSYMS char sym[KSYM_SYMBOL_LEN ]; -if (ext !='f' ) +if (ext !='f' && ext !='s' )sprint_symbol (sym, value);else kallsyms_lookup (value,NULL ,NULL ,NULL , sym);@@ -721,6 +721,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,case 'F' :case 'f' : ptr =dereference_function_descriptor (ptr); +case 's' :/* Fallthrough */ case 'S' :return symbol_string (buf, end, ptr, spec, *fmt);
lib/vsprintf.c qualifier: · line 963
Quoted 6 lines
lib/vsprintf.c +2
-1@@ -958,7 +959,8 @@ qualifier:* @args: Arguments for the format string * * This function follows C99 vsnprintf, but has some extensions: -* %pS output the name of a text symbol +* %pS output the name of a text symbol with offset +* %ps output the name of a text symbol without offset
Comments of bstr_printf() also need to be updated.
or remove duplation and just say "refer to vsnprintf()" in bstr_printf()'s comment.
Thanks
Zhaolei