]>
Commit | Line | Data |
---|---|---|
722b7c48 GKH |
1 | From foo@baz Sat Jul 28 10:14:30 CEST 2018 |
2 | From: Jiri Olsa <jolsa@kernel.org> | |
3 | Date: Tue, 5 Jun 2018 14:14:16 +0200 | |
4 | Subject: perf tools: Fix pmu events parsing rule | |
5 | ||
6 | From: Jiri Olsa <jolsa@kernel.org> | |
7 | ||
8 | [ Upstream commit ceac7b79df7bd67ef9aaf464b0179a2686aff4ee ] | |
9 | ||
10 | Currently all the event parsing fails end up | |
11 | in the event_pmu rule, and display misleading | |
12 | help like: | |
13 | ||
14 | $ perf stat -e inst kill | |
15 | event syntax error: 'inst' | |
16 | \___ Cannot find PMU `inst'. Missing kernel support? | |
17 | ... | |
18 | ||
19 | The reason is that the event_pmu is too strong | |
20 | and match also single string. Changing it to | |
21 | force the '/' separators to be part of the rule, | |
22 | and getting the proper error now: | |
23 | ||
24 | $ perf stat -e inst kill | |
25 | event syntax error: 'inst' | |
26 | \___ parser error | |
27 | Run 'perf list' for a list of valid events | |
28 | ... | |
29 | ||
30 | Suggested-by: Adrian Hunter <adrian.hunter@intel.com> | |
31 | Signed-off-by: Jiri Olsa <jolsa@kernel.org> | |
32 | Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> | |
33 | Cc: Adrian Hunter <adrian.hunter@intel.com> | |
34 | Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> | |
35 | Cc: David Ahern <dsahern@gmail.com> | |
36 | Cc: Namhyung Kim <namhyung@kernel.org> | |
37 | Cc: Peter Zijlstra <peterz@infradead.org> | |
38 | Link: http://lkml.kernel.org/r/20180605121416.31645-1-jolsa@kernel.org | |
39 | Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> | |
40 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
41 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
42 | --- | |
43 | tools/perf/util/parse-events.y | 14 +++++++++++++- | |
44 | 1 file changed, 13 insertions(+), 1 deletion(-) | |
45 | ||
46 | --- a/tools/perf/util/parse-events.y | |
47 | +++ b/tools/perf/util/parse-events.y | |
48 | @@ -73,6 +73,7 @@ static void inc_group_count(struct list_ | |
49 | %type <num> value_sym | |
50 | %type <head> event_config | |
51 | %type <head> opt_event_config | |
52 | +%type <head> opt_pmu_config | |
53 | %type <term> event_term | |
54 | %type <head> event_pmu | |
55 | %type <head> event_legacy_symbol | |
56 | @@ -224,7 +225,7 @@ event_def: event_pmu | | |
57 | event_bpf_file | |
58 | ||
59 | event_pmu: | |
60 | -PE_NAME opt_event_config | |
61 | +PE_NAME opt_pmu_config | |
62 | { | |
63 | struct list_head *list, *orig_terms, *terms; | |
64 | ||
65 | @@ -495,6 +496,17 @@ opt_event_config: | |
66 | { | |
67 | $$ = NULL; | |
68 | } | |
69 | + | |
70 | +opt_pmu_config: | |
71 | +'/' event_config '/' | |
72 | +{ | |
73 | + $$ = $2; | |
74 | +} | |
75 | +| | |
76 | +'/' '/' | |
77 | +{ | |
78 | + $$ = NULL; | |
79 | +} | |
80 | ||
81 | start_terms: event_config | |
82 | { |