Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752989AbbFZORa (ORCPT ); Fri, 26 Jun 2015 10:17:30 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:63369 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752808AbbFZORJ (ORCPT ); Fri, 26 Jun 2015 10:17:09 -0400 From: Wang Nan To: , , , , , , , , , , CC: , , , , Subject: [RFC PATCH v9 49/50] perf probe: Init symbol as kprobe if any event is kprobe Date: Fri, 26 Jun 2015 14:15:54 +0000 Message-ID: <1435328155-87115-50-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1435328155-87115-1-git-send-email-wangnan0@huawei.com> References: <1435328155-87115-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.210] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1547 Lines: 49 Before this patch, add_perf_probe_events() init symbol maps only for uprobe if the first 'struct perf_probe_event' 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(). Check the first one only is not enough. This patch check all events in addition to the first one, and init kernel symbol if any event 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 ea08015..2739171 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2803,8 +2803,21 @@ 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 -- 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/