Linux Perf Users
 help / color / mirror / Atom feed
* REGRESSION linux-next since Nov 16th, perf tool broken (at least on s390)
@ 2023-11-22  7:38 Thomas Richter
  2023-11-22  8:06 ` Bagas Sanjaya
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Thomas Richter @ 2023-11-22  7:38 UTC (permalink / raw)
  To: linux-perf-use., Arnaldo Carvalho de Melo, Greg KH,
	Peter Zijlstra, Heiko Carstens, Vasily Gorbik
  Cc: Sumanth Korikkar

perf tool fails on linux-next since Nov 16th on s390 when invoking perf on
any PMU event, as in

  # perf stat -e cycles -- true

   Performance counter stats for 'true':

     <not supported>      cycles                                                               

       0.000598399 seconds time elapsed

       0.000055000 seconds user
       0.000567000 seconds sys

  # perf stat -e pai_ext/NNPA_ALL/ -C0 -- true
  event syntax error: 'pai_ext/NNPA_ALL/'
                       \___ Bad event or PMU

  Unable to find PMU or event on a PMU of 'pai_ext'

  Initial error:
  event syntax error: 'pai_ext/NNPA_ALL/'
                       \___ Cannot find PMU `pai_ext'. Missing kernel support?
  #

This error is caused by following commit, which got into linux-next around November 15th:

commit 652ffc2104ec1f69dd4a46313888c33527145ccf
Author: Greg KH <gregkh@linuxfoundation.org>
Date:   Mon Jun 12 15:09:09 2023 +0200

    perf/core: Fix narrow startup race when creating the perf nr_addr_filters sysfs file

    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/2023061204-decal-flyable-6090@gregkh

This commit adds function pmu_dev_is_visible() as the PMU bus function
to make sysfs attribute files visible.
On a failing system these sysfs attribute files are exported:

#  ll /sys/devices/pai_ext/
drwxr-xr-x. 2 root root    0 Nov 21 14:59 events
drwxr-xr-x. 2 root root    0 Nov 21 14:59 format
lrwxrwxrwx. 1 root root    0 Nov 21 14:43 subsystem -> ../../bus/event_source
-rw-r--r--. 1 root root 4096 Nov 21 14:43 uevent
#

These is no file named 'type'. Other files are also missing.
Therefore the perf tool can not access any PMU event defined by this PMU.

On a system with proper export of all PMU sysfs attributes (same linux-next kernel):
#  ll /sys/devices/pai_crypto/
total 0
drwxr-xr-x. 2 root root    0 Nov 21 14:44 events
drwxr-xr-x. 2 root root    0 Nov 21 14:44 format
-r--r--r--. 1 root root 4096 Nov 21 14:44 nr_addr_filters
-rw-r--r--. 1 root root 4096 Nov 21 14:44 perf_event_mux_interval_ms
lrwxrwxrwx. 1 root root    0 Nov 21 14:43 subsystem -> ../../bus/event_source
-r--r--r--. 1 root root 4096 Nov 21 14:44 type
-rw-r--r--. 1 root root 4096 Nov 21 14:44 uevent
# cat /sys/devices/pai_crypto/type
12
#

Also on such a system the perf stat works again:
# perf stat -e pai_crypto/CRYPTO_ALL/ -C0 -- true

 Performance counter stats for 'CPU(s) 0':

                 0      pai_crypto/CRYPTO_ALL/

       0.000741258 seconds time elapsed

#

On s390 there is no need to export sysfs file 'nr_addr_filters', but setting
this member pmu::nr_addr_filters to a non-zero value before
calling perf_pmu_register() exhibits the old behavior again.

In my opinion this breaks previous behavior.

Is this intended?
How to fix this?

Thanks for your help.



-- 
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

end of thread, other threads:[~2023-11-23 11:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22  7:38 REGRESSION linux-next since Nov 16th, perf tool broken (at least on s390) Thomas Richter
2023-11-22  8:06 ` Bagas Sanjaya
2023-11-22  9:31 ` Greg KH
2023-11-23  7:54   ` Thomas Richter
2023-11-23  8:43     ` Greg KH
2023-11-22 10:07 ` Peter Zijlstra
2023-11-22 14:38   ` Thomas Richter
2023-11-22 15:29     ` Peter Zijlstra
2023-11-23 11:38   ` Thomas Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox