diff options
author | Namhyung Kim <namhyung@kernel.org> | 2017-05-31 08:01:05 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-06-05 13:17:59 -0400 |
commit | a09935b878dc8efd4b030ed1ffa0553fc9011fb8 (patch) | |
tree | b1702bf5274bb98ce313250e5f848263d89b53dc | |
parent | 6b335e8f545591c07df0f34231bd7ff7506c98c1 (diff) |
perf symbols: Use correct filename for compressed modules in build-id cache
The decompress_kmodule() decompresses kernel modules in order to load
symbols from it. In the DSO_BINARY_TYPE__BUILD_ID_CACHE case, it needs
the full file path to extract the file extension to determine the
decompression method. But overwriting 'name' will fail the
decompression since it might point to a non-existing old file.
Instead, use dso->long_name for having the correct extension and use the
real filename to decompress.
In the DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP case, both names should
be the same. This allows resolving symbols in the old modules.
Before:
$ perf report -i perf.data.old | grep scsi_mod
0.00% cc1 [scsi_mod] [k] 0x0000000000004aa6
0.00% as [scsi_mod] [k] 0x00000000000099e1
0.00% cc1 [scsi_mod] [k] 0x0000000000009830
0.00% cc1 [scsi_mod] [k] 0x0000000000001b8f
After:
0.00% cc1 [scsi_mod] [k] scsi_handle_queue_ramp_up
0.00% as [scsi_mod] [k] scsi_sg_alloc
0.00% cc1 [scsi_mod] [k] scsi_setup_cmnd
0.00% cc1 [scsi_mod] [k] scsi_get_command
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170531120105.21731-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/symbol-elf.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index e7ee47f7377a..1fb2efae4f02 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -649,10 +649,7 @@ static int decompress_kmodule(struct dso *dso, const char *name, | |||
649 | type != DSO_BINARY_TYPE__BUILD_ID_CACHE) | 649 | type != DSO_BINARY_TYPE__BUILD_ID_CACHE) |
650 | return -1; | 650 | return -1; |
651 | 651 | ||
652 | if (type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | 652 | if (kmod_path__parse_ext(&m, dso->long_name) || !m.comp) |
653 | name = dso->long_name; | ||
654 | |||
655 | if (kmod_path__parse_ext(&m, name) || !m.comp) | ||
656 | return -1; | 653 | return -1; |
657 | 654 | ||
658 | fd = mkstemp(tmpbuf); | 655 | fd = mkstemp(tmpbuf); |