diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-11-04 10:14:27 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-11-04 10:15:53 -0300 |
commit | c00c48fc6e6ef63d83a7417923a06b08089bb34b (patch) | |
tree | 08908b7bc276599a2f25550995040112c18dc78c /tools/perf/util/machine.c | |
parent | 758008b262f70be41104e4e33ba99181ac03775d (diff) | |
download | linux-c00c48fc6e6ef63d83a7417923a06b08089bb34b.tar.gz linux-c00c48fc6e6ef63d83a7417923a06b08089bb34b.tar.bz2 linux-c00c48fc6e6ef63d83a7417923a06b08089bb34b.zip |
perf symbols: Preparation for compressed kernel module support
This patch adds basic support to handle compressed kernel module as some
distro (such as Archlinux) carries on it now. The actual work using
compression library will be added later.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1415063674-17206-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r-- | tools/perf/util/machine.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 51a630301afa..946c7d62cb6e 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -464,6 +464,7 @@ struct map *machine__new_module(struct machine *machine, u64 start, { struct map *map; struct dso *dso = __dsos__findnew(&machine->kernel_dsos, filename); + bool compressed; if (dso == NULL) return NULL; @@ -476,6 +477,11 @@ struct map *machine__new_module(struct machine *machine, u64 start, dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; else dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; + + /* _KMODULE_COMP should be next to _KMODULE */ + if (is_kernel_module(filename, &compressed) && compressed) + dso->symtab_type++; + map_groups__insert(&machine->kmaps, map); return map; } @@ -861,8 +867,14 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg, struct map *map; char *long_name; - if (dot == NULL || strcmp(dot, ".ko")) + if (dot == NULL) continue; + + /* On some system, modules are compressed like .ko.gz */ + if (is_supported_compression(dot + 1) && + is_kmodule_extension(dot - 2)) + dot -= 3; + snprintf(dso_name, sizeof(dso_name), "[%.*s]", (int)(dot - dent->d_name), dent->d_name); @@ -1044,6 +1056,11 @@ static int machine__process_kernel_mmap_event(struct machine *machine, dot = strrchr(name, '.'); if (dot == NULL) goto out_problem; + /* On some system, modules are compressed like .ko.gz */ + if (is_supported_compression(dot + 1)) + dot -= 3; + if (!is_kmodule_extension(dot + 1)) + goto out_problem; snprintf(short_module_name, sizeof(short_module_name), "[%.*s]", (int)(dot - name), name); strxfrchar(short_module_name, '-', '_'); |