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

perf tools: Try to lookup kernel module map before creating one

Currently we assume machine__new_module is called only once for each
module so we create its map&dso unconditionally.

However it's possible that it's called multiple times for same module.
Like for perf record:

  1) via machine__create_module during machine init
  2) via kernel MMAP event processing

Trying to lookup kernel module map before creating one.
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-kx76xfqpnrpho5hdaapbqm09@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 907fb509
...@@ -498,6 +498,11 @@ struct map *machine__new_module(struct machine *machine, u64 start, ...@@ -498,6 +498,11 @@ struct map *machine__new_module(struct machine *machine, u64 start,
if (kmod_path__parse_name(&m, filename)) if (kmod_path__parse_name(&m, filename))
return NULL; return NULL;
map = map_groups__find_by_name(&machine->kmaps, MAP__FUNCTION,
m.name);
if (map)
goto out;
dso = machine__module_dso(machine, &m, filename); dso = machine__module_dso(machine, &m, filename);
if (dso == NULL) if (dso == NULL)
goto out; goto out;
......
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