]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.17.12/perf-tools-fix-pmu-events-parsing-rule.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.17.12 / perf-tools-fix-pmu-events-parsing-rule.patch
CommitLineData
722b7c48
GKH
1From foo@baz Sat Jul 28 10:14:30 CEST 2018
2From: Jiri Olsa <jolsa@kernel.org>
3Date: Tue, 5 Jun 2018 14:14:16 +0200
4Subject: perf tools: Fix pmu events parsing rule
5
6From: Jiri Olsa <jolsa@kernel.org>
7
8[ Upstream commit ceac7b79df7bd67ef9aaf464b0179a2686aff4ee ]
9
10Currently all the event parsing fails end up
11in the event_pmu rule, and display misleading
12help like:
13
14 $ perf stat -e inst kill
15 event syntax error: 'inst'
16 \___ Cannot find PMU `inst'. Missing kernel support?
17 ...
18
19The reason is that the event_pmu is too strong
20and match also single string. Changing it to
21force the '/' separators to be part of the rule,
22and 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
30Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
31Signed-off-by: Jiri Olsa <jolsa@kernel.org>
32Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
33Cc: Adrian Hunter <adrian.hunter@intel.com>
34Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
35Cc: David Ahern <dsahern@gmail.com>
36Cc: Namhyung Kim <namhyung@kernel.org>
37Cc: Peter Zijlstra <peterz@infradead.org>
38Link: http://lkml.kernel.org/r/20180605121416.31645-1-jolsa@kernel.org
39Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
40Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
41Signed-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 {