From: Masami Hiramatsu <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH perf/core 1/4] perf-probe: Fix to show correct locations for events on modules
Date: Wed, 11 Jan 2017 08:51:46 +0900 [thread overview]
Message-ID: <20170111085146.970454e330f36d5e9163daab@kernel.org> (raw)
In-Reply-To: <20170110131835.GA24073@kernel.org>
On Tue, 10 Jan 2017 10:18:35 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Em Sat, Jan 07, 2017 at 02:25:09PM +0900, Masami Hiramatsu escreveu:
> > Fix to show correct locations for events on modules by
> > relocating given address. Currently the relocation is
> > done when we failed to find the address in debuginfo,
> > but for modules it always makes a mistakes.
>
> Try to provide precise instructions on how to reproduce, for instance,
> here I'm not being able to reproduce:
>
> [root@jouet ~]# perf probe -m i915 chv_prepare_pll
> Added new event:
> probe:chv_prepare_pll (on chv_prepare_pll in i915)
>
> You can now use it in all perf tools, such as:
>
> perf record -e probe:chv_prepare_pll -aR sleep 1
>
> [root@jouet ~]# perf probe -l
> probe:chv_prepare_pll (on chv_prepare_pll in i915)
> probe:e1000_xmit_frame (on e1000_get_link_up_info_80003es2lan:7@intel/e1000e/80003es2lan.c in e1000e)
> [root@jouet ~]#
>
> So it doesn't seem to "always make mistakes", what are the precise
> conditions to reproduce this problem?
OK, I found mymistakes. chv_prepare_pll in my i915 module is optimized
and have isra.X suffix, so perf ends up with searching it in map.
(That issue is fixed in [3/4] in this series as you may know)
This happens when the module text size is enough big, bigger than
sh_addr, because original code retries with given address + sh_addr
if it failed to find CU DIE at the given address. Any address smaller
than sh_addr always fails and it retries.
On my environment, the sh_addr of ".text" section is 0x10030. Since
i915 is a huge kernel module, we can see this issue as below.
$ grep "[Tt] .*\[i915\]" /proc/kallsyms | sort | head -n1
ffffffffc0270000 t i915_switcheroo_can_switch [i915]
ffffffffc0270000 + 0x10030 = ffffffffc0280030, so we'll check
symbols cross this boundary.
$ grep "[Tt] .*\[i915\]" /proc/kallsyms | grep -B1 ^ffffffffc028 | head -n 2
ffffffffc027ff80 t haswell_init_clock_gating [i915]
ffffffffc0280110 t valleyview_init_clock_gating [i915]
So setup probes on both function and see what happen.
$ sudo ./perf probe -m i915 -a haswell_init_clock_gating -a valleyview_init_clock_gating
Added new events:
probe:haswell_init_clock_gating (on haswell_init_clock_gating in i915)
probe:valleyview_init_clock_gating (on valleyview_init_clock_gating in i915)
You can now use it in all perf tools, such as:
perf record -e probe:valleyview_init_clock_gating -aR sleep 1
$ sudo ./perf probe -l
probe:haswell_init_clock_gating (on haswell_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
probe:valleyview_init_clock_gating (on i915_vga_set_decode:4@gpu/drm/i915/i915_drv.c in i915)
As you can see, haswell_init_clock_gating is correctly shown, but
valleyview_init_clock_gating is not.
With this patch, both events shown correctly.
$ sudo ./perf probe -l
probe:haswell_init_clock_gating (on haswell_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
probe:valleyview_init_clock_gating (on valleyview_init_clock_gating@gpu/drm/i915/intel_pm.c in i915)
I'll update patch description and resend with fix of [4/4].
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2017-01-10 23:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-07 5:23 [PATCH perf/core 0/4] perf-probe: Fix and improve module probe events Masami Hiramatsu
2017-01-07 5:25 ` [PATCH perf/core 1/4] perf-probe: Fix to show correct locations for events on modules Masami Hiramatsu
2017-01-10 13:18 ` Arnaldo Carvalho de Melo
2017-01-10 14:15 ` Masami Hiramatsu
2017-01-10 23:51 ` Masami Hiramatsu [this message]
2017-01-07 5:26 ` [PATCH perf/core 2/4] perf-probe: Add error checks to offline probe post-processing Masami Hiramatsu
2017-01-07 5:27 ` [PATCH perf/core 3/4] perf-probe: Fix to probe on gcc generated functions in modules Masami Hiramatsu
2017-01-07 5:28 ` [PATCH perf/core 4/4] perf-probe: Find probe events without target module Masami Hiramatsu
2017-01-10 15:54 ` Masami Hiramatsu
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=20170111085146.970454e330f36d5e9163daab@kernel.org \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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