linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] perf tools: Fix auto-complete on s390x
@ 2025-07-25 17:13 Jan Polensky
  2025-07-26  5:27 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Polensky @ 2025-07-25 17:13 UTC (permalink / raw)
  To: adrian.hunter, irogers, namhyung, Thomas Richter; +Cc: linux-perf-users

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.

Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
 tools/perf/perf-completion.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 69cba3c170d5..8db6de98007b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -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
 
-- 
2.48.1


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

* Re: [PATCH v1 1/1] perf tools: Fix auto-complete on s390x
  2025-07-25 17:13 [PATCH v1 1/1] perf tools: Fix auto-complete on s390x Jan Polensky
@ 2025-07-26  5:27 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2025-07-26  5:27 UTC (permalink / raw)
  To: Jan Polensky; +Cc: adrian.hunter, irogers, Thomas Richter, linux-perf-users

Hello,

On Fri, Jul 25, 2025 at 07:13:54PM +0200, Jan Polensky wrote:
> 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.
> 
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  tools/perf/perf-completion.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
> index 69cba3c170d5..8db6de98007b 100644
> --- a/tools/perf/perf-completion.sh
> +++ b/tools/perf/perf-completion.sh
> @@ -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


>  			cpu_evts=$(ls /sys/bus/event_source/devices/cpu/events)
>  		fi
>  
> -- 
> 2.48.1
> 

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

end of thread, other threads:[~2025-07-26  5:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25 17:13 [PATCH v1 1/1] perf tools: Fix auto-complete on s390x Jan Polensky
2025-07-26  5:27 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).