Skip to contentSkip to conversation

perf report: Handle vDSO symbols properly

tip:perfcounters/core tip-bot for Ingo Molnar 1 participant 1 message Jun 3, 2009 Documentation

lore
Share & tools
lore
#0 lore raw
Commit-ID:  ed966aac335a63083d3125198479447248637d9e
Gitweb:     http://git.kernel.org/tip/ed966aac335a63083d3125198479447248637d9e
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 3 Jun 2009 10:39:26 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 3 Jun 2009 10:39:26 +0200

perf report: Handle vDSO symbols properly

We were not looking up vDSO symbols properly, because they are in the kallsyms but are user-mode entries.

Pass negative addresses to the kernel dso object, this way we resolve them properly:

     0.05%  [kernel]: vread_tsc

Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: John Kacur <[email protected]>
LKML-Reference: <new-submission>

---
 Documentation/perf_counter/builtin-report.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
Documentation/perf_counter/builtin-report.c +15 -0
index a8d3905..0f88d9e 100644
@@ -728,6 +728,8 @@ more:
 			event->ip.pid,
 			(void *)(long)ip);
 
+		dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
+
 		if (thread == NULL) {
 			fprintf(stderr, "problem processing %d event, skipping it.\n",
 				event->header.type);
@@ -740,6 +742,8 @@ more:
 
 			dso = kernel_dso;
 
+			dprintf(" ...... dso: %s\n", dso->name);
+
 		} else if (event->header.misc & PERF_EVENT_MISC_USER) {
 
 			show = SHOW_USER;
@@ -749,11 +753,22 @@ more:
 			if (map != NULL) {
 				dso = map->dso;
 				ip -= map->start + map->pgoff;
+			} else {
+				/*
+				 * If this is outside of all known maps,
+				 * and is a negative address, try to look it
+				 * up in the kernel dso, as it might be a
+				 * vsyscall (which executes in user-mode):
+				 */
+				if ((long long)ip < 0)
+					dso = kernel_dso;
 			}
+			dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>");
 
 		} else {
 			show = SHOW_HV;
 			level = 'H';
+			dprintf(" ...... dso: [hypervisor]\n");
 		}
 
 		if (show & show_mask) {