From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <mhiramat@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: Tue, 10 Jan 2017 10:18:35 -0300 [thread overview]
Message-ID: <20170110131835.GA24073@kernel.org> (raw)
In-Reply-To: <148376669886.25966.17841653117657415248.stgit@devbox>
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?
Running with 'perf probe -vv -m i915 chv_prepare_pll' to get more
debugging info:
Failed to get build-id from i915.
Cache open error: -1
Open Debuginfo file: /lib/modules/4.9.0+/kernel/drivers/gpu/drm/i915/i915.ko
Try to find probe point from debuginfo.
Matched function: chv_prepare_pll [6ce853]
found inline addr: 0x883a0
Probe point found: chv_prepare_pll+0
Found 1 probe_trace_events.
Opening /sys/kernel/debug/tracing//kprobe_events write=1
Writing event: p:probe/chv_prepare_pll i915:chv_prepare_pll+0
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 ~]#
- Arnaldo
> E.g. without this fix, events on module seems wrong,
> but other cases (kernel and user space) looks good.
>
> # perf probe -l
> probe:SyS_remap_file_pages (on SyS_remap_file_pages@mm/mmap.c)
> probe:chv_prepare_pll (on intel_plane_atomic_get_property+16@drm/i915/intel_atomic_plane.c in i915)
> probe_perf:alias_lookup (on alias_lookup@util/alias.c in /home/mhiramat/ksrc/linux/tools/perf/perf)
>
> With this fix, all cases are OK now.
>
> # perf probe -l
> probe:SyS_remap_file_pages (on SyS_remap_file_pages@mm/mmap.c)
> probe:chv_prepare_pll (on chv_prepare_pll@gpu/drm/i915/intel_display.c in i915)
> probe_perf:alias_lookup (on alias_lookup@util/alias.c in /home/mhiramat/ksrc/linux/tools/perf/perf)
>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> tools/perf/util/probe-finder.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index df4debe..0278fe1 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1543,16 +1543,12 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,
> Dwarf_Addr _addr = 0, baseaddr = 0;
> const char *fname = NULL, *func = NULL, *basefunc = NULL, *tmp;
> int baseline = 0, lineno = 0, ret = 0;
> - bool reloc = false;
>
> -retry:
> + /* We always need to relocate the address for aranges */
> + if (debuginfo__get_text_offset(dbg, &baseaddr) == 0)
> + addr += baseaddr;
> /* Find cu die */
> if (!dwarf_addrdie(dbg->dbg, (Dwarf_Addr)addr, &cudie)) {
> - if (!reloc && debuginfo__get_text_offset(dbg, &baseaddr) == 0) {
> - addr += baseaddr;
> - reloc = true;
> - goto retry;
> - }
> pr_warning("Failed to find debug information for address %lx\n",
> addr);
> ret = -EINVAL;
next prev parent reply other threads:[~2017-01-10 13:18 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 [this message]
2017-01-10 14:15 ` Masami Hiramatsu
2017-01-10 23:51 ` Masami Hiramatsu
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=20170110131835.GA24073@kernel.org \
--to=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.