mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
perf tools: Fix module symbol loading bug
Avi Kivity reported 'perf annotate' failures with modules, the requested function was not annotated. If there are no modules currently loaded, or the last module scanned is not loaded, dso__load_modules() steps on the value from dso__load_vmlinux(), so we happily load the kallsyms symbols on top of what we've already loaded. Fix that such that the total count of symbols loaded is returned. Should module symbol load fail after parsing of vmlinux, is's a hard failure, so do not silently fall-back to kallsyms. Reported-by: Avi Kivity <avi@redhat.com> Signed-off-by: Mike Galbraith <efault@gmx.de> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: rostedt@goodmis.org Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> LKML-Reference: <1253697658.11461.36.camel@marge.simson.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
7d42896628
commit
508c4d0874
1 changed files with 13 additions and 4 deletions
|
@ -833,7 +833,7 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
|
|||
struct mod_dso *mods = mod_dso__new_dso("modules");
|
||||
struct module *pos;
|
||||
struct rb_node *next;
|
||||
int err;
|
||||
int err, count = 0;
|
||||
|
||||
err = mod_dso__load_modules(mods);
|
||||
|
||||
|
@ -852,14 +852,16 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
|
|||
break;
|
||||
|
||||
next = rb_next(&pos->rb_node);
|
||||
count += err;
|
||||
}
|
||||
|
||||
if (err < 0) {
|
||||
mod_dso__delete_modules(mods);
|
||||
mod_dso__delete_self(mods);
|
||||
return err;
|
||||
}
|
||||
|
||||
return err;
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline void dso__fill_symbol_holes(struct dso *self)
|
||||
|
@ -913,8 +915,15 @@ int dso__load_kernel(struct dso *self, const char *vmlinux,
|
|||
|
||||
if (vmlinux) {
|
||||
err = dso__load_vmlinux(self, vmlinux, filter, v);
|
||||
if (err > 0 && use_modules)
|
||||
err = dso__load_modules(self, filter, v);
|
||||
if (err > 0 && use_modules) {
|
||||
int syms = dso__load_modules(self, filter, v);
|
||||
|
||||
if (syms < 0) {
|
||||
fprintf(stderr, "dso__load_modules failed!\n");
|
||||
return syms;
|
||||
}
|
||||
err += syms;
|
||||
}
|
||||
}
|
||||
|
||||
if (err <= 0)
|
||||
|
|
Loading…
Reference in a new issue