diff options
author | Vince Weaver <vincent.weaver@maine.edu> | 2013-12-30 15:39:45 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-02-10 09:34:31 -0500 |
commit | 88fee52e58ca14d8465b614774ed0bf08e1a7790 (patch) | |
tree | d0043a4b7886fdfa76ed6bc0d95e24df2b03e079 /tools | |
parent | f67697bd079f4bbcbe7d6d26765a06b18afe0630 (diff) |
perf list: Fix checking for supported events on older kernels
"perf list" listing of hardware events doesn't work on older ARM devices.
The change enabling event detection:
commit b41f1cec91c37eeea6fdb15effbfa24ea0a5536b
Author: Namhyung Kim <namhyung.kim@lge.com>
Date: Tue Aug 27 11:41:53 2013 +0900
perf list: Skip unsupported events
uses the following code in tools/perf/util/parse-events.c:
struct perf_event_attr attr = {
.type = type,
.config = config,
.disabled = 1,
.exclude_kernel = 1,
};
On ARM machines pre-dating the Cortex-A15 this doesn't work, as these
machines don't support .exclude_kernel. So starting with 3.12 "perf
list" does not report any hardware events at all on older machines (seen
on Rasp-Pi, Pandaboard, Beagleboard, etc).
This version of the patch makes changes suggested by Namhyung Kim to
check for EACCESS and retry (instead of just dropping the
exclude_kernel) so we can properly handle machines where
/proc/sys/kernel/perf_event_paranoid is set to 2.
Reported-by: Chad Paradis <chad.paradis@umit.maine.edu>
Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Chad Paradis <chad.paradis@umit.maine.edu>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1312301536150.28814@vincent-weaver-1.um.maine.edu
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/parse-events.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d248fca6d7ed..1e15df10a88c 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -1091,12 +1091,12 @@ int is_valid_tracepoint(const char *event_string) | |||
1091 | static bool is_event_supported(u8 type, unsigned config) | 1091 | static bool is_event_supported(u8 type, unsigned config) |
1092 | { | 1092 | { |
1093 | bool ret = true; | 1093 | bool ret = true; |
1094 | int open_return; | ||
1094 | struct perf_evsel *evsel; | 1095 | struct perf_evsel *evsel; |
1095 | struct perf_event_attr attr = { | 1096 | struct perf_event_attr attr = { |
1096 | .type = type, | 1097 | .type = type, |
1097 | .config = config, | 1098 | .config = config, |
1098 | .disabled = 1, | 1099 | .disabled = 1, |
1099 | .exclude_kernel = 1, | ||
1100 | }; | 1100 | }; |
1101 | struct { | 1101 | struct { |
1102 | struct thread_map map; | 1102 | struct thread_map map; |
@@ -1108,7 +1108,20 @@ static bool is_event_supported(u8 type, unsigned config) | |||
1108 | 1108 | ||
1109 | evsel = perf_evsel__new(&attr); | 1109 | evsel = perf_evsel__new(&attr); |
1110 | if (evsel) { | 1110 | if (evsel) { |
1111 | ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0; | 1111 | open_return = perf_evsel__open(evsel, NULL, &tmap.map); |
1112 | ret = open_return >= 0; | ||
1113 | |||
1114 | if (open_return == -EACCES) { | ||
1115 | /* | ||
1116 | * This happens if the paranoid value | ||
1117 | * /proc/sys/kernel/perf_event_paranoid is set to 2 | ||
1118 | * Re-run with exclude_kernel set; we don't do that | ||
1119 | * by default as some ARM machines do not support it. | ||
1120 | * | ||
1121 | */ | ||
1122 | evsel->attr.exclude_kernel = 1; | ||
1123 | ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0; | ||
1124 | } | ||
1112 | perf_evsel__delete(evsel); | 1125 | perf_evsel__delete(evsel); |
1113 | } | 1126 | } |
1114 | 1127 | ||