diff options
author | David Ahern <dsahern@gmail.com> | 2012-05-08 11:28:57 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-09 10:57:29 -0400 |
commit | 028d455b12719a48b1c4b51ce07a074135726f8f (patch) | |
tree | 08959d68e6f3dc9cbd4d8e14467c1bdc24ade900 | |
parent | 04480d01105324dc5b77ca3fbdf85037a7d80dbb (diff) |
perf record: Fix fallback to cpu-clock on ppc
perf-record on PPC is not falling back to cpu-clock:
$ perf record -ag -fo /tmp/perf.data -- sleep 1
Error: sys_perf_event_open() syscall returned with 6 (No such device or address). /bin/dmesg may provide additional information.
Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?
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 record -ag -fo /tmp/perf.data -v -- sleep 1
Old kernel, cannot exclude guest or host samples.
The cycles event is not supported, trying to fall back to cpu-clock-ticks
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.151 MB /tmp/perf.data (~6592 samples) ]
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1336490937-57106-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-record.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 42e24149c791..1a9098c697b4 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -242,9 +242,13 @@ try_again: | |||
242 | /* | 242 | /* |
243 | * If it's cycles then fall back to hrtimer | 243 | * If it's cycles then fall back to hrtimer |
244 | * based cpu-clock-tick sw counter, which | 244 | * based cpu-clock-tick sw counter, which |
245 | * is always available even if no PMU support: | 245 | * is always available even if no PMU support. |
246 | * | ||
247 | * PPC returns ENXIO until 2.6.37 (behavior changed | ||
248 | * with commit b0a873e). | ||
246 | */ | 249 | */ |
247 | if (err == ENOENT && attr->type == PERF_TYPE_HARDWARE | 250 | if ((err == ENOENT || err == ENXIO) |
251 | && attr->type == PERF_TYPE_HARDWARE | ||
248 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { | 252 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { |
249 | 253 | ||
250 | if (verbose) | 254 | if (verbose) |