aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2012-08-07 13:43:13 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-08 11:39:56 -0400
commitb527bab59be7ca2154f644fcc4b9e3c267a6d855 (patch)
treeaa4f3ad8b6a925279e128d51cc73bb70b87f8fec
parent2ede8303db75ead3250f95c3390e6ba200cbe7d4 (diff)
perf tools: Fix parsing of 64 bit raw config value for 32 bit
perf record fails on 32 bit with: invalid or unsupported event: 'r40000F7E0' Fixing this by parsing 64 bit num values. Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: Ingo Molnar <mingo@kernel.org> Link: http://lkml.kernel.org/r/1344361396-7237-4-git-send-email-robert.richter@amd.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/parse-events.c6
-rw-r--r--tools/perf/util/parse-events.h6
-rw-r--r--tools/perf/util/parse-events.l4
-rw-r--r--tools/perf/util/parse-events.y10
4 files changed, 13 insertions, 13 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 74a5af4d33ec..8bdfa3e5c8c7 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -551,7 +551,7 @@ static int config_attr(struct perf_event_attr *attr,
551} 551}
552 552
553int parse_events_add_numeric(struct list_head **list, int *idx, 553int parse_events_add_numeric(struct list_head **list, int *idx,
554 unsigned long type, unsigned long config, 554 u32 type, u64 config,
555 struct list_head *head_config) 555 struct list_head *head_config)
556{ 556{
557 struct perf_event_attr attr; 557 struct perf_event_attr attr;
@@ -1005,7 +1005,7 @@ int parse_events__is_hardcoded_term(struct parse_events__term *term)
1005 1005
1006static int new_term(struct parse_events__term **_term, int type_val, 1006static int new_term(struct parse_events__term **_term, int type_val,
1007 int type_term, char *config, 1007 int type_term, char *config,
1008 char *str, long num) 1008 char *str, u64 num)
1009{ 1009{
1010 struct parse_events__term *term; 1010 struct parse_events__term *term;
1011 1011
@@ -1034,7 +1034,7 @@ static int new_term(struct parse_events__term **_term, int type_val,
1034} 1034}
1035 1035
1036int parse_events__term_num(struct parse_events__term **term, 1036int parse_events__term_num(struct parse_events__term **term,
1037 int type_term, char *config, long num) 1037 int type_term, char *config, u64 num)
1038{ 1038{
1039 return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term, 1039 return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term,
1040 config, NULL, num); 1040 config, NULL, num);
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index ee9c218a193c..163aad404619 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -55,7 +55,7 @@ struct parse_events__term {
55 char *config; 55 char *config;
56 union { 56 union {
57 char *str; 57 char *str;
58 long num; 58 u64 num;
59 } val; 59 } val;
60 int type_val; 60 int type_val;
61 int type_term; 61 int type_term;
@@ -73,7 +73,7 @@ struct parse_events_data__terms {
73 73
74int parse_events__is_hardcoded_term(struct parse_events__term *term); 74int parse_events__is_hardcoded_term(struct parse_events__term *term);
75int parse_events__term_num(struct parse_events__term **_term, 75int parse_events__term_num(struct parse_events__term **_term,
76 int type_term, char *config, long num); 76 int type_term, char *config, u64 num);
77int parse_events__term_str(struct parse_events__term **_term, 77int parse_events__term_str(struct parse_events__term **_term,
78 int type_term, char *config, char *str); 78 int type_term, char *config, char *str);
79int parse_events__term_clone(struct parse_events__term **new, 79int parse_events__term_clone(struct parse_events__term **new,
@@ -83,7 +83,7 @@ int parse_events_modifier(struct list_head *list, char *str);
83int parse_events_add_tracepoint(struct list_head **list, int *idx, 83int parse_events_add_tracepoint(struct list_head **list, int *idx,
84 char *sys, char *event); 84 char *sys, char *event);
85int parse_events_add_numeric(struct list_head **list, int *idx, 85int parse_events_add_numeric(struct list_head **list, int *idx,
86 unsigned long type, unsigned long config, 86 u32 type, u64 config,
87 struct list_head *head_config); 87 struct list_head *head_config);
88int parse_events_add_cache(struct list_head **list, int *idx, 88int parse_events_add_cache(struct list_head **list, int *idx,
89 char *type, char *op_result1, char *op_result2); 89 char *type, char *op_result1, char *op_result2);
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 384ca74c6b22..e4abdf25d493 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -15,10 +15,10 @@ YYSTYPE *parse_events_get_lval(yyscan_t yyscanner);
15 15
16static int __value(YYSTYPE *yylval, char *str, int base, int token) 16static int __value(YYSTYPE *yylval, char *str, int base, int token)
17{ 17{
18 long num; 18 u64 num;
19 19
20 errno = 0; 20 errno = 0;
21 num = strtoul(str, NULL, base); 21 num = strtoull(str, NULL, base);
22 if (errno) 22 if (errno)
23 return PE_ERROR; 23 return PE_ERROR;
24 24
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 2bc5fbff2b5d..423d33151466 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -57,7 +57,7 @@ do { \
57%union 57%union
58{ 58{
59 char *str; 59 char *str;
60 unsigned long num; 60 u64 num;
61 struct list_head *head; 61 struct list_head *head;
62 struct parse_events__term *term; 62 struct parse_events__term *term;
63} 63}
@@ -207,7 +207,7 @@ PE_VALUE ':' PE_VALUE
207 struct parse_events_data__events *data = _data; 207 struct parse_events_data__events *data = _data;
208 struct list_head *list = NULL; 208 struct list_head *list = NULL;
209 209
210 ABORT_ON(parse_events_add_numeric(&list, &data->idx, $1, $3, NULL)); 210 ABORT_ON(parse_events_add_numeric(&list, &data->idx, (u32)$1, $3, NULL));
211 $$ = list; 211 $$ = list;
212} 212}
213 213
@@ -282,7 +282,7 @@ PE_TERM '=' PE_NAME
282{ 282{
283 struct parse_events__term *term; 283 struct parse_events__term *term;
284 284
285 ABORT_ON(parse_events__term_str(&term, $1, NULL, $3)); 285 ABORT_ON(parse_events__term_str(&term, (int)$1, NULL, $3));
286 $$ = term; 286 $$ = term;
287} 287}
288| 288|
@@ -290,7 +290,7 @@ PE_TERM '=' PE_VALUE
290{ 290{
291 struct parse_events__term *term; 291 struct parse_events__term *term;
292 292
293 ABORT_ON(parse_events__term_num(&term, $1, NULL, $3)); 293 ABORT_ON(parse_events__term_num(&term, (int)$1, NULL, $3));
294 $$ = term; 294 $$ = term;
295} 295}
296| 296|
@@ -298,7 +298,7 @@ PE_TERM
298{ 298{
299 struct parse_events__term *term; 299 struct parse_events__term *term;
300 300
301 ABORT_ON(parse_events__term_num(&term, $1, NULL, 1)); 301 ABORT_ON(parse_events__term_num(&term, (int)$1, NULL, 1));
302 $$ = term; 302 $$ = term;
303} 303}
304 304