perf record: fix fallback to cpu-clock on ppc
PATCH 1/1 perf record: fix fallback to cpu-clock on ppc
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) ]
--- tools/perf/builtin-record.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
tools/perf/builtin-record.c +2 -1
@@ -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)
Signature · 1 line
1.7.5.4
Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
Quoted 8 lines
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/dmesgmay provide additional information.Fatal: No
CONFIG_PERF_EVENTS=ykernel support configured?
Quoted 8 lines
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
Quoted 21 lines
Signed-off-by David Ahern <[email protected]>--- tools/perf/builtin-record.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)tools/perf/builtin-record.c +2
-1@@ -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)Signature · 1 line
1.7.5.4
Quoted 18 lines · Arnaldo Carvalho de Melo
Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
Quoted 8 lines
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/dmesgmay provide additional information.Fatal: No
CONFIG_PERF_EVENTS=ykernel support configured?Quoted 8 lines
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) ]
Quoted 8 lines
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
Arnaldo Carvalho de Melo
AppliedEm Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
Quoted 8 lines
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/dmesgmay provide additional information.Fatal: No
CONFIG_PERF_EVENTS=ykernel support configured?
Quoted 8 lines
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
Quoted 13 lines · Arnaldo Carvalho de Melo
Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
Quoted 12 lines
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/dmesgmay provide additional information.Fatal: No
CONFIG_PERF_EVENTS=ykernel 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:
Quoted 8 lines
Quoted 4 lines
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
Em Wed, May 09, 2012 at 10:22:45AM -0600, David Ahern escreveu:
Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 4 lines
Em Mon, May 07, 2012 at 10:40:04PM -0600, David Ahern escreveu:
Quoted 1 line
perf-record on PPC is not falling back to cpu-clock:
Thanks, applied to my perf/core branch.
Quoted 7 lines
Quoted 1 line
Can you please provide one for perf/urgent?
Not needed. Problem on perf/core was introduced by
5a7ed29c7572d00a75e8c4529e30c5ac2ef82271The 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