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>
This commit is contained in:
parent
758008b262
commit
c00c48fc6e
5 changed files with 141 additions and 3 deletions
|
@ -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, '-', '_');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue