Skip to contentSkip to conversation

trace-cmd: Leave out absolute addresses to fix bogus symbol resolutions

PATCH In review Jan Kiszka 2 participants 6 messages Jul 31, 2015 – Sep 17, 2015

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 trace-cmd: Leave out absolute addresses to fix bogus symbol resolutions

On x86, page_fault_* tracepoints report userspace address via kernel symbols because all the per-cpu variable offsets are in kallsyms, occupying the lower address space. Fix this by skipping over absolute addresses while processing kallsyms.

---
 trace-util.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
trace-util.c +6 -2
index 8a81dd0..da20e4c 100644
@@ -434,8 +434,12 @@ void parse_proc_kallsyms(struct pevent *pevent,
 		if (mod)
 			mod[strlen(mod) - 1] = 0;
 
-		/* Hack for arm arch that adds a lot of bogus '$a' functions */
-		if (func[0] != '$')
+		/*
+		 * Hacks for
+		 *  - arm arch that adds a lot of bogus '$a' functions
+		 *  - x86-64 that reports per-cpu variable offsets as absolute
+		 */
+		if (func[0] != '$' && ch != 'A')
 			pevent_register_function(pevent, func, addr, mod);
 		free(func);
 		free(mod);
Signature · 1 line
2.1.4
author
#1 lore raw
Quoted 20 lines · Jan Kiszka

On x86, page_fault_* tracepoints report userspace address via kernel symbols because all the per-cpu variable offsets are in kallsyms, occupying the lower address space. Fix this by skipping over absolute addresses while processing kallsyms.

---
 trace-util.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
trace-util.c +0 -1
index 8a81dd0..da20e4c 100644
@@ -434,8 +434,12 @@ void parse_proc_kallsyms(struct pevent *pevent,
 		if (mod)
 			mod[strlen(mod) - 1] = 0;
 
-		/* Hack for arm arch that adds a lot of bogus '$a' functions */

trace-util.c void parse_proc_kallsyms(struct pevent *pevent, · line 445

Quoted 10 lines
trace-util.c +6 -1
-		if (func[0] != '$')
+		/*
+		 * Hacks for
+		 *  - arm arch that adds a lot of bogus '$a' functions
+		 *  - x86-64 that reports per-cpu variable offsets as absolute
+		 */
+		if (func[0] != '$' && ch != 'A')
 			pevent_register_function(pevent, func, addr, mod);
 		free(func);
 		free(mod);

Ping.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 19 lines · On Tue, 15 Sep 2015 18:30:22 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 18 lines · Jan Kiszka

On x86, page_fault_* tracepoints report userspace address via kernel symbols because all the per-cpu variable offsets are in kallsyms, occupying the lower address space. Fix this by skipping over absolute addresses while processing kallsyms.

---
 trace-util.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
trace-util.c +0 -0
index 8a81dd0..da20e4c 100644
@@ -434,8 +434,12 @@ void parse_proc_kallsyms(struct pevent *pevent,
 		if (mod)
 			mod[strlen(mod) - 1] = 0;
 
Quoted 14 lines

trace-util.c void parse_proc_kallsyms(struct pevent *pevent, · line 445

Quoted 12 lines
trace-util.c +6 -2
-		/* Hack for arm arch that adds a lot of bogus '$a' functions */
-		if (func[0] != '$')
+		/*
+		 * Hacks for
+		 *  - arm arch that adds a lot of bogus '$a' functions
+		 *  - x86-64 that reports per-cpu variable offsets as absolute
+		 */
+		if (func[0] != '$' && ch != 'A')
 			pevent_register_function(pevent, func, addr, mod);
 		free(func);
 		free(mod);

Ping.

Thanks for the reminder ping.

Hmm, I don't see anything marked 'A' in my kallsyms. Have a config I can test to see what you are seeing?

-- Steve

author
#3 lore raw
Quoted 37 lines · Steven Rostedt
Quoted 19 lines · On Tue, 15 Sep 2015 18:30:22 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 18 lines · Jan Kiszka

On x86, page_fault_* tracepoints report userspace address via kernel symbols because all the per-cpu variable offsets are in kallsyms, occupying the lower address space. Fix this by skipping over absolute addresses while processing kallsyms.

---
 trace-util.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
trace-util.c +0 -0
index 8a81dd0..da20e4c 100644
@@ -434,8 +434,12 @@ void parse_proc_kallsyms(struct pevent *pevent,
 		if (mod)
 			mod[strlen(mod) - 1] = 0;
 
Quoted 14 lines

trace-util.c void parse_proc_kallsyms(struct pevent *pevent, · line 445

Quoted 12 lines
trace-util.c +6 -2
-		/* Hack for arm arch that adds a lot of bogus '$a' functions */
-		if (func[0] != '$')
+		/*
+		 * Hacks for
+		 *  - arm arch that adds a lot of bogus '$a' functions
+		 *  - x86-64 that reports per-cpu variable offsets as absolute
+		 */
+		if (func[0] != '$' && ch != 'A')
 			pevent_register_function(pevent, func, addr, mod);
 		free(func);
 		free(mod);

Ping.

Quoted 4 lines

Thanks for the reminder ping.

Hmm, I don't see anything marked 'A' in my kallsyms. Have a config I can test to see what you are seeing?

Huh? Your /proc/kallsyms doesn't start like this?

0000000000000000 A irq_stack_union
0000000000000000 A __per_cpu_start
...

That's from a stock distro SUSE kernel I'm running (config attached).

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#4 lore raw
Quoted 7 lines · On Tue, 15 Sep 2015 19:06:36 +0200 Jan Kiszka <[email protected]> wrote:

Huh? Your /proc/kallsyms doesn't start like this?

0000000000000000 A irq_stack_union
0000000000000000 A __per_cpu_start
...

That's from a stock distro SUSE kernel I'm running (config attached).

Nevermind, I was looking at an older kernel which didn't have that. I booted a newer kernel and I now see it.

-- Steve

#5 lore raw
In reply to Jan Kiszka
Quoted 4 lines · On Fri, 31 Jul 2015 16:04:54 +0200 Jan Kiszka <[email protected]> wrote:

On x86, page_fault_* tracepoints report userspace address via kernel symbols because all the per-cpu variable offsets are in kallsyms, occupying the lower address space. Fix this by skipping over absolute addresses while processing kallsyms.

Applied thanks!

-- Steve

Quoted 4 lines
---
 trace-util.c | 8 ++++++--