Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753902AbbGALOp (ORCPT ); Wed, 1 Jul 2015 07:14:45 -0400 Received: from mail7.hitachi.co.jp ([133.145.228.42]:53388 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753931AbbGALO2 (ORCPT ); Wed, 1 Jul 2015 07:14:28 -0400 Message-ID: <5593CB8C.4050506@hitachi.com> Date: Wed, 01 Jul 2015 20:14:20 +0900 From: Masami Hiramatsu 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 To: He Kuang , 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 References: <1435741539-44100-1-git-send-email-hekuang@huawei.com> <1435741539-44100-2-git-send-email-hekuang@huawei.com> In-Reply-To: <1435741539-44100-2-git-send-email-hekuang@huawei.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3042 Lines: 87 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 Thank you! > > Signed-off-by: He Kuang > --- > 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 -- 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/