diff options
author | He Kuang <hekuang@huawei.com> | 2015-06-18 04:49:10 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-23 23:21:44 +0200 |
commit | 7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6 (patch) | |
tree | 3fca3f14138d9a2ddcd2920cdc947c241ada4938 /tools | |
parent | perf tools: Print a newline before dumping Aggregated stats (diff) | |
download | linux-7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6.tar.xz linux-7c31bb8c95ed269062ff7c7cc4a28b84a2b0f3a6.zip |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/probe-event.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 076527b639bd..381f23a443c7 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); |