diff options
author | David Ahern <dsahern@gmail.com> | 2012-05-08 09:29:16 -0600 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-09 14:14:41 -0300 |
commit | 20d23aaa31da295378abff4272716e3dfc72baf0 (patch) | |
tree | e7d5a8be4425eb97ac1a396c7b0f08079259d861 /tools | |
parent | 09c0211c0bb0e40231e6ee9a35041d467ed72f16 (diff) | |
download | linux-3.10-20d23aaa31da295378abff4272716e3dfc72baf0.tar.gz linux-3.10-20d23aaa31da295378abff4272716e3dfc72baf0.tar.bz2 linux-3.10-20d23aaa31da295378abff4272716e3dfc72baf0.zip |
perf stat: handle ENXIO error for perf_event_open
perf stat on PPC currently fails to run:
$ perf stat -- sleep 1
Error: open_counter returned with 6 (No such device or address). /bin/dmesg may provide additional information.
Fatal: Not all events could be opened.
The problem is that until 2.6.37 (behavior changed with commit b0a873e)
perf on PPC returns ENXIO when hw_perf_event_init() fails. With this
patch we get the expected behavior:
$ perf stat -v -- sleep 1
cycles event is not supported by the kernel.
stalled-cycles-frontend event is not supported by the kernel.
stalled-cycles-backend event is not supported by the kernel.
instructions event is not supported by the kernel.
branches event is not supported by the kernel.
branch-misses event is not supported by the kernel.
...
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1336490956-57145-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-stat.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 4532a789fbe..1e5e9b270f5 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -488,8 +488,13 @@ static int run_perf_stat(int argc __used, const char **argv) list_for_each_entry(counter, &evsel_list->entries, node) { if (create_perf_stat_counter(counter, first) < 0) { + /* + * PPC returns ENXIO for HW counters until 2.6.37 + * (behavior changed with commit b0a873e). + */ if (errno == EINVAL || errno == ENOSYS || - errno == ENOENT || errno == EOPNOTSUPP) { + errno == ENOENT || errno == EOPNOTSUPP || + errno == ENXIO) { if (verbose) ui__warning("%s event is not supported by the kernel.\n", event_name(counter)); |