2012-05-09 17:44:44

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [GIT PULL 0/1] perf/urgent fix

From: Arnaldo Carvalho de Melo <[email protected]>

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 09c0211c0bb0e40231e6ee9a35041d467ed72f16:

perf: Turn off compiler warnings for flex and bison generated files (2012-05-07 10:03:01 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux perf/urgent

for you to fetch changes up to 20d23aaa31da295378abff4272716e3dfc72baf0:

perf stat: handle ENXIO error for perf_event_open (2012-05-09 14:14:41 -0300)

----------------------------------------------------------------
Fix for perf/urgent:

. Fix handling of older kernels on PPC, from David Ahern.

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

----------------------------------------------------------------
David Ahern (1):
perf stat: handle ENXIO error for perf_event_open

tools/perf/builtin-stat.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)


2012-05-09 17:44:43

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 1/1] perf stat: handle ENXIO error for perf_event_open

From: David Ahern <[email protected]>

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 <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/builtin-stat.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 4532a78..1e5e9b2 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));
--
1.7.9.2.358.g22243

2012-05-10 08:55:43

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL 0/1] perf/urgent fix


* Arnaldo Carvalho de Melo <[email protected]> wrote:

> From: Arnaldo Carvalho de Melo <[email protected]>
>
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit 09c0211c0bb0e40231e6ee9a35041d467ed72f16:
>
> perf: Turn off compiler warnings for flex and bison generated files (2012-05-07 10:03:01 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux perf/urgent
>
> for you to fetch changes up to 20d23aaa31da295378abff4272716e3dfc72baf0:
>
> perf stat: handle ENXIO error for perf_event_open (2012-05-09 14:14:41 -0300)
>
> ----------------------------------------------------------------
> Fix for perf/urgent:
>
> . Fix handling of older kernels on PPC, from David Ahern.
>
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
>
> ----------------------------------------------------------------
> David Ahern (1):
> perf stat: handle ENXIO error for perf_event_open
>
> tools/perf/builtin-stat.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)

Pulled, thanks!

Ingo