From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752206AbdHBHfX (ORCPT ); Wed, 2 Aug 2017 03:35:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54636 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752065AbdHBHfV (ORCPT ); Wed, 2 Aug 2017 03:35:21 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C88FAF04CF Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jolsa@redhat.com Date: Wed, 2 Aug 2017 09:35:18 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH v1 02/15] perf, tools: Tighten detection of BPF events Message-ID: <20170802073518.GC13890@krava> References: <20170724234015.5165-1-andi@firstfloor.org> <20170724234015.5165-3-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170724234015.5165-3-andi@firstfloor.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 02 Aug 2017 07:35:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 24, 2017 at 04:40:02PM -0700, Andi Kleen wrote: > From: Andi Kleen > > perf stat -e cpu/uops_executed.core,cmask=1/ > > would be detected as a BPF source event because the .c matches the .c > source BPF pattern. > > Add lookahead to the BPF patterns and reject them if they are followed > by more letters. > > Signed-off-by: Andi Kleen I don't have the llvm/bpf toolchain, so can't test that side, but Arnaldo will run it for sure ;-) anyway looks ok to me: Acked-by: Jiri Olsa thanks, jirka > --- > tools/perf/util/parse-events.l | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l > index 660fca05bc93..7fa3f2e851b0 100644 > --- a/tools/perf/util/parse-events.l > +++ b/tools/perf/util/parse-events.l > @@ -182,9 +182,13 @@ modifier_bp [rwx]{1,3} > REWIND(0); > } > > +({bpf_object}|{bpf_source})/[^a-z] { > + BEGIN(INITIAL); > + REWIND(1); > + return PE_EVENT_NAME; > + } > + > {event_pmu} | > -{bpf_object} | > -{bpf_source} | > {event} { > BEGIN(INITIAL); > REWIND(1); > @@ -307,8 +311,8 @@ r{num_raw_hex} { return raw(yyscanner); } > {num_hex} { return value(yyscanner, 16); } > > {modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } > -{bpf_object} { return str(yyscanner, PE_BPF_OBJECT); } > -{bpf_source} { return str(yyscanner, PE_BPF_SOURCE); } > +{bpf_object}/[^a-z] { return str(yyscanner, PE_BPF_OBJECT); } > +{bpf_source}/[^a-z] { return str(yyscanner, PE_BPF_SOURCE); } > {name} { return pmu_str_check(yyscanner); } > "/" { BEGIN(config); return '/'; } > - { return '-'; } > -- > 2.9.4 >