From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753243AbbFYKi0 (ORCPT ); Thu, 25 Jun 2015 06:38:26 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:23942 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbbFYKh5 (ORCPT ); Thu, 25 Jun 2015 06:37:57 -0400 From: Wang Nan To: , , , , , , , , , , CC: , , , , Subject: [RFC PATCH 1/3] perf probe: Init symbol as kprobe if any pev is kprobe Date: Thu, 25 Jun 2015 10:37:23 +0000 Message-ID: <1435228645-116055-2-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1435228645-116055-1-git-send-email-wangnan0@huawei.com> References: <1435228645-116055-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.200] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.558BD9F6.0076,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0efb2570ce4c36195362a5a0a78f1960 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 patch check all pevs instead of the first one, and init kernel symbol if any events is not uprobe. 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; -- 1.8.3.4