Re: [PATCH] perf parse: Allow names to start with digits

From: Dominique Martinet
Date: Sat Jul 02 2022 - 19:51:46 EST


Jiri Olsa wrote on Sat, Jul 02, 2022 at 05:48:03PM +0200:
> > > > -name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]!]*
> > > > +name [a-zA-Z0-9_*?\[\]][a-zA-Z0-9_*?.\[\]!]*
>
> I thought it'd clash with events like cpu/event=3/,
> but lexer check numbers first, so we're fine there
>
> it smells like it could break some events, but I couldn't
> find any case of that
>
> could you please at least add tests to tests/parse-events.c
> for such case?

hmm, I'd love to but on my system I have no events that start with a
number unless I manually modprobe 9pnet (or 802154 stuff), so tests
would start failing for most people and I don't think we want that...

I have confirmed the following 'perf test "event parsing"' works iff
patch is applied and 9pnet loaded:
----
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 459afdb256a1..3d069fe9eb79 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1941,6 +1941,11 @@ static const struct evlist_test test__events[] = {
.check = test__exclusive_group,
/* 7 */
},
+ {
+ .name = "9p:9p_client_req",
+ .check = test__checkevent_tracepoint,
+ /* 8 */
+ },
};

static const struct evlist_test test__events_pmu[] = {
----

not sure if there'd be any other way of testing, there's nothing else in
'perf list' that starts with a number.
--
Dominique