Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a7e6d1b authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Check recorded kernel version when finding vmlinux



Currently vmlinux_path__init() only tries to find vmlinux file from
current directory, /boot and some canonical directories with version
number of the running kernel.  This can be a problem when reporting old
data recorded on a kernel version not running currently.

We can use --symfs option for this but it's annoying for user to do it
always.  As we already have the info in the perf.data file, it can be
changed to use it for the search automatically.

Before:

  $ perf report
  ...
  # Samples: 4K of event 'cpu-clock'
  # Event count (approx.): 1067250000
  #
  # Overhead  Command     Shared Object      Symbol
  # ........  ..........  .................  ..............................
      71.87%     swapper  [kernel.kallsyms]  [k] recover_probed_instruction

After:

  # Overhead  Command     Shared Object      Symbol
  # ........  ..........  .................  ....................
      71.87%     swapper  [kernel.kallsyms]  [k] native_safe_halt

This requires to change signature of symbol__init() to receive struct
perf_session_env *.

Reported-by: default avatarMinchan Kim <minchan@kernel.org>
Signed-off-by: default avatarNamhyung Kim <namhyung@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: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Minchan Kim <minchan@kernel.org>
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/1407825645-24586-14-git-send-email-namhyung@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent cb2ffae2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
	symbol_conf.priv_size = sizeof(struct annotation);
	symbol_conf.try_vmlinux_path = true;

	ret = symbol__init();
	ret = symbol__init(&annotate.session->header.env);
	if (ret < 0)
		goto out_delete;

+1 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ int cmd_buildid_cache(int argc, const char **argv,
			return -1;
	}

	if (symbol__init() < 0)
	if (symbol__init(session ? &session->header.env : NULL) < 0)
		goto out;

	setup_pager();
+1 −1
Original line number Diff line number Diff line
@@ -1143,7 +1143,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)

	argc = parse_options(argc, argv, options, diff_usage, 0);

	if (symbol__init() < 0)
	if (symbol__init(NULL) < 0)
		return -1;

	if (data_init(argc, argv) < 0)
+1 −1
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
	if (inject.session == NULL)
		return -ENOMEM;

	if (symbol__init() < 0)
	if (symbol__init(&inject.session->header.env) < 0)
		return -1;

	ret = __cmd_inject(&inject);
+2 −2
Original line number Diff line number Diff line
@@ -692,7 +692,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
		usage_with_options(kmem_usage, kmem_options);

	if (!strncmp(argv[0], "rec", 3)) {
		symbol__init();
		symbol__init(NULL);
		return __cmd_record(argc, argv);
	}

@@ -700,7 +700,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
	if (session == NULL)
		return -ENOMEM;

	symbol__init();
	symbol__init(&session->header.env);

	if (!strcmp(argv[0], "stat")) {
		if (cpu__setup_cpunode_map())
Loading