Jin Yao reported parser error for software event:
# perf stat -e software/r1a/ -a -- sleep 1
event syntax error: 'software/r1a/'
\___ parser error
This happens after commit 8c3b1ba0e7ea, where new
software-gt-awake-time event's non-pmu-event-style
makes event parser conflict with software pmu.
If we allow PE_PMU_EVENT_PRE to be parsed as pmu name,
we fix the conflict and the following character '/' for
pmu or '-' for non-pmu-event-style event allows parser
to decide what even is specified.
Cc: Chris Wilson <[email protected]>
Fixes: 8c3b1ba0e7ea ("drm/i915/gt: Track the overall awake/busy time") # 1
Reported-by: Jin Yao <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/util/parse-events.y | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index d5b6aff82f21..d57ac86ce7ca 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -89,6 +89,7 @@ static void inc_group_count(struct list_head *list,
%type <str> PE_EVENT_NAME
%type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
%type <str> PE_DRV_CFG_TERM
+%type <str> event_pmu_name
%destructor { free ($$); } <str>
%type <term> event_term
%destructor { parse_events_term__delete ($$); } <term>
@@ -272,8 +273,11 @@ event_def: event_pmu |
event_legacy_raw sep_dc |
event_bpf_file
+event_pmu_name:
+PE_NAME | PE_PMU_EVENT_PRE
+
event_pmu:
-PE_NAME opt_pmu_config
+event_pmu_name opt_pmu_config
{
struct parse_events_state *parse_state = _parse_state;
struct parse_events_error *error = parse_state->error;
--
2.29.2
Em Mon, Mar 01, 2021 at 01:23:15PM +0100, Jiri Olsa escreveu:
> Jin Yao reported parser error for software event:
>
> # perf stat -e software/r1a/ -a -- sleep 1
> event syntax error: 'software/r1a/'
> \___ parser error
>
> This happens after commit 8c3b1ba0e7ea, where new
> software-gt-awake-time event's non-pmu-event-style
> makes event parser conflict with software pmu.
>
> If we allow PE_PMU_EVENT_PRE to be parsed as pmu name,
> we fix the conflict and the following character '/' for
> pmu or '-' for non-pmu-event-style event allows parser
> to decide what even is specified.
Thanks, applied.
- Arnaldo
> Cc: Chris Wilson <[email protected]>
> Fixes: 8c3b1ba0e7ea ("drm/i915/gt: Track the overall awake/busy time") # 1
> Reported-by: Jin Yao <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/util/parse-events.y | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
> index d5b6aff82f21..d57ac86ce7ca 100644
> --- a/tools/perf/util/parse-events.y
> +++ b/tools/perf/util/parse-events.y
> @@ -89,6 +89,7 @@ static void inc_group_count(struct list_head *list,
> %type <str> PE_EVENT_NAME
> %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
> %type <str> PE_DRV_CFG_TERM
> +%type <str> event_pmu_name
> %destructor { free ($$); } <str>
> %type <term> event_term
> %destructor { parse_events_term__delete ($$); } <term>
> @@ -272,8 +273,11 @@ event_def: event_pmu |
> event_legacy_raw sep_dc |
> event_bpf_file
>
> +event_pmu_name:
> +PE_NAME | PE_PMU_EVENT_PRE
> +
> event_pmu:
> -PE_NAME opt_pmu_config
> +event_pmu_name opt_pmu_config
> {
> struct parse_events_state *parse_state = _parse_state;
> struct parse_events_error *error = parse_state->error;
> --
> 2.29.2
>
--
- Arnaldo