All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] perf symbols: fixup kernel_maps__fixup_end end map
@ 2009-11-21 16:31 Arnaldo Carvalho de Melo
  2009-11-21 16:31 ` [PATCH 2/3] perf symbols: Old versions of elf.h don't have NT_GNU_BUILD_ID Arnaldo Carvalho de Melo
  2009-11-21 16:35 ` [PATCH 1/3] perf symbols: fixup kernel_maps__fixup_end end map Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-11-21 16:31 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras

From: Arnaldo Carvalho de Melo <acme@redhat.com>

We better call this routine after both the kernel and modules are
loaded, because as it was if there weren't modules it would be called,
resulting in kernel_map->end remaining at zero, so no map would be found
and consequently the kernel symtab wouldn't get loaded, i.e. no kernel
symbols would be resolved.

Also this fixes another case, that is when we _have_ modules, but the
last map would have its ->end address not set before we loaded its
symbols, which would never happen because ->end was not set.

Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 48f87f0..e161a51 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -71,6 +71,12 @@ static void kernel_maps__fixup_end(void)
 		curr = rb_entry(nd, struct map, rb_node);
 		prev->end = curr->start - 1;
 	}
+
+	/*
+	 * We still haven't the actual symbols, so guess the
+	 * last map final address.
+	 */
+	curr->end = ~0UL;
 }
 
 static struct symbol *symbol__new(u64 start, u64 len, const char *name)
@@ -1319,12 +1325,6 @@ static int kernel_maps__create_module_maps(void)
 	free(line);
 	fclose(file);
 
-	/*
-	 * Now that we have all sorted out, just set the ->end of all
-	 * maps:
-	 */
-	kernel_maps__fixup_end();
-
 	return dsos__set_modules_path();
 
 out_delete_line:
@@ -1493,7 +1493,10 @@ int kernel_maps__init(bool use_modules)
 	if (use_modules && kernel_maps__create_module_maps() < 0)
 		pr_warning("Failed to load list of modules in use, "
 			   "continuing...\n");
-
+	/*
+	 * Now that we have all the maps created, just set the ->end of them:
+	 */
+	kernel_maps__fixup_end();
 	return 0;
 }
 
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-21 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-21 16:31 [PATCH 1/3] perf symbols: fixup kernel_maps__fixup_end end map Arnaldo Carvalho de Melo
2009-11-21 16:31 ` [PATCH 2/3] perf symbols: Old versions of elf.h don't have NT_GNU_BUILD_ID Arnaldo Carvalho de Melo
2009-11-21 16:31   ` [PATCH 3/3] perf trace: read_tracing_data should die() another day Arnaldo Carvalho de Melo
2009-11-21 16:35 ` [PATCH 1/3] perf symbols: fixup kernel_maps__fixup_end end map Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.