Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752479AbbFYH7j (ORCPT ); Thu, 25 Jun 2015 03:59:39 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36462 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbbFYH7b (ORCPT ); Thu, 25 Jun 2015 03:59:31 -0400 Date: Thu, 25 Jun 2015 00:57:55 -0700 From: tip-bot for He Kuang Message-ID: 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 Reply-To: wangnan0@huawei.com, masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, acme@redhat.com, mingo@kernel.org, tglx@linutronix.de, a.p.zijlstra@chello.nl, hpa@zytor.com, hekuang@huawei.com, linux-kernel@vger.kernel.org In-Reply-To: <1434595750-129791-1-git-send-email-hekuang@huawei.com> References: <1434595750-129791-1-git-send-email-hekuang@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Fix failure to probe events on arm Git-Commit-ID: 7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2961 Lines: 71 Commit-ID: 7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6 Gitweb: http://git.kernel.org/tip/7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6 Author: He Kuang AuthorDate: Thu, 18 Jun 2015 02:49:10 +0000 Committer: Arnaldo Carvalho de Melo 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 Acked-by: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1434595750-129791-1-git-send-email-hekuang@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/