From: tip-bot for David Ahern <dsahern@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@kernel.org, peterz@infradead.org, dsahern@gmail.com,
tglx@linutronix.de
Subject: [tip:perf/core] perf stat: handle ENXIO error for perf_event_open
Date: Thu, 10 May 2012 23:47:07 -0700 [thread overview]
Message-ID: <tip-979987a567d9e666fe719f337409b2fbb6418f5f@git.kernel.org> (raw)
In-Reply-To: <1336490956-57145-1-git-send-email-dsahern@gmail.com>
Commit-ID: 979987a567d9e666fe719f337409b2fbb6418f5f
Gitweb: http://git.kernel.org/tip/979987a567d9e666fe719f337409b2fbb6418f5f
Author: David Ahern <dsahern@gmail.com>
AuthorDate: Tue, 8 May 2012 09:29:16 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 9 May 2012 11:58:48 -0300
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>
---
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 e720ba7..d060568 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -462,8 +462,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));
prev parent reply other threads:[~2012-05-11 6:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-08 15:29 [PATCH 2/2] perf stat: handle ENXIO error for perf_event_open David Ahern
2012-05-10 9:10 ` [tip:perf/urgent] " tip-bot for David Ahern
2012-05-11 6:47 ` tip-bot for David Ahern [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-979987a567d9e666fe719f337409b2fbb6418f5f@git.kernel.org \
--to=dsahern@gmail.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.