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


Groups > linux.kernel > #1170352

Re: [PATCH v2] perf probe: Fix failure to probe events on arm

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] perf probe: Fix failure to probe events on arm
Date Tue, 23 Jun 2015 05:10:01 +0200
Message-ID <pEmKZ-6Ru-9@gated-at.bofh.it> (permalink)
References <pCjxU-8bm-17@gated-at.bofh.it> <pCy3U-3Ni-3@gated-at.bofh.it>
X-Original-To He Kuang <hekuang@huawei.com>, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org
Organization Hitachi, Ltd., Japan
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version 1.0
Content-Type text/plain; charset=iso-2022-jp
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 70
X-Original-Cc wangnan0@huawei.com, linux-kernel@vger.kernel.org
X-Original-Date Tue, 23 Jun 2015 12:07:33 +0900
X-Original-Message-ID <5588CD75.7080701@hitachi.com>
X-Original-References <5581578A.9060208@hitachi.com> <1434595750-129791-1-git-send-email-hekuang@huawei.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1170352

Show key headers only | View raw


On 2015/06/18 11:49, He Kuang wrote:
> Fix failure to probe events on arm, problem is introduced by commit
> 5a51fcd1f30c ("perf probe: Skip kernel symbols which is out of
> .text"). For some architectures, label '_etext' is not in the .text
> section(in .notes section for arm/arm64). Label out of .text section is
> not loaded as symbols and we got a zero value when look up its address,
> which causes all events be wrongly skiped.
> 
> This patch skip checking text address range when failed to get the
> address of '_etext' and fixes the problem.
> 
> Problem can be reproduced on arm as following:
> 
>   # 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

Looks good to me :)

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thanks!

> 
> Signed-off-by: He Kuang <hekuang@huawei.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);
> 


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

Re: [PATCH v2] perf probe: Fix failure to probe events on arm Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-06-23 05:10 +0200

csiph-web