perf tools: Fix term parsing for raw syntax
Jin Yao reported issue with possible conflict between raw events and
term values in pmu event syntax.
Currently following syntax is resolved as raw event with 0xead value:
uncore_imc_free_running/read/
instead of using 'read' term from uncore_imc_free_running pmu, because
'read' is correct raw event syntax with 0xead value.
To solve this issue we do following:
- check existing terms during rXXXX syntax processing
and make them priority in case of conflict
- allow pmu/r0x1234/ syntax to be able to specify conflicting
raw event (implemented in previous patch)
Also add automated tests for this and perf_pmu__parse_cleanup call to
parse_events_terms, so the test gets properly cleaned up.
Fixes: 3a6c51e4d6
("perf parser: Add support to specify rXXX event with pmu")
Reported-by: Jin Yao <yao.jin@linux.intel.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Link: http://lore.kernel.org/lkml/20200726075244.1191481-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
c33cdf5411
commit
4929e95a14
@@ -41,14 +41,6 @@ static int value(yyscan_t scanner, int base)
|
||||
return __value(yylval, text, base, PE_VALUE);
|
||||
}
|
||||
|
||||
static int raw(yyscan_t scanner)
|
||||
{
|
||||
YYSTYPE *yylval = parse_events_get_lval(scanner);
|
||||
char *text = parse_events_get_text(scanner);
|
||||
|
||||
return __value(yylval, text + 1, 16, PE_RAW);
|
||||
}
|
||||
|
||||
static int str(yyscan_t scanner, int token)
|
||||
{
|
||||
YYSTYPE *yylval = parse_events_get_lval(scanner);
|
||||
@@ -72,6 +64,17 @@ static int str(yyscan_t scanner, int token)
|
||||
return token;
|
||||
}
|
||||
|
||||
static int raw(yyscan_t scanner)
|
||||
{
|
||||
YYSTYPE *yylval = parse_events_get_lval(scanner);
|
||||
char *text = parse_events_get_text(scanner);
|
||||
|
||||
if (perf_pmu__parse_check(text) == PMU_EVENT_SYMBOL)
|
||||
return str(scanner, PE_NAME);
|
||||
|
||||
return __value(yylval, text + 1, 16, PE_RAW);
|
||||
}
|
||||
|
||||
static bool isbpf_suffix(char *text)
|
||||
{
|
||||
int len = strlen(text);
|
||||
|
Reference in New Issue
Block a user