Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1553587

[PATCH perf/core 1/4] perf-probe: Fix to show correct locations for events on modules

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news.panservice.it!bofh.it!news.nic.it!robomod
From Masami Hiramatsu <mhiramat@kernel.org>
Newsgroups linux.kernel
Subject [PATCH perf/core 1/4] perf-probe: Fix to show correct locations for events on modules
Date Sat, 07 Jan 2017 06:30:02 +0100
Message-ID <sWRJM-4oE-5@gated-at.bofh.it> (permalink)
References <sWRJL-4oE-3@gated-at.bofh.it>
X-Original-To Arnaldo Carvalho de Melo <acme@kernel.org>
X-Mailer git-send-email 2.9.3
User-Agent StGit/0.17.1-dirty
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 49
Organization linux.* mail to news gateway
X-Original-Cc Masami Hiramatsu <mhiramat@kernel.org>, 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>
X-Original-Date Sat, 7 Jan 2017 14:25:09 +0900
X-Original-Message-ID <148376669886.25966.17841653117657415248.stgit@devbox>
X-Original-References <148376662676.25966.3739385839519573153.stgit@devbox>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1553587

Show key headers only | View raw


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.

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;

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH perf/core 1/4] perf-probe: Fix to show correct locations for events on modules Masami Hiramatsu <mhiramat@kernel.org> - 2017-01-07 06:30 +0100
  Re: [PATCH perf/core 1/4] perf-probe: Fix to show correct locations  for events on modules Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-10 14:20 +0100
    Re: [PATCH perf/core 1/4] perf-probe: Fix to show correct locations  for events on modules Masami Hiramatsu <mhiramat@kernel.org> - 2017-01-10 15:20 +0100
    Re: [PATCH perf/core 1/4] perf-probe: Fix to show correct locations  for events on modules Masami Hiramatsu <mhiramat@kernel.org> - 2017-01-11 01:00 +0100

csiph-web