Skip to contentSkip to conversation

tracing: small fixes for v2.6.32

GIT PULL In review Steven Rostedt 3 participants 6 messages Sep 17, 2009

Subsystems (4)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/3 vsprintf: add %ps that is the same as %pS but is like %pf

In reply to 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 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.

Cc Linus Torvalds <[email protected]>
Cc Zhao Lei <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
---
 lib/vsprintf.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
lib/vsprintf.c +4 -2
index 756ccaf..c265e75 100644
@@ -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

author maintainer
#0 lore raw

Ingo,

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(-)
author maintainer
#5 lore raw

PATCH 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]>

Cc Ingo Molnar <[email protected]>
Cc Robert Richter <[email protected]>
---
 arch/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/Kconfig +1 -0
index 99193b1..4dd737a 100644
@@ -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
author maintainer
#4 lore raw

PATCH 2/3 tracing: switch function prints from %pf to %ps

In reply to Steven Rostedt

From: 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
index f7ab7fc..cc615f8 100644
@@ -1405,7 +1405,7 @@ static int t_hash_show(struct seq_file *m, void *v)
 	if (rec->ops->print)
 		return rec->ops->print(m, rec->ip, rec->ops, rec->data);
 
-	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
index 5b01b94..b3f3776 100644
@@ -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
index 61f1667..45e6c01 100644
@@ -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
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] [PATCH 1/3] vsprintf: add %ps that is the same as %pS but is like %pf

In reply to Steven Rostedt
Quoted 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 just run_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
---
 lib/vsprintf.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
lib/vsprintf.c +4 -2
index 756ccaf..c265e75 100644
@@ -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
#3 lore raw

Re: [PATCH 1/3] [PATCH 1/3] vsprintf: add %ps that is the same as %pS but is like %pf

In reply to Steven Rostedt
Quoted 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 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.

Cc Linus Torvalds <[email protected]>
Cc Zhao Lei <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
---
 lib/vsprintf.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
lib/vsprintf.c +2 -1
index 756ccaf..c265e75 100644
@@ -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