diff options
author | Jiri Olsa <jolsa@kernel.org> | 2018-03-12 11:24:06 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-03-16 12:56:25 -0400 |
commit | c192524e6fe8a4bd18f2549f9556b81ed9e05a86 (patch) | |
tree | cf06356bbb211b59975f46e011d8f8412d9c8096 | |
parent | 26e4711fc8352252f474a02429d7495652c4aef7 (diff) |
perf machine: Fix mmap name setup
Leo reported broken -k option behavior. The reason is that we used
symbol_conf.vmlinux_name as a source for mmap event name, but in fact
it's a vmlinux path.
Moving the symbol_conf.vmlinux_name check for both host and guest to the
proper place and out of the machine__set_mmap_name function.
Reported-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: commit ("8c7f1bb37b29 perf machine: Move kernel mmap name into struct machine")
Link: http://lkml.kernel.org/r/20180312152406.10141-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/machine.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 43fbbee409ec..2eca8478e24f 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -50,21 +50,13 @@ static void machine__threads_init(struct machine *machine) | |||
50 | 50 | ||
51 | static int machine__set_mmap_name(struct machine *machine) | 51 | static int machine__set_mmap_name(struct machine *machine) |
52 | { | 52 | { |
53 | if (machine__is_host(machine)) { | 53 | if (machine__is_host(machine)) |
54 | if (symbol_conf.vmlinux_name) | 54 | machine->mmap_name = strdup("[kernel.kallsyms]"); |
55 | machine->mmap_name = strdup(symbol_conf.vmlinux_name); | 55 | else if (machine__is_default_guest(machine)) |
56 | else | 56 | machine->mmap_name = strdup("[guest.kernel.kallsyms]"); |
57 | machine->mmap_name = strdup("[kernel.kallsyms]"); | 57 | else if (asprintf(&machine->mmap_name, "[guest.kernel.kallsyms.%d]", |
58 | } else if (machine__is_default_guest(machine)) { | 58 | machine->pid) < 0) |
59 | if (symbol_conf.default_guest_vmlinux_name) | 59 | machine->mmap_name = NULL; |
60 | machine->mmap_name = strdup(symbol_conf.default_guest_vmlinux_name); | ||
61 | else | ||
62 | machine->mmap_name = strdup("[guest.kernel.kallsyms]"); | ||
63 | } else { | ||
64 | if (asprintf(&machine->mmap_name, "[guest.kernel.kallsyms.%d]", | ||
65 | machine->pid) < 0) | ||
66 | machine->mmap_name = NULL; | ||
67 | } | ||
68 | 60 | ||
69 | return machine->mmap_name ? 0 : -ENOMEM; | 61 | return machine->mmap_name ? 0 : -ENOMEM; |
70 | } | 62 | } |
@@ -794,9 +786,15 @@ static struct dso *machine__get_kernel(struct machine *machine) | |||
794 | struct dso *kernel; | 786 | struct dso *kernel; |
795 | 787 | ||
796 | if (machine__is_host(machine)) { | 788 | if (machine__is_host(machine)) { |
789 | if (symbol_conf.vmlinux_name) | ||
790 | vmlinux_name = symbol_conf.vmlinux_name; | ||
791 | |||
797 | kernel = machine__findnew_kernel(machine, vmlinux_name, | 792 | kernel = machine__findnew_kernel(machine, vmlinux_name, |
798 | "[kernel]", DSO_TYPE_KERNEL); | 793 | "[kernel]", DSO_TYPE_KERNEL); |
799 | } else { | 794 | } else { |
795 | if (symbol_conf.default_guest_vmlinux_name) | ||
796 | vmlinux_name = symbol_conf.default_guest_vmlinux_name; | ||
797 | |||
800 | kernel = machine__findnew_kernel(machine, vmlinux_name, | 798 | kernel = machine__findnew_kernel(machine, vmlinux_name, |
801 | "[guest.kernel]", | 799 | "[guest.kernel]", |
802 | DSO_TYPE_GUEST_KERNEL); | 800 | DSO_TYPE_GUEST_KERNEL); |