Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753643AbbF0IbO (ORCPT ); Sat, 27 Jun 2015 04:31:14 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:42821 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbbF0IbG (ORCPT ); Sat, 27 Jun 2015 04:31:06 -0400 Message-ID: <558E5F42.1060705@hitachi.com> Date: Sat, 27 Jun 2015 17:30:58 +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: "Wangnan (F)" , acme@kernel.org, ast@plumgrid.com, brendan.d.gregg@gmail.com, daniel@iogearbox.net, namhyung@kernel.org, paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, jolsa@kernel.org, dsahern@gmail.com CC: linux-kernel@vger.kernel.org, lizefan@huawei.com, hekuang@huawei.com, xiakaixu@huawei.com, pi3orama@163.com, cti.systems-productivity-manager.ts@hitachi.com Subject: Re: [RFC PATCH 1/3] perf probe: Init symbol as kprobe if any pev is kprobe References: <1435228645-116055-1-git-send-email-wangnan0@huawei.com> <1435228645-116055-2-git-send-email-wangnan0@huawei.com> <558E50C2.2030807@hitachi.com> <558E520E.6070301@huawei.com> In-Reply-To: <558E520E.6070301@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2891 Lines: 93 Hi Wang, On 2015/06/27 16:34, Wangnan (F) wrote: > > > On 2015/6/27 15:29, Masami Hiramatsu wrote: >> On 2015/06/25 19:37, Wang Nan wrote: >>> Before this patch, add_perf_probe_events() init symbol maps only for >>> uprobe if the first pev passed to it is a uprobe event. However, with >>> the incoming BPF uprobe support, now it will be possible to pass an >>> array with combined kprobe and uprobe events to add_perf_probe_events(). >> This description is not correct. Actually, add_perf_probe_events already >> supports mix of uprobes and kprobes. However, from the command line syntax >> constrains the first elements of the probe_event arrays must be kprobes. >> So, if the array starts with uprobes, no kprobes should be there. >> >>> This patch check all pevs instead of the first one, and init kernel >>> symbol if any events is not uprobe. >> Anyway, I prefer to call init_symbol_maps() with "false" :) > > I also prefer "false", so I try to find whether all events are uprobe > instead > of init_symbol_maps(true). > > So for this patch only commit message needs to be corrected, the code is > no problem, right? > No, I meant you just need to change one line, as below. - ret = init_symbol_maps(pevs->uprobes); + ret = init_symbol_maps(false); That's enough, I don't like to introduce a bool flag and loop. Thanks, > Thank you. > >> Thank you, >> >>> Signed-off-by: Wang Nan >>> --- >>> tools/perf/util/probe-event.c | 15 ++++++++++++++- >>> 1 file changed, 14 insertions(+), 1 deletion(-) >>> >>> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c >>> index b386d2f..a2b3026 100644 >>> --- a/tools/perf/util/probe-event.c >>> +++ b/tools/perf/util/probe-event.c >>> @@ -2802,8 +2802,21 @@ int cleanup_perf_probe_event(struct perf_probe_event *pev) >>> int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, bool cleanup) >>> { >>> int i, ret; >>> + bool user_only = true; >>> >>> - ret = init_symbol_maps(pevs->uprobes); >>> + /* If any pev is kprobe, init kernel symbols. */ >>> + for (i = 0; i < npevs; i++) { >>> + if (!pevs[i].uprobes) { >>> + user_only = false; >>> + break; >>> + } >>> + } >>> + >>> + /* >>> + * Compiler can drop user_only: >>> + * ret = init_symbol_maps(i >= npevs); >>> + */ >>> + ret = init_symbol_maps(user_only); >>> if (ret < 0) >>> return ret; >>> >>> >> > > > -- 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/