Re: [PATCH v2 0/6] Assume sysfs event names are always lowercase

Ian Rogers
2024-04-23T15:15:19Z

On Mon, Apr 22, 2024 at 11:53 PM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> On 4/23/24 05:17, Ian Rogers wrote:
> > By assuming sysfs events are lower case, the case insensitive event
> > parsing can probe for the existence of a file rather then loading all
> > events in a directory. When the event is a json event like
> > inst_retired.any on Intel, this reduces the number of openat calls on
> > a Tigerlake laptop from 325 down to 255.
> >
>
> Ian, sorry for the late reply.
> On s390 the events in the sysfs tree are all upper case:

Yikes, sigh.. thanks for catching this :-)

> [root@a35lp67 ~]# ls -l /sys/devices/cpum_cf/events/ | head -10
> total 0
> -r--r--r-- 1 root root 4096 Apr 17 14:47 AES_BLOCKED_CYCLES
> -r--r--r-- 1 root root 4096 Apr 17 14:47 AES_BLOCKED_FUNCTIONS
> -r--r--r-- 1 root root 4096 Apr 17 14:47 AES_CYCLES
> -r--r--r-- 1 root root 4096 Apr 17 14:47 AES_FUNCTIONS
> -r--r--r-- 1 root root 4096 Apr 17 14:47 BCD_DFP_EXECUTION_SLOTS
> -r--r--r-- 1 root root 4096 Apr 17 14:47 CPU_CYCLES
> -r--r--r-- 1 root root 4096 Apr 17 14:47 CRSTE_1MB_WRITES
> -r--r--r-- 1 root root 4096 Apr 17 14:47 DCW_OFF_DRAWER
> -r--r--r-- 1 root root 4096 Apr 17 14:47 DCW_OFF_DRAWER_MEMORY
> [root@a35lp67 ~]#
>
> Same is true for all other PMUs (currently 5 and growing).
>
> Is there a branch to pull to try out the effect of your patch on s390?

Sorry not, I think everything would break anyway. I'll extend what
I've done so that event names can be lowercase or in shouty UPPERCASE.

Thanks,
Ian

> Thanks Thomas
> --
> Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
> --
> IBM Deutschland Research & Development GmbH
>
> Vorsitzender des Aufsichtsrats: Wolfgang Wendt
>
> Geschäftsführung: David Faller
>
> Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
>