From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: He Kuang <hekuang@huawei.com>,
acme@kernel.org, a.p.zijlstra@chello.nl, mingo@redhat.com,
namhyung@kernel.org, jolsa@kernel.org
Cc: wangnan0@huawei.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] perf probe: Fix failure to probe online module
Date: Wed, 01 Jul 2015 20:14:20 +0900 [thread overview]
Message-ID: <5593CB8C.4050506@hitachi.com> (raw)
In-Reply-To: <1435741539-44100-2-git-send-email-hekuang@huawei.com>
On 2015/07/01 18:05, He Kuang wrote:
> Kernel module has the type DSO_TYPE_USER, the check on dso type in
> kernel_get_module_dso() disable openning debuginfo of online kernel
> modules.
>
> Problem can be reproduced as:
>
> $ insmod test_bpf.ko
>
> $ perf probe -v -m test_bpf --add='skb_is_nonlinear'
>
> probe-definition(0): skb_is_nonlinear
> symbol:skb_is_nonlinear file:(null) line:0 offset:0 return:0 lazy:(null)
> 0 arguments
> Failed to find module test_bpf.
> Could not open debuginfo. Try to use symbols.
> Failed to find symbol skb_is_nonlinear in test_bpf
> Error: Failed to add events. Reason: No such file or directory (Code: -2)
>
> Infact kernel_get_module_dso() function is called in perf-probe, in this
> condition, machine->dsos list contains only dsos which is either kmod or
> kernel loaded by machine__create_kernel_maps(), so there's no need to
> pick away the non-kmod user type dsos.
>
> This patch removes the check.
>
> After this patch:
>
> $ perf probe -v -m test_bpf --add='skb_is_nonlinear'
>
> probe-definition(0): skb_is_nonlinear
> symbol:skb_is_nonlinear file:(null) line:0 offset:0 return:0 lazy:(null)
> 0 arguments
> Open Debuginfo file: /lib/modules/4.1.0+/test_bpf.ko
> Try to find probe point from debuginfo.
> Matched function: skb_is_nonlinear
> found inline addr: 0x10ab3
> Probe point found: test_bpf_init+585
> Found 1 probe_trace_events.
> Opening /sys/kernel/debug/tracing/kprobe_events write=1
> Added new event:
> Writing event: p:probe/skb_is_nonlinear test_bpf:test_bpf_init+585
> probe:skb_is_nonlinear (on skb_is_nonlinear in test_bpf)
>
> You can now use it in all perf tools, such as:
>
> perf record -e probe:skb_is_nonlinear -aR sleep 1
Oops, OK. Without debuginfo, that always fails. I've tested on my machine.
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Thank you!
>
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
> tools/perf/util/probe-event.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 381f23a..8ad2743 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -275,8 +275,6 @@ static int kernel_get_module_dso(const char *module, struct dso **pdso)
>
> if (module) {
> list_for_each_entry(dso, &host_machine->dsos.head, node) {
> - if (!dso->kernel)
> - continue;
> if (strncmp(dso->short_name + 1, module,
> dso->short_name_len - 2) == 0)
> goto found;
>
--
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
next prev parent reply other threads:[~2015-07-01 11:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 9:05 [PATCH 1/4] perf record: Use %ld for long type sample counter He Kuang
2015-07-01 9:05 ` [PATCH 2/4] perf probe: Fix failure to probe online module He Kuang
2015-07-01 11:14 ` Masami Hiramatsu [this message]
2015-07-01 9:05 ` [PATCH 3/4] perf probe: Enable --range option according to libdw version He Kuang
2015-07-01 11:02 ` Masami Hiramatsu
2015-07-01 9:05 ` [PATCH 4/4] perf probe: Add failure check when show variable range He Kuang
2015-07-01 11:00 ` Masami Hiramatsu
2015-07-01 11:53 ` [PATCH v2 1/2] perf probe: Enable --range option according to libdw version He Kuang
2015-07-01 11:53 ` [PATCH v2 2/2] perf probe: Add failure check when show variable range He Kuang
2015-07-01 12:00 ` [PATCH 4/4] " He Kuang
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=5593CB8C.4050506@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--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.