All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf record: fix fallback to cpu-clock on ppc
@ 2012-05-08  4:40 David Ahern
  2012-05-08 13:12 ` Arnaldo Carvalho de Melo
  2012-05-09 14:56 ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 6+ messages in thread
From: David Ahern @ 2012-05-08  4:40 UTC (permalink / raw)
  To: acme, linux-kernel; +Cc: peterz, David Ahern

perf-record on PPC is not falling back to cpu-clock:

Old kernel, cannot exclude guest or host samples.

  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:

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.150 MB /tmp/perf.data (~6569 samples) ]

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/builtin-record.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 42e2414..080c708 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -244,7 +244,8 @@ try_again:
 			 * based cpu-clock-tick sw counter, which
 			 * is always available even if no PMU support:
 			 */
-			if (err == ENOENT && attr->type == PERF_TYPE_HARDWARE
+			if ((err == ENOENT || err == ENXIO)
+					&& attr->type == PERF_TYPE_HARDWARE
 					&& attr->config == PERF_COUNT_HW_CPU_CYCLES) {
 
 				if (verbose)
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf record: fix fallback to cpu-clock on ppc
  2012-05-08  4:40 [PATCH] perf record: fix fallback to cpu-clock on ppc David Ahern
@ 2012-05-08 13:12 ` Arnaldo Carvalho de Melo
  2012-05-08 14:10   ` David Ahern
  2012-05-09 14:56 ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-05-08 13:12 UTC (permalink / raw)
  To: David Ahern; +Cc: linux-kernel, peterz

Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
> perf-record on PPC is not falling back to cpu-clock:
> 
> Old kernel, cannot exclude guest or host samples.
> 
>   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:
> 
> 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.150 MB /tmp/perf.data (~6569 samples) ]

Would be good to have this documented on the spot, i.e. just before that
if.

Also, have you checked that 'perf stat' and 'perf top' works as well? We
really need to move all this logic to a central place, namely
perf_evlist__open().

For now checking if stat and top ara ok should be enough.

- Arnaldo
 
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
>  tools/perf/builtin-record.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 42e2414..080c708 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -244,7 +244,8 @@ try_again:
>  			 * based cpu-clock-tick sw counter, which
>  			 * is always available even if no PMU support:
>  			 */
> -			if (err == ENOENT && attr->type == PERF_TYPE_HARDWARE
> +			if ((err == ENOENT || err == ENXIO)
> +					&& attr->type == PERF_TYPE_HARDWARE
>  					&& attr->config == PERF_COUNT_HW_CPU_CYCLES) {
>  
>  				if (verbose)
> -- 
> 1.7.5.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf record: fix fallback to cpu-clock on ppc
  2012-05-08 13:12 ` Arnaldo Carvalho de Melo
@ 2012-05-08 14:10   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2012-05-08 14:10 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, peterz

On 5/8/12 7:12 AM, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
>> perf-record on PPC is not falling back to cpu-clock:
>>
>> Old kernel, cannot exclude guest or host samples.
>>
>>    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:
>>
>> 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.150 MB /tmp/perf.data (~6569 samples) ]
>
> Would be good to have this documented on the spot, i.e. just before that
> if.
>
> Also, have you checked that 'perf stat' and 'perf top' works as well? We
> really need to move all this logic to a central place, namely
> perf_evlist__open().
>
> For now checking if stat and top ara ok should be enough.

perf-top works because it drops back to cpu-clock for any 
perf_event_open failure; perf-stat does not. Will fix it and add a 
comment about PPC and ENXIO errno to both.

David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf record: fix fallback to cpu-clock on ppc
  2012-05-08  4:40 [PATCH] perf record: fix fallback to cpu-clock on ppc David Ahern
  2012-05-08 13:12 ` Arnaldo Carvalho de Melo
@ 2012-05-09 14:56 ` Arnaldo Carvalho de Melo
  2012-05-09 16:22   ` David Ahern
  1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-05-09 14:56 UTC (permalink / raw)
  To: David Ahern; +Cc: linux-kernel, peterz

Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
> perf-record on PPC is not falling back to cpu-clock:
> 
> Old kernel, cannot exclude guest or host samples.
> 
>   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:
> 
> 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.150 MB /tmp/perf.data (~6569 samples) ]

Thanks, applied to my perf/core branch.

Can you please provide one for perf/urgent?

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf record: fix fallback to cpu-clock on ppc
  2012-05-09 14:56 ` Arnaldo Carvalho de Melo
@ 2012-05-09 16:22   ` David Ahern
  2012-05-09 17:16     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2012-05-09 16:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, peterz

On 5/9/12 8:56 AM, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
>> perf-record on PPC is not falling back to cpu-clock:
>>
>> Old kernel, cannot exclude guest or host samples.
>>
>>    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:
>>
>> 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.150 MB /tmp/perf.data (~6569 samples) ]
>
> Thanks, applied to my perf/core branch.
>
> Can you please provide one for perf/urgent?

Not needed. Problem on perf/core was introduced by 
5a7ed29c7572d00a75e8c4529e30c5ac2ef82271

The perf-stat version is needed and applies cleanly (though with an 
offset) to perf/urgent.

David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf record: fix fallback to cpu-clock on ppc
  2012-05-09 16:22   ` David Ahern
@ 2012-05-09 17:16     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-05-09 17:16 UTC (permalink / raw)
  To: David Ahern; +Cc: linux-kernel, peterz

Em Wed, May 09, 2012 at 10:22:45AM -0600, David Ahern escreveu:
> On 5/9/12 8:56 AM, Arnaldo Carvalho de Melo wrote:
> >Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
> >>perf-record on PPC is not falling back to cpu-clock:

> >Thanks, applied to my perf/core branch.

> >Can you please provide one for perf/urgent?

> Not needed. Problem on perf/core was introduced by
> 5a7ed29c7572d00a75e8c4529e30c5ac2ef82271

> The perf-stat version is needed and applies cleanly (though with an
> offset) to perf/urgent.

Ok, git cherry-pick worked on it, pushing perf/urgent out with it.

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-09 17:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-08  4:40 [PATCH] perf record: fix fallback to cpu-clock on ppc David Ahern
2012-05-08 13:12 ` Arnaldo Carvalho de Melo
2012-05-08 14:10   ` David Ahern
2012-05-09 14:56 ` Arnaldo Carvalho de Melo
2012-05-09 16:22   ` David Ahern
2012-05-09 17:16     ` Arnaldo Carvalho de Melo

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.