public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Dominique Martinet <asmadeus@codewreck.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] perf parse-events: Tidy name token matching
Date: Wed, 19 Feb 2025 14:27:43 -0800	[thread overview]
Message-ID: <Z7Za30xyVUQWI1tV@google.com> (raw)
In-Reply-To: <CAP-5=fXeZM7iWNQq0ar1HmAwWrH4HAHqD3F=ueB=jaw-2UMn_w@mail.gmail.com>

On Wed, Feb 19, 2025 at 02:11:43PM -0800, Ian Rogers wrote:
> On Wed, Feb 19, 2025 at 12:49 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > Hi Ian,
> >
> > On Wed, Feb 19, 2025 at 11:02:40AM -0800, Ian Rogers wrote:
> > > On Mon, Feb 10, 2025 at 11:23 AM Ian Rogers <irogers@google.com> wrote:
> > > >
> > > > On Thu, Jan 9, 2025 at 9:54 AM Ian Rogers <irogers@google.com> wrote:
> > > > >
> > > > > Prior to commit 70c90e4a6b2f ("perf parse-events: Avoid scanning PMUs
> > > > > before parsing") names (generally event names) excluded hyphen (minus)
> > > > > symbols as the formation of legacy names with hyphens was handled in
> > > > > the yacc code. That commit allowed hyphens supposedly making
> > > > > name_minus unnecessary. However, changing name_minus to name has
> > > > > issues in the term config tokens as then name ends up having priority
> > > > > over numbers and name allows matching numbers since commit
> > > > > 5ceb57990bf4 ("perf parse: Allow tracepoint names to start with digits
> > > > > "). It is also permissable for a name to match with a colon (':') in
> > > > > it when its in a config term list. To address this rename name_minus
> > > > > to term_name, make the pattern match name's except for the colon, add
> > > > > number matching into the config term region with a higher priority
> > > > > than name matching. This addresses an inconsistency and allows greater
> > > > > matching for names inside of term lists, for example, they may start
> > > > > with a number.
> > > > >
> > > > > Rename name_tag to quoted_name and update comments and helper
> > > > > functions to avoid str detecting quoted strings which was already done
> > > > > by the lexer.
> > > > >
> > > > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > >
> > > > Ping. This patch addresses name parsing inconsistencies, in particular
> > > > events may start with a number without a PMU, but not with. It also
> > > > aims to give better names to patterns than name_minus and name_tag
> > > > (with term_name and quoted_name respectively) that have drifted from
> > > > their original meaning and become to me less than intention revealing.
> > >
> > > Ping.
> >
> > Sorry for the delay.  Can you please give an example for better
> > understanding if there's a change in the behavior?
> 
> The example in:
> https://lore.kernel.org/r/20240510-perf_digit-v4-3-db1553f3233b@codewreck.org
> is `perf trace -e '9p:*'` which allows the number to start a
> tracepoint name, but what is true for tracepoint names is also true
> for event names. I lack the tracepoint but the patch here is making
> that work if the event/tracepoint is specified with a PMU, so:
> 
> Before the input is just seen as broken:
> ```
> $ perf stat -e 'tracepoint/9p:9p/' true
> event syntax error: 'tracepoint/9p:9p/'
>                                \___ Unrecognized input
> Run 'perf list' for a list of valid events
> 
> Usage: perf stat [<options>] [<command>]
> 
>    -e, --event <event>   event selector. use 'perf list' to list
> available events
> ```
> 
> After the input fails because the event wasn't found:
> ```
> $ perf stat -e 'tracepoint/9p:9p/' true
> event syntax error: 'tracepoint/9p:9p/'
>                     \___ Bad event or PMU
> 
> Unable to find PMU or event on a PMU of 'tracepoint'
> 
> event syntax error: 'tracepoint/9p:9p/'
>                                \___ unknown term '9p:9p' for pmu 'tracepoint'
> 
> valid terms: config,config1,config2,config3,name,period,percore,metric-id
> 
> event syntax error: 'tracepoint/9p:9p/'
>                                \___ unknown term '9p:9p' for pmu 'tracepoint'
> 
> valid terms: config,config1,config2,config3,name,period,percore,metric-id
> Run 'perf list' for a list of valid events
> 
> Usage: perf stat [<options>] [<command>]
> 
>    -e, --event <event>   event selector. use 'perf list' to list
> available events
> ```
> 
> But the patch is just about making the name term more consistent and
> cleaner, the weirdness above wasn't its main point, I want the code to
> be easy to read and understand.

Ok, so I guess there's no behavior change from the users perspective in
this patchset.  Do you plan to add support for the tracepoint name in
the config term (like tracepoint/9p:9p/) later?

Thanks,
Namhyung


  reply	other threads:[~2025-02-19 22:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 17:54 [PATCH v1] perf parse-events: Tidy name token matching Ian Rogers
2025-02-10 19:23 ` Ian Rogers
2025-02-19 19:02   ` Ian Rogers
2025-02-19 20:49     ` Namhyung Kim
2025-02-19 22:11       ` Ian Rogers
2025-02-19 22:27         ` Namhyung Kim [this message]
2025-02-19 22:43           ` Ian Rogers
2025-02-21  6:34             ` Namhyung Kim
2025-02-24  5:39 ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7Za30xyVUQWI1tV@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=asmadeus@codewreck.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox