public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: leo.yan@linaro.org
Cc: acme@redhat.com, Jiri Olsa <jolsa@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Coresight ML <coresight@lists.linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: Question: perf dso support for /proc/kallsyms
Date: Wed, 7 Nov 2018 15:10:06 +0100	[thread overview]
Message-ID: <20181107141006.GD12870@krava> (raw)
In-Reply-To: <20181102025516.GA25374@leoy-ThinkPad-X240s>

On Fri, Nov 02, 2018 at 10:55:16AM +0800, leo.yan@linaro.org wrote:
> Hi all,
> 
> Now I found that if use the command 'perf script' for Arm CoreSight trace
> data, it fails to parse kernel symbols if we don't specify kernel vmlinux
> file.   So when we don't specify kernel symbol files then perf tool will
> roll back to use /proc/kallsyms for kernel symbols parsing, as result it will
> run into below flow:

yep, AFAIK if there's no vmlinux found we fallback to /proc/kallsyms

> 
>   thread__find_addr_map(thread, cpumode, MAP__FUNCTION, address, &al);
>   map__load(al.map);
>   dso__data_read_offset(al.map->dso, machine, offset, buffer, size);
>     `-> data_read_offset()

so what is the actual error you see in the perf script?
unresolved samples? could you please describe your config
and workload?

thanks,
jirka

> 
> I can observe the function data_read_offset() returns failure, this is caused
> by checking the offset sanity "if (offset > dso->data.file_size)"  (I pasted
> the whole function code at below in case you want to get more context for it),
> but if perf use "/proc/kallsyms" to load kernel symbols, the variable
> 'dso->data.file_size' will be set to zero thus the sanity checking always
> thinks the offset is out of the file size bound.
> 
> Now I still don't understand how the dso/map support "/proc/kallsyms" and
> have no idea to fix this issue, though I spent some time to look into it.
> 
> Could you give some suggestion for this?  Or even better if you have fixing
> for this, I am glad to test at my side.
> 
> static ssize_t data_read_offset(struct dso *dso, struct machine *machine,
>                                 u64 offset, u8 *data, ssize_t size)
> {
>         if (data_file_size(dso, machine))
>                 return -1;
> 
>         /* Check the offset sanity. */
>         if (offset > dso->data.file_size)
>                 return -1;
> 
>         if (offset + size < offset)
>                 return -1;
> 
>         return cached_read(dso, machine, offset, data, size);
> }
> 
> Thanks,
> Leo Yan

  parent reply	other threads:[~2018-11-07 14:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02  2:55 Question: perf dso support for /proc/kallsyms leo.yan
2018-11-02 12:08 ` Al Grant
2018-11-02 13:46   ` leo.yan
2018-11-02 14:12     ` Al Grant
2018-11-02 14:43       ` leo.yan
2018-11-02 13:08 ` Mike Leach
2018-11-02 14:02   ` leo.yan
2018-11-07  3:33 ` leo.yan
2018-11-07 14:10 ` Jiri Olsa [this message]
2018-11-08  8:51   ` leo.yan
2018-11-09  8:11     ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181107141006.GD12870@krava \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=coresight@lists.linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox