Skip to content

Commit 84ea603

Browse files
olsajiriacmel
authored andcommitted
perf tools: Fix event's PMU name parsing
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 8c3b1ba ("drm/i915/gt: Track the overall awake/busy time"), 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. Fixes: 8c3b1ba ("drm/i915/gt: Track the overall awake/busy time") Reported-by: Jin Yao <yao.jin@linux.intel.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Ian Rogers <irogers@google.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210301122315.63471-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 36bc511 commit 84ea603

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/perf/util/parse-events.y

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static void inc_group_count(struct list_head *list,
8989
%type <str> PE_EVENT_NAME
9090
%type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
9191
%type <str> PE_DRV_CFG_TERM
92+
%type <str> event_pmu_name
9293
%destructor { free ($$); } <str>
9394
%type <term> event_term
9495
%destructor { parse_events_term__delete ($$); } <term>
@@ -272,8 +273,11 @@ event_def: event_pmu |
272273
event_legacy_raw sep_dc |
273274
event_bpf_file
274275

276+
event_pmu_name:
277+
PE_NAME | PE_PMU_EVENT_PRE
278+
275279
event_pmu:
276-
PE_NAME opt_pmu_config
280+
event_pmu_name opt_pmu_config
277281
{
278282
struct parse_events_state *parse_state = _parse_state;
279283
struct parse_events_error *error = parse_state->error;

0 commit comments

Comments
 (0)