lkml.org 
[lkml]   [2015]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 11/18] perf script: Switch from perf.data's kallsyms to perf's symbol resolver
On Thu, Jul 23, 2015 at 10:58:24PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> We were storing a copy of kallsyms inside perf.data file so that we
> could resolve kernel addresses to function (start, name, mod) tuples,
> but that can be achieved using the symbol resolving routines we have
> in symbols.c, and that are used elsewhere in tools/perf.
>
> So, do just like 'perf trace' did and ask libtraceevent to use perf's
> symbol resolution routines.
>
> The next step is to just skip whatever kallsyms data is embedded in
> older perf.data files and finally to stop storing kallsyms in the perf
> data file, as the 20-bytes build-id stored in perf.data's header is
> enough to find out the right symtab (be it ELF, kcore, kallsyms, etc) to
> use.
>
> Acked-by: David Ahern <dsahern@gmail.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Link: http://lkml.kernel.org/n/tip-d0rtb8tk9j72pz0ehw5fnp24@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/builtin-script.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 24809787369f..2777c6444bc3 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -1830,6 +1830,13 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
> else
> symbol_conf.use_callchain = false;
>
> + if (pevent_set_function_resolver(session->tevent.pevent,
> + machine__resolve_kernel_addr,
> + &session->machines.host) < 0) {
> + pr_err("%s: failed to set libtraceevent function resolver\n", __func__);
> + return -1;
> + }
> +

got segfault because of this:

[jolsa@krava perf]$ ./perf record ls
[ perf record: Woken up 1 times to write data ]

SNIP

/proc/kcore requires CAP_SYS_RAWIO capability to access.
[ perf record: Captured and wrote 0.016 MB perf.data (7 samples) ]
[jolsa@krava perf]$ ./perf script
Segmentation fault (core dumped)

[jolsa@krava perf]$ gdb ./perf
GNU gdb (GDB) Fedora 7.9.1-17.fc22
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./perf...done.
(gdb) r script
Starting program: /home/jolsa/kernel/linux-perf/tools/perf/perf script
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-7.fc22.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after fork from child process 11230.

Program received signal SIGSEGV, Segmentation fault.
0x00000000004eeace in pevent_set_function_resolver (pevent=0x0, func=0x4a3197 <machine__resolve_kernel_addr>, priv=0x18e1f48) at event-parse.c:464
464 free(pevent->func_resolver);
Missing separate debuginfos, use: dnf debuginfo-install audit-libs-2.4.3-1.fc22.x86_64 bzip2-libs-1.0.6-14.fc22.x86_64 elfutils-libelf-0.163-1.fc22.x86_64 elfutils-libs-0.163-1.fc22.x86_64 libunwind-1.1-10.fc22.x86_64 nss-softokn-freebl-3.19.2-1.0.fc22.x86_64 numactl-libs-2.0.10-2.fc22.x86_64 perl-libs-5.20.2-326.fc22.x86_64 python-libs-2.7.10-4.fc22.x86_64 slang-2.3.0-2.fc22.x86_64 xz-libs-5.2.0-2.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64
(gdb)


I think 'session->tevent.pevent' gets initialized only for tracepoint, right?

jirka


\
 
 \ /
  Last update: 2015-08-03 20:01    [W:0.149 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site