perf tools: Fix auto-complete on s390x
PATCH 1/1 perf tools: Fix auto-complete on s390x
On s390x, CPU-related events are not located in event_source/devices/cpu/events. Instead, they are found in architecture specific locations depending on the hypervisor configuration:
/sys/devices/pai_crypto/events/
/sys/devices/cpum_cf_diag/events/
/sys/devices/pai_ext/events/
/sys/devices/cpum_cf/events/
/sys/devices/cpum_sf/events/
Using current auto-complete script result in the following error:
[root@localhost perf]# perf top -e
ls: cannot access '/sys/bus/event_source/devices/cpu/events': No such file or directory
Fix this by skipping the check for /sys/bus/event_source/devices/cpu/events on s390x systems.
--- tools/perf/perf-completion.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/perf-completion.sh +2 -1
@@ -168,10 +168,11 @@ __perf_main () local cur1=${COMP_WORDS[COMP_CWORD]} local raw_evts local arr s tmp result cpu_evts + local arch=`uname -m` raw_evts=$($cmd list --raw-dump hw sw cache tracepoint pmu sdt) # aarch64 doesn't have /sys/bus/event_source/devices/cpu/events - if [[ `uname -m` != aarch64 ]]; then + if [[ $arch != aarch64 && $arch != s390x ]]; then cpu_evts=$(ls /sys/bus/event_source/devices/cpu/events) fi
Signature · 1 line
2.48.1
Namhyung Kim
maintainerHello,
Quoted 28 lines · Jan Polensky
On s390x, CPU-related events are not located in event_source/devices/cpu/events. Instead, they are found in architecture specific locations depending on the hypervisor configuration:
/sys/devices/pai_crypto/events/
/sys/devices/cpum_cf_diag/events/
/sys/devices/pai_ext/events/
/sys/devices/cpum_cf/events/
/sys/devices/cpum_sf/events/Using current auto-complete script result in the following error:
[root@localhost perf]# perf top -e
ls: cannot access '/sys/bus/event_source/devices/cpu/events': No such file or directoryFix this by skipping the check for
/sys/bus/event_source/devices/cpu/eventson s390x systems.Signed-off-by Jan Polensky <[email protected]>--- tools/perf/perf-completion.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/perf-completion.sh +0
-0
tools/perf/perf-completion.sh __perf_main () · line 175
Quoted 9 lines
tools/perf/perf-completion.sh +2
-1@@ -168,10 +168,11 @@ __perf_main () local cur1=${COMP_WORDS[COMP_CWORD]} local raw_evts local arr s tmp result cpu_evts + local arch=`uname -m` raw_evts=$($cmd list --raw-dump hw sw cache tracepoint pmu sdt) # aarch64 doesn't have /sys/bus/event_source/devices/cpu/events - if [[ `uname -m` != aarch64 ]]; then + if [[ $arch != aarch64 && $arch != s390x ]]; then
I think it's better to check if the directory exists or just ignore the error message by redirecting to /dev/null.
Thanks,
Namhyung
Quoted 6 lines
tools/perf/perf-completion.sh +0
-0cpu_evts=$(ls /sys/bus/event_source/devices/cpu/events) fiSignature · 1 line
2.48.1