From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757396AbcIRKVu (ORCPT ); Sun, 18 Sep 2016 06:21:50 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:18303 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755474AbcIRKVs (ORCPT ); Sun, 18 Sep 2016 06:21:48 -0400 Subject: Re: [PATCH] perf, tools: Handle events including .c and .o To: Andi Kleen , References: <1474160566-8955-1-git-send-email-andi@firstfloor.org> CC: , , Andi Kleen , From: "Wangnan (F)" Message-ID: <57DE6A54.1000407@huawei.com> Date: Sun, 18 Sep 2016 18:20:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1474160566-8955-1-git-send-email-andi@firstfloor.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.57DE6A8B.0006,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: cf039023de53ae4567a7c37b05407f43 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/9/18 9:02, Andi Kleen wrote: > From: Andi Kleen > > This is a generic bug fix, but it helps with Sukadev's JSON event tree > where such events can happen. > > Any event inclduing a .c/.o/.bpf currently triggers BPF compilation or loading > and then an error. This can happen for some Intel JSON events, which cannot > be used. > > Fix the scanner to only match for .o or .c or .bpf at the end. > This will prevent loading multiple BPF scripts separated with comma, > but I assume this is acceptable. > > Cc: wangnan0@huawei.com > Cc: sukadev@linux.vnet.ibm.com > Signed-off-by: Andi Kleen I tested '.c' in middle of an event: # perf trace --event 'aaa.ccc' invalid or unsupported event: 'aaa.ccc' Run 'perf list' for a list of valid events ... It is not recongnized as a BPF source. So could you please provide an example to show how this potential bug breaks the parsing of new events? > --- > 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 7a2519435da0..64ca26e4ed2d 100644 > --- a/tools/perf/util/parse-events.l > +++ b/tools/perf/util/parse-events.l > @@ -162,8 +162,8 @@ modifier_bp [rwx]{1,3} > } > > {event_pmu} | > -{bpf_object} | > -{bpf_source} | > +({bpf_object}$) | > +({bpf_source}$) | What about putting '$' at the definition of bpf_xxx like this? diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 9f43fda..d9ff690 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]+ Thank you. > {event} { > BEGIN(INITIAL); > REWIND(1);