Commit da17ea33 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf tools: Add machine__module_dso function

Separate the dso object addition and update when adding new kernel
module.

Currently we update dso's symtab_type any time we find it in the list,
because we can't distinguish between new and found dso from
__dsos__findnew function.

Adding machine__module_dso that separates finding and adding new dso
objects, so there's no superfluous update of dso.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.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/n/tip-uvqgs5tyq4wssnq6fm43hgvk@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 701d8d7f
...@@ -460,20 +460,17 @@ int machine__process_lost_event(struct machine *machine __maybe_unused, ...@@ -460,20 +460,17 @@ int machine__process_lost_event(struct machine *machine __maybe_unused,
return 0; return 0;
} }
struct map *machine__new_module(struct machine *machine, u64 start, static struct dso *machine__module_dso(struct machine *machine, const char *filename)
const char *filename)
{ {
struct map *map; struct dso *dso;
struct dso *dso = __dsos__findnew(&machine->kernel_dsos, filename);
bool compressed; bool compressed;
dso = dsos__find(&machine->kernel_dsos, filename, false);
if (!dso) {
dso = dsos__addnew(&machine->kernel_dsos, filename);
if (dso == NULL) if (dso == NULL)
return NULL; return NULL;
map = map__new2(start, dso, MAP__FUNCTION);
if (map == NULL)
return NULL;
if (machine__is_host(machine)) if (machine__is_host(machine))
dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE;
else else
...@@ -482,6 +479,23 @@ struct map *machine__new_module(struct machine *machine, u64 start, ...@@ -482,6 +479,23 @@ struct map *machine__new_module(struct machine *machine, u64 start,
/* _KMODULE_COMP should be next to _KMODULE */ /* _KMODULE_COMP should be next to _KMODULE */
if (is_kernel_module(filename, &compressed) && compressed) if (is_kernel_module(filename, &compressed) && compressed)
dso->symtab_type++; dso->symtab_type++;
}
return dso;
}
struct map *machine__new_module(struct machine *machine, u64 start,
const char *filename)
{
struct map *map;
struct dso *dso = machine__module_dso(machine, filename);
if (dso == NULL)
return NULL;
map = map__new2(start, dso, MAP__FUNCTION);
if (map == NULL)
return NULL;
map_groups__insert(&machine->kmaps, map); map_groups__insert(&machine->kmaps, map);
return map; return map;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment