Message ID | 20230525082902.25332-1-adrian.hunter@intel.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp213098vqr; Thu, 25 May 2023 01:51:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44V7vqxDxAUHfCoOBfowHTFcCLxWm938IuV6axXK5CTFpM5tjo4ywicyJoTjIi+KOMqbZ+ X-Received: by 2002:a05:6a20:72a8:b0:10c:1047:68ba with SMTP id o40-20020a056a2072a800b0010c104768bamr11991550pzk.35.1685004694646; Thu, 25 May 2023 01:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685004694; cv=none; d=google.com; s=arc-20160816; b=HNrqFKNAtgPIw2Z2ZOQzWHoY2/akhGnMu6YhhlR4QW1sJPl+68IdPWS1FhTl/F5qln Ajdjt+piCM5+BiOmXANCQplT2ijiMhJ56sqM3u0/25Flgjn+tVvfrMW8NoOC0rVYNdj9 1R0BdPa/Zf7OYgewIH3Dyy2S2zmFin8VU96NiAu9NAKhWlAYzVX/QFz6FbQ/GuCke5yQ c8G8EOpW+/xBQ8v7kPJDQceTNjjPwRRvjTqySSnOUMLSDZGGv31UlLzQYt3GIh/7Z3y9 hGgPNNjre7Zq0vU58s+EGXJxQ26km9e5tUZ5KDnkodUYn4W4qAzsY4Lcptv38alx8D4V vXcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=iaTYQtSF03KNQVpVMZs3WFBKCm5AWi/cLNPETAY+A1o=; b=JqDDjRT7QXQ54ljL/PXUEJlcZa3PqfAG8nmKiCwY+5HsoPwEiukpeDrAhMvgLpyJQl JgX+8Vw5FYb6pCc8Y1gjbovk1DQ7b8W2dJ8ed3yx4X/EIfffYNcr407r5++5EHaRtJcE /Z4ExGAtDubF2bZ7abWQC0IEWmy2pFxvwGxvE4jaEmYwRiBjvoRJ+RF8r+eryxRFPJ6J THQ5DONe2oig7GASc3cNQ1/d6GEHSClxXy4VCBNDI/lh4V3Kr2hh3+u7QzM+caI/6AmP j/sHRbS40ZeJr3Ea9wVTXr6z7iXBYvG3aqALcmQt58kuy909rtX3SQekTrl6+oHi82U5 6CGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Oa/X3pAI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a637b14000000b005347e036056si661961pgc.633.2023.05.25.01.51.20; Thu, 25 May 2023 01:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Oa/X3pAI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239832AbjEYI3V (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Thu, 25 May 2023 04:29:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239793AbjEYI3R (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 25 May 2023 04:29:17 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C4C3186; Thu, 25 May 2023 01:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685003356; x=1716539356; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=QHA0PUM2kozuFhevzuFcZbE8+0O6nv9jDPUSc6oHy+0=; b=Oa/X3pAI5cc/rRPJSSM1MKyWZ2WWWogCuk8mwtwS6mHLGtfyfb2cqvUh xOXZnEnjS/rx4AcOOD5yBnsSci8AWSHs7uHlyrgUrd9CweWYH8oc4zPjz yc4eKOUeXiKtq6OLcIyhwHfPGzu5v4GUG0j/HIRcO8EVooQjXzEV4VY53 0AzQFZZMcGgm6P3fyqXITxCFLLeDky37/9v8bwmGhbt7E4q/lk1y16J6e d/osCyYRcpaNVnSsM3YxyxJ/xqu1SAYJKGE/Kh2dFhS6EN3xaFruyIt1j UBUQySyii+c8iQ0EXt35smTv/uVYN64+FmAulk3COfMFhL+Wr9YqOa71O w==; X-IronPort-AV: E=McAfee;i="6600,9927,10720"; a="338400398" X-IronPort-AV: E=Sophos;i="6.00,190,1681196400"; d="scan'208";a="338400398" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2023 01:29:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10720"; a="707914632" X-IronPort-AV: E=Sophos;i="6.00,190,1681196400"; d="scan'208";a="707914632" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.251.208.63]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2023 01:29:12 -0700 From: Adrian Hunter <adrian.hunter@intel.com> To: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH V3 0/1] perf tools: Allow config terms with breakpoints Date: Thu, 25 May 2023 11:29:01 +0300 Message-Id: <20230525082902.25332-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766855122546125064?= X-GMAIL-MSGID: =?utf-8?q?1766855482996960258?= |
Series |
perf tools: Allow config terms with breakpoints
|
|
Message
Adrian Hunter
May 25, 2023, 8:29 a.m. UTC
Hi Here is a patch (V3) to the event parser for breakpoint events. I am not that familiar with flex / bison, but it seemed to need trailing context to stop the mem event colon and slash delimiters from getting mixed up with delimiters for config terms or event modifiers. Please look closely at that. Changes in V3: Add Ian's Reviewed-by Re-base Changes in V2: Add comments to tools/perf/util/parse-events.l Add a test for 2 mem events back to back with config terms Adrian Hunter (1): perf tools: Allow config terms with breakpoints tools/perf/tests/parse-events.c | 157 ++++++++++++++++++++++++++++++++++++++++ tools/perf/util/parse-events.c | 23 +++++- tools/perf/util/parse-events.h | 6 +- tools/perf/util/parse-events.l | 23 +++++- tools/perf/util/parse-events.y | 42 ++++++----- 5 files changed, 224 insertions(+), 27 deletions(-) Regards Adrian
Comments
On 25/05/23 11:29, Adrian Hunter wrote: > Hi > > Here is a patch (V3) to the event parser for breakpoint events. > I am not that familiar with flex / bison, but it seemed to > need trailing context to stop the mem event colon and slash > delimiters from getting mixed up with delimiters for config > terms or event modifiers. Please look closely at that. > > > Changes in V3: > > Add Ian's Reviewed-by > Re-base Still applies. Any more comments? > > Changes in V2: > > Add comments to tools/perf/util/parse-events.l > Add a test for 2 mem events back to back with config terms > > > Adrian Hunter (1): > perf tools: Allow config terms with breakpoints > > tools/perf/tests/parse-events.c | 157 ++++++++++++++++++++++++++++++++++++++++ > tools/perf/util/parse-events.c | 23 +++++- > tools/perf/util/parse-events.h | 6 +- > tools/perf/util/parse-events.l | 23 +++++- > tools/perf/util/parse-events.y | 42 ++++++----- > 5 files changed, 224 insertions(+), 27 deletions(-) > > > Regards > Adrian
Em Tue, Jun 06, 2023 at 08:00:33AM +0300, Adrian Hunter escreveu: > On 25/05/23 11:29, Adrian Hunter wrote: > > Hi > > > > Here is a patch (V3) to the event parser for breakpoint events. > > I am not that familiar with flex / bison, but it seemed to > > need trailing context to stop the mem event colon and slash > > delimiters from getting mixed up with delimiters for config > > terms or event modifiers. Please look closely at that. > > > > > > Changes in V3: > > > > Add Ian's Reviewed-by > > Re-base > > Still applies. Any more comments? Tried it now, twice, once after removing the O= build dir: CC /tmp/build/perf-tools-next/tests/event-times.o CC /tmp/build/perf-tools-next/tests/expr.o BISON /tmp/build/perf-tools-next/util/parse-events-bison.c util/parse-events.y:508.24-34: warning: unused value: $3 [-Wother] 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config | ^~~~~~~~~~~ util/parse-events.y:508.45-55: warning: unused value: $5 [-Wother] 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config | ^~~~~~~~~~~ util/parse-events.y:526.24-34: warning: unused value: $3 [-Wother] 526 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config | ^~~~~~~~~~~ util/parse-events.y:543.24-34: warning: unused value: $3 [-Wother] 543 | PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config | ^~~~~~~~~~~ CC /tmp/build/perf-tools-next/tests/backward-ring-buffer.o ⬢[acme@toolbox perf-tools-next]$ cat /etc/redhat-release Fedora release 36 (Thirty Six) ⬢[acme@toolbox perf-tools-next]$ rpm -q bison bison-3.8.2-2.fc36.x86_64 ⬢[acme@toolbox perf-tools-next]$ rpm -q flex flex-2.6.4-10.fc36.x86_64 ⬢[acme@toolbox perf-tools-next]$ - Arnaldo > > > > Changes in V2: > > > > Add comments to tools/perf/util/parse-events.l > > Add a test for 2 mem events back to back with config terms > > > > > > Adrian Hunter (1): > > perf tools: Allow config terms with breakpoints > > > > tools/perf/tests/parse-events.c | 157 ++++++++++++++++++++++++++++++++++++++++ > > tools/perf/util/parse-events.c | 23 +++++- > > tools/perf/util/parse-events.h | 6 +- > > tools/perf/util/parse-events.l | 23 +++++- > > tools/perf/util/parse-events.y | 42 ++++++----- > > 5 files changed, 224 insertions(+), 27 deletions(-) > > > > > > Regards > > Adrian >
Em Tue, Jun 06, 2023 at 03:15:59PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Tue, Jun 06, 2023 at 08:00:33AM +0300, Adrian Hunter escreveu: > > On 25/05/23 11:29, Adrian Hunter wrote: > > > Hi > > > > > > Here is a patch (V3) to the event parser for breakpoint events. > > > I am not that familiar with flex / bison, but it seemed to > > > need trailing context to stop the mem event colon and slash > > > delimiters from getting mixed up with delimiters for config > > > terms or event modifiers. Please look closely at that. > > > > > > > > > Changes in V3: > > > > > > Add Ian's Reviewed-by > > > Re-base > > > > Still applies. Any more comments? > > Tried it now, twice, once after removing the O= build dir: > > CC /tmp/build/perf-tools-next/tests/event-times.o > CC /tmp/build/perf-tools-next/tests/expr.o > BISON /tmp/build/perf-tools-next/util/parse-events-bison.c > util/parse-events.y:508.24-34: warning: unused value: $3 [-Wother] > 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config > | ^~~~~~~~~~~ > util/parse-events.y:508.45-55: warning: unused value: $5 [-Wother] > 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config > | ^~~~~~~~~~~ > util/parse-events.y:526.24-34: warning: unused value: $3 [-Wother] > 526 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config > | ^~~~~~~~~~~ > util/parse-events.y:543.24-34: warning: unused value: $3 [-Wother] > 543 | PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config > | ^~~~~~~~~~~ > CC /tmp/build/perf-tools-next/tests/backward-ring-buffer.o But it doesn't _break_ the build, just warns thiis when generating the .c file, the next build it notices it is already generated, no warnings. - Arnaldo > > ⬢[acme@toolbox perf-tools-next]$ cat /etc/redhat-release > Fedora release 36 (Thirty Six) > > ⬢[acme@toolbox perf-tools-next]$ rpm -q bison > bison-3.8.2-2.fc36.x86_64 > ⬢[acme@toolbox perf-tools-next]$ rpm -q flex > flex-2.6.4-10.fc36.x86_64 > ⬢[acme@toolbox perf-tools-next]$ > > > - Arnaldo > > > > > > > Changes in V2: > > > > > > Add comments to tools/perf/util/parse-events.l > > > Add a test for 2 mem events back to back with config terms > > > > > > > > > Adrian Hunter (1): > > > perf tools: Allow config terms with breakpoints > > > > > > tools/perf/tests/parse-events.c | 157 ++++++++++++++++++++++++++++++++++++++++ > > > tools/perf/util/parse-events.c | 23 +++++- > > > tools/perf/util/parse-events.h | 6 +- > > > tools/perf/util/parse-events.l | 23 +++++- > > > tools/perf/util/parse-events.y | 42 ++++++----- > > > 5 files changed, 224 insertions(+), 27 deletions(-) > > > > > > > > > Regards > > > Adrian > > > > -- > > - Arnaldo
On 6/06/23 22:22, Arnaldo Carvalho de Melo wrote: > Em Tue, Jun 06, 2023 at 03:15:59PM -0300, Arnaldo Carvalho de Melo escreveu: >> Em Tue, Jun 06, 2023 at 08:00:33AM +0300, Adrian Hunter escreveu: >>> On 25/05/23 11:29, Adrian Hunter wrote: >>>> Hi >>>> >>>> Here is a patch (V3) to the event parser for breakpoint events. >>>> I am not that familiar with flex / bison, but it seemed to >>>> need trailing context to stop the mem event colon and slash >>>> delimiters from getting mixed up with delimiters for config >>>> terms or event modifiers. Please look closely at that. >>>> >>>> >>>> Changes in V3: >>>> >>>> Add Ian's Reviewed-by >>>> Re-base >>> >>> Still applies. Any more comments? >> >> Tried it now, twice, once after removing the O= build dir: >> >> CC /tmp/build/perf-tools-next/tests/event-times.o >> CC /tmp/build/perf-tools-next/tests/expr.o >> BISON /tmp/build/perf-tools-next/util/parse-events-bison.c >> util/parse-events.y:508.24-34: warning: unused value: $3 [-Wother] >> 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config >> | ^~~~~~~~~~~ >> util/parse-events.y:508.45-55: warning: unused value: $5 [-Wother] >> 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config >> | ^~~~~~~~~~~ >> util/parse-events.y:526.24-34: warning: unused value: $3 [-Wother] >> 526 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config >> | ^~~~~~~~~~~ >> util/parse-events.y:543.24-34: warning: unused value: $3 [-Wother] >> 543 | PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config >> | ^~~~~~~~~~~ >> CC /tmp/build/perf-tools-next/tests/backward-ring-buffer.o > > But it doesn't _break_ the build, just warns thiis when generating the > .c file, the next build it notices it is already generated, no warnings. The build script I was using has a flaw. It doesn't show warnings unless the build fails, assuming warnings are errors. But these are not. The first hack that came to mind, and seems to work, is: diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index bbfb8110947c..dd36be3832b6 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -510,6 +510,8 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event struct list_head *list; int err; + $3 = $3; + $5 = $5; list = alloc_list(); ABORT_ON(!list); err = parse_events_add_breakpoint(_parse_state, list, @@ -528,6 +530,7 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config struct list_head *list; int err; + $3 = $3; list = alloc_list(); ABORT_ON(!list); err = parse_events_add_breakpoint(_parse_state, list, @@ -545,6 +548,7 @@ PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config struct list_head *list; int err; + $3 = $3; list = alloc_list(); ABORT_ON(!list); err = parse_events_add_breakpoint(_parse_state, list, > > - Arnaldo > >> >> ⬢[acme@toolbox perf-tools-next]$ cat /etc/redhat-release >> Fedora release 36 (Thirty Six) >> >> ⬢[acme@toolbox perf-tools-next]$ rpm -q bison >> bison-3.8.2-2.fc36.x86_64 >> ⬢[acme@toolbox perf-tools-next]$ rpm -q flex >> flex-2.6.4-10.fc36.x86_64 >> ⬢[acme@toolbox perf-tools-next]$ >> >> >> - Arnaldo >> >>>> >>>> Changes in V2: >>>> >>>> Add comments to tools/perf/util/parse-events.l >>>> Add a test for 2 mem events back to back with config terms >>>> >>>> >>>> Adrian Hunter (1): >>>> perf tools: Allow config terms with breakpoints >>>> >>>> tools/perf/tests/parse-events.c | 157 ++++++++++++++++++++++++++++++++++++++++ >>>> tools/perf/util/parse-events.c | 23 +++++- >>>> tools/perf/util/parse-events.h | 6 +- >>>> tools/perf/util/parse-events.l | 23 +++++- >>>> tools/perf/util/parse-events.y | 42 ++++++----- >>>> 5 files changed, 224 insertions(+), 27 deletions(-) >>>> >>>> >>>> Regards >>>> Adrian >>> >> >> -- >> >> - Arnaldo >
On 6/06/23 22:37, Adrian Hunter wrote: > On 6/06/23 22:22, Arnaldo Carvalho de Melo wrote: >> Em Tue, Jun 06, 2023 at 03:15:59PM -0300, Arnaldo Carvalho de Melo escreveu: >>> Em Tue, Jun 06, 2023 at 08:00:33AM +0300, Adrian Hunter escreveu: >>>> On 25/05/23 11:29, Adrian Hunter wrote: >>>>> Hi >>>>> >>>>> Here is a patch (V3) to the event parser for breakpoint events. >>>>> I am not that familiar with flex / bison, but it seemed to >>>>> need trailing context to stop the mem event colon and slash >>>>> delimiters from getting mixed up with delimiters for config >>>>> terms or event modifiers. Please look closely at that. >>>>> >>>>> >>>>> Changes in V3: >>>>> >>>>> Add Ian's Reviewed-by >>>>> Re-base >>>> >>>> Still applies. Any more comments? >>> >>> Tried it now, twice, once after removing the O= build dir: >>> >>> CC /tmp/build/perf-tools-next/tests/event-times.o >>> CC /tmp/build/perf-tools-next/tests/expr.o >>> BISON /tmp/build/perf-tools-next/util/parse-events-bison.c >>> util/parse-events.y:508.24-34: warning: unused value: $3 [-Wother] >>> 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config >>> | ^~~~~~~~~~~ >>> util/parse-events.y:508.45-55: warning: unused value: $5 [-Wother] >>> 508 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config >>> | ^~~~~~~~~~~ >>> util/parse-events.y:526.24-34: warning: unused value: $3 [-Wother] >>> 526 | PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config >>> | ^~~~~~~~~~~ >>> util/parse-events.y:543.24-34: warning: unused value: $3 [-Wother] >>> 543 | PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config >>> | ^~~~~~~~~~~ >>> CC /tmp/build/perf-tools-next/tests/backward-ring-buffer.o >> >> But it doesn't _break_ the build, just warns thiis when generating the >> .c file, the next build it notices it is already generated, no warnings. > > The build script I was using has a flaw. It doesn't show warnings > unless the build fails, assuming warnings are errors. But these > are not. > > The first hack that came to mind, and seems to work, is: > > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y > index bbfb8110947c..dd36be3832b6 100644 > --- a/tools/perf/util/parse-events.y > +++ b/tools/perf/util/parse-events.y > @@ -510,6 +510,8 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event > struct list_head *list; > int err; > > + $3 = $3; > + $5 = $5; > list = alloc_list(); > ABORT_ON(!list); > err = parse_events_add_breakpoint(_parse_state, list, > @@ -528,6 +530,7 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config > struct list_head *list; > int err; > > + $3 = $3; > list = alloc_list(); > ABORT_ON(!list); > err = parse_events_add_breakpoint(_parse_state, list, > @@ -545,6 +548,7 @@ PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config > struct list_head *list; > int err; > > + $3 = $3; > list = alloc_list(); > ABORT_ON(!list); > err = parse_events_add_breakpoint(_parse_state, list, > > Maybe this is cleaner: From: Adrian Hunter <adrian.hunter@intel.com> Date: Wed, 7 Jun 2023 08:12:29 +0300 Subject: [PATCH] perf tools: Suppress bison unused value warnings Patch "perf tools: Allow config terms with breakpoints" introduced parse tokens for colons and slashes within breakpoint parsing to prevent mix up with colons and slashes related to config terms. The token values are not needed but introduce bison "unused value" warnings. Suppress those warnings. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> --- tools/perf/util/parse-events.h | 4 ++++ tools/perf/util/parse-events.y | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index b0eb95f93e9c..5fdc1f33f57e 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -228,6 +228,10 @@ void parse_events_error__handle(struct parse_events_error *err, int idx, void parse_events_error__print(struct parse_events_error *err, const char *event); +static inline void parse_events_unused_value(const void *x __maybe_unused) +{ +} + #ifdef HAVE_LIBELF_SUPPORT /* * If the probe point starts with '%', diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index bbfb8110947c..0c3d086cc22a 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -510,6 +510,9 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event struct list_head *list; int err; + parse_events_unused_value(&$3); + parse_events_unused_value(&$5); + list = alloc_list(); ABORT_ON(!list); err = parse_events_add_breakpoint(_parse_state, list, @@ -528,6 +531,8 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config struct list_head *list; int err; + parse_events_unused_value(&$3); + list = alloc_list(); ABORT_ON(!list); err = parse_events_add_breakpoint(_parse_state, list, @@ -545,6 +550,8 @@ PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config struct list_head *list; int err; + parse_events_unused_value(&$3); + list = alloc_list(); ABORT_ON(!list); err = parse_events_add_breakpoint(_parse_state, list,
Em Wed, Jun 07, 2023 at 08:33:07AM +0300, Adrian Hunter escreveu: > Maybe this is cleaner: It is, I folded it into your original patch, thanks! - Arnaldo > > From: Adrian Hunter <adrian.hunter@intel.com> > Date: Wed, 7 Jun 2023 08:12:29 +0300 > Subject: [PATCH] perf tools: Suppress bison unused value warnings > > Patch "perf tools: Allow config terms with breakpoints" introduced > parse tokens for colons and slashes within breakpoint parsing to > prevent mix up with colons and slashes related to config terms. > > The token values are not needed but introduce bison "unused value" > warnings. > > Suppress those warnings. > > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> > --- > tools/perf/util/parse-events.h | 4 ++++ > tools/perf/util/parse-events.y | 7 +++++++ > 2 files changed, 11 insertions(+) > > diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h > index b0eb95f93e9c..5fdc1f33f57e 100644 > --- a/tools/perf/util/parse-events.h > +++ b/tools/perf/util/parse-events.h > @@ -228,6 +228,10 @@ void parse_events_error__handle(struct parse_events_error *err, int idx, > void parse_events_error__print(struct parse_events_error *err, > const char *event); > > +static inline void parse_events_unused_value(const void *x __maybe_unused) > +{ > +} > + > #ifdef HAVE_LIBELF_SUPPORT > /* > * If the probe point starts with '%', > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y > index bbfb8110947c..0c3d086cc22a 100644 > --- a/tools/perf/util/parse-events.y > +++ b/tools/perf/util/parse-events.y > @@ -510,6 +510,9 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event > struct list_head *list; > int err; > > + parse_events_unused_value(&$3); > + parse_events_unused_value(&$5); > + > list = alloc_list(); > ABORT_ON(!list); > err = parse_events_add_breakpoint(_parse_state, list, > @@ -528,6 +531,8 @@ PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config > struct list_head *list; > int err; > > + parse_events_unused_value(&$3); > + > list = alloc_list(); > ABORT_ON(!list); > err = parse_events_add_breakpoint(_parse_state, list, > @@ -545,6 +550,8 @@ PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config > struct list_head *list; > int err; > > + parse_events_unused_value(&$3); > + > list = alloc_list(); > ABORT_ON(!list); > err = parse_events_add_breakpoint(_parse_state, list, > -- > 2.34.1 > >