All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for He Kuang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: wangnan0@huawei.com, acme@redhat.com, mingo@kernel.org,
	tglx@linutronix.de, namhyung@kernel.org,
	masami.hiramatsu.pt@hitachi.com, hpa@zytor.com,
	hekuang@huawei.com, a.p.zijlstra@chello.nl,
	linux-kernel@vger.kernel.org
Subject: [tip:perf/core] perf probe: Fix failure to probe events on arm
Date: Thu, 25 Jun 2015 00:57:55 -0700	[thread overview]
Message-ID: <tip-7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6@git.kernel.org> (raw)
In-Reply-To: <1434595750-129791-1-git-send-email-hekuang@huawei.com>

Commit-ID:  7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6
Gitweb:     http://git.kernel.org/tip/7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Thu, 18 Jun 2015 02:49:10 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 23 Jun 2015 18:21:44 -0300

perf probe: Fix failure to probe events on arm

Fix failure to probe events on arm, the problem was introduced by commit
5a51fcd1f30c ("perf probe: Skip kernel symbols which is out of .text").

For some architectures, the '_etext' label is not in the .text section
(in the .notes section for arm/arm64).  Labels out of the .text section
are not loaded as symbols and we get a zero value when looking up its
addresses, which causes all events to be wrongly skipped.

This patch skips checking the text address range when failing to get the
address of '_etext' and thus fixes the problem.

The problem can be reproduced on arm as follows:

  # perf probe --add='generic_perform_write'
  generic_perform_write+0 is out of .text, skip it.
  Probe point 'generic_perform_write' not found.
    Error: Failed to add events.

After this patch:

  # perf probe --add='generic_perform_write'
  Added new event:
    probe:generic_perform_write (on generic_perform_write)

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

    perf record -e probe:generic_perform_write -aR sleep 1

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-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/1434595750-129791-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 076527b..381f23a 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -249,8 +249,12 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
 static bool kprobe_blacklist__listed(unsigned long address);
 static bool kprobe_warn_out_range(const char *symbol, unsigned long address)
 {
+	u64 etext_addr;
+
 	/* Get the address of _etext for checking non-probable text symbol */
-	if (kernel_get_symbol_address_by_name("_etext", false) < address)
+	etext_addr = kernel_get_symbol_address_by_name("_etext", false);
+
+	if (etext_addr != 0 && etext_addr < address)
 		pr_warning("%s is out of .text, skip it.\n", symbol);
 	else if (kprobe_blacklist__listed(address))
 		pr_warning("%s is blacklisted function, skip it.\n", symbol);

      parent reply	other threads:[~2015-06-25  7:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15  8:06 [PATCH] perf probe: Fix failure to probe events on arm He Kuang
2015-06-15 14:49 ` Arnaldo Carvalho de Melo
2015-06-16  6:05   ` Masami Hiramatsu
2015-06-16 13:39     ` Arnaldo Carvalho de Melo
2015-06-16 15:26   ` hekuang
2015-06-17  8:52     ` Masami Hiramatsu
2015-06-17  9:43       ` He Kuang
2015-06-17 11:18         ` Masami Hiramatsu
2015-06-18  2:49           ` [PATCH v2] " He Kuang
2015-06-19 21:08             ` Arnaldo Carvalho de Melo
2015-06-23  3:07               ` Masami Hiramatsu
2015-06-23  3:07             ` Masami Hiramatsu
2015-06-25  7:57             ` 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-7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6@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 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.