linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for He Kuang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com,
	mingo@kernel.org, wangnan0@huawei.com, tglx@linutronix.de,
	a.p.zijlstra@chello.nl, hekuang@huawei.com, namhyung@kernel.org,
	hpa@zytor.com, acme@redhat.com
Subject: [tip:perf/core] perf probe: Fix failure to add multiple probes without debuginfo
Date: Sun, 22 Mar 2015 03:14:55 -0700	[thread overview]
Message-ID: <tip-0560a0c4a12a45def9700e7ec3215da102cf914b@git.kernel.org> (raw)
In-Reply-To: <1426816616-2394-1-git-send-email-hekuang@huawei.com>

Commit-ID:  0560a0c4a12a45def9700e7ec3215da102cf914b
Gitweb:     http://git.kernel.org/tip/0560a0c4a12a45def9700e7ec3215da102cf914b
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Fri, 20 Mar 2015 09:56:56 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 21 Mar 2015 14:53:21 -0300

perf probe: Fix failure to add multiple probes without debuginfo

Perf tries to find probe function addresses from map when debuginfo
could not be found.

To the first added function, the value of ref_reloc_sym was set in
maps__set_kallsyms_ref_reloc_sym() and can be obtained from
host_machine->kmaps->maps. After that, new maps are added to
host_machine->kmaps->maps in dso__load_kcore(), all these new added maps
do not have a valid ref_reloc_sym.

When adding a second function, get_target_map() may get a map without
valid ref_reloc_sym, and raise the error "Relocated base symbol is not
found".

Fix this by using kernel_get_ref_reloc_sym() to get ref_reloc_sym.

This problem can be reproduced as following:

  $ perf probe --add='sys_write' --add='sys_open'
  Relocated base symbol is not found!
    Error: Failed to add events.

After this patch:

  $ perf probe --add='sys_write' --add='sys_open'
  Added new event:
    probe:sys_write      (on sys_write)

  You can now use it in all perf tools, such as:

      perf record -e probe:sys_write -aR sleep 1

  Added new event:
    probe:sys_open       (on sys_open)

  You can now use it in all perf tools, such as:

      perf record -e probe:sys_open -aR sleep 1

Signed-off-by: He Kuang <hekuang@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426816616-2394-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index f272a71..6b95985 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2507,7 +2507,6 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
 					    int max_tevs, const char *target)
 {
 	struct map *map = NULL;
-	struct kmap *kmap = NULL;
 	struct ref_reloc_sym *reloc_sym = NULL;
 	struct symbol *sym;
 	struct probe_trace_event *tev;
@@ -2540,8 +2539,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
 	}
 
 	if (!pev->uprobes && !pp->retprobe) {
-		kmap = map__kmap(map);
-		reloc_sym = kmap->ref_reloc_sym;
+		reloc_sym = kernel_get_ref_reloc_sym();
 		if (!reloc_sym) {
 			pr_warning("Relocated base symbol is not found!\n");
 			ret = -EINVAL;

      parent reply	other threads:[~2015-03-22 10:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19  9:23 [PATCH] perf probe: Fix failure to add multiple probes without debuginfo He Kuang
2015-03-19 10:02 ` He Kuang
2015-03-19 13:59   ` Arnaldo Carvalho de Melo
2015-03-20  1:56     ` [PATCHv2] " He Kuang
2015-03-20  7:42       ` Masami Hiramatsu
2015-03-20 13:50         ` Arnaldo Carvalho de Melo
2015-03-21 12:19           ` Masami Hiramatsu
2015-03-21 17:54             ` Arnaldo Carvalho de Melo
2015-03-22 10:14       ` tip-bot for He Kuang [this message]

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=tip-0560a0c4a12a45def9700e7ec3215da102cf914b@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hekuang@huawei.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).