Commit 90c83218 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar

perf symbols: Fixup kernel_maps__fixup_end end map

We better call this routine after both the kernel and modules
are loaded, because as it was if there weren't modules it would not
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: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
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>
LKML-Reference: <1258821086-11521-1-git-send-email-acme@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8904b180
...@@ -71,6 +71,12 @@ static void kernel_maps__fixup_end(void) ...@@ -71,6 +71,12 @@ static void kernel_maps__fixup_end(void)
curr = rb_entry(nd, struct map, rb_node); curr = rb_entry(nd, struct map, rb_node);
prev->end = curr->start - 1; 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) static struct symbol *symbol__new(u64 start, u64 len, const char *name)
...@@ -1319,12 +1325,6 @@ static int kernel_maps__create_module_maps(void) ...@@ -1319,12 +1325,6 @@ static int kernel_maps__create_module_maps(void)
free(line); free(line);
fclose(file); 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(); return dsos__set_modules_path();
out_delete_line: out_delete_line:
...@@ -1493,7 +1493,10 @@ int kernel_maps__init(bool use_modules) ...@@ -1493,7 +1493,10 @@ int kernel_maps__init(bool use_modules)
if (use_modules && kernel_maps__create_module_maps() < 0) if (use_modules && kernel_maps__create_module_maps() < 0)
pr_warning("Failed to load list of modules in use, " pr_warning("Failed to load list of modules in use, "
"continuing...\n"); "continuing...\n");
/*
* Now that we have all the maps created, just set the ->end of them:
*/
kernel_maps__fixup_end();
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment