linux-stable/tools/perf/util
Ingo Molnar c1f47b454c perf_counter tools: Fix vmlinux fallback when running on a different kernel
Lucas De Marchi reported that perf report and perf annotate
displays mismatching profile if a perf.data is analyzed on
an older kernel - even if the correct vmlinux is specified
via the -k option.

The reason is the fallback path in util/symbol.c:dso__load_kernel():

int dso__load_kernel(struct dso *self, const char *vmlinux,
                     symbol_filter_t filter, int verbose)
{
        int err = -1;

        if (vmlinux)
                err = dso__load_vmlinux(self, vmlinux, filter, verbose);

        if (err)
                err = dso__load_kallsyms(self, filter, verbose);

        return err;
}

dso__load_vmlinux() returns negative on error, but on success it
returns the number of symbols loaded - which confuses the function
to load the kallsyms.

This is normally harmless, as reporting is usually performed on the
same kernel that is analyzed - but if there's a mismatch then we
load the wrong kallsyms and create a non-sensical symbol tree.

The fix is to only fall back to kallsyms on errors.

Reported-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-06-21 13:58:51 +02:00
..
abspath.c
alias.c
cache.h
color.c
color.h
config.c
ctype.c perf_counter tools: Add and use isprint() 2009-06-18 09:46:00 +02:00
environment.c
exec_cmd.c
exec_cmd.h
generate-cmdlist.sh
help.c
help.h
levenshtein.c
levenshtein.h
list.h
pager.c
parse-events.c perf_counter tools: Define and use our own u64, s64 etc. definitions 2009-06-19 18:25:47 +02:00
parse-events.h
parse-options.c
parse-options.h
path.c
PERF-VERSION-GEN
quote.c
quote.h
rbtree.c
rbtree.h
run-command.c
run-command.h
sigchain.c
sigchain.h
strbuf.c
strbuf.h
string.c perf_counter tools: Define and use our own u64, s64 etc. definitions 2009-06-19 18:25:47 +02:00
string.h perf_counter tools: Define and use our own u64, s64 etc. definitions 2009-06-19 18:25:47 +02:00
symbol.c perf_counter tools: Fix vmlinux fallback when running on a different kernel 2009-06-21 13:58:51 +02:00
symbol.h perf_counter tools: Define and use our own u64, s64 etc. definitions 2009-06-19 18:25:47 +02:00
usage.c perf top: Fall back to cpu-clock-tick hrtimer sampling if no cycle counter available 2009-06-07 17:31:52 +02:00
util.h perf_counter tools: Add and use isprint() 2009-06-18 09:46:00 +02:00
wrapper.c