Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934406AbcJQOxS (ORCPT ); Mon, 17 Oct 2016 10:53:18 -0400 Received: from terminus.zytor.com ([198.137.202.10]:52440 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932624AbcJQOxK (ORCPT ); Mon, 17 Oct 2016 10:53:10 -0400 Date: Mon, 17 Oct 2016 07:52:57 -0700 From: tip-bot for Wang Nan Message-ID: Cc: lizefan@huawei.com, ak@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, sukadev@linux.vnet.ibm.com, acme@redhat.com, jolsa@kernel.org, tglx@linutronix.de, mingo@kernel.org Reply-To: lizefan@huawei.com, ak@linux.intel.com, acme@redhat.com, jolsa@kernel.org, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, wangnan0@huawei.com, sukadev@linux.vnet.ibm.com In-Reply-To: <1475900185-37967-1-git-send-email-wangnan0@huawei.com> References: <1475900185-37967-1-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf jevents: Handle events including .c and .o Git-Commit-ID: 2d470b62fa24f8d0024e8d392d28814c287ee1f1 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2689 Lines: 74 Commit-ID: 2d470b62fa24f8d0024e8d392d28814c287ee1f1 Gitweb: http://git.kernel.org/tip/2d470b62fa24f8d0024e8d392d28814c287ee1f1 Author: Wang Nan AuthorDate: Sat, 8 Oct 2016 04:16:25 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 17 Oct 2016 11:24:18 -0300 perf jevents: Handle events including .c and .o This patch helps with Sukadev's vendor event tree where such events can happen. >From Andi Kleen: Any event including a .c/.o/.bpf currently triggers BPF compilation or loading and then an error. This can happen for some Intel vendor events, which cannot be used. This patch fixes this problem by forbidding BPF file patch containing '{', '}' and ',', make sure flex consumes the leading '{', instead of matching it using a BPF file path. Tested result: $ perf stat -e '{unc_p_clockticks,unc_p_power_state_occupancy.cores_c0}' -a -I 1000 invalid or unsupported event: '{unc_p_clockticks,unc_p_power_state_occupancy.cores_c0}' Run 'perf list' for a list of valid events (as expected, interperted as event) $ perf stat -e 'aaa.c' -a -I 1000 ERROR: problems with path aaa.c: No such file or directory (as expected, interpreted as BPF source) $ perf stat -e 'aaa.ccc' -a -I 1000 invalid or unsupported event: 'aaa.ccc' (as expected, interpreted as event) $ perf stat -e '{aaa.c}' -a -I 1000 ERROR: problems with path aaa.c: No such file or directory event syntax error: '{aaa.c}' (as expected, interpreted as BPF source) $ perf stat -e '{cycles,aaa.c}' -a -I 1000 ERROR: problems with path aaa.c: No such file or directory event syntax error: '{cycles,aaa.c}' (as expected, interpreted as BPF source) Signed-off-by: Wang Nan Tested-by: Arnaldo Carvalho de Melo Reported-by: Andi Kleen Cc: Jiri Olsa Cc: Sukadev Bhattiprolu Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1475900185-37967-1-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 9f43fda..660fca0 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -136,8 +136,8 @@ do { \ group [^,{}/]*[{][^}]*[}][^,{}/]* event_pmu [^,{}/]+[/][^/]*[/][^,{}/]* event [^,{}/]+ -bpf_object .*\.(o|bpf) -bpf_source .*\.c +bpf_object [^,{}]+\.(o|bpf) +bpf_source [^,{}]+\.c num_dec [0-9]+ num_hex 0x[a-fA-F0-9]+