[PATCH v4 0/6] Assume sysfs event names are always the same case

Ian Rogers posted 6 patches 1 year, 7 months ago
There is a newer version of this series
.../sysfs-bus-event_source-devices-events     |   6 +
tools/perf/tests/pmu-events.c                 |   2 +-
tools/perf/tests/pmu.c                        | 468 ++++++++++++------
tools/perf/util/parse-events.c                |   2 +-
tools/perf/util/parse-events.h                |   2 +-
tools/perf/util/pmu.c                         | 111 +++--
tools/perf/util/pmu.h                         |   4 +-
tools/perf/util/pmus.c                        |  16 +-
tools/perf/util/pmus.h                        |   2 +
9 files changed, 416 insertions(+), 197 deletions(-)
[PATCH v4 0/6] Assume sysfs event names are always the same case
Posted by Ian Rogers 1 year, 7 months ago
By assuming sysfs events are either upper or lower case, the case
insensitive event parsing can probe for the existence of files 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.

v1 sent as an RFC:
    https://lore.kernel.org/lkml/20240413040812.4042051-1-irogers@google.com/

v2: addresses review feedback from Kan Liang, by updating
    documentation and adding tests.

v3: incorporate feedback from Thomas Richter <tmricht@linux.ibm.com>
    that s390 event names are all upper case. Do a lower case probe
    then an upper case probe, make documentation and tests also agree.

v4: add checks to write (kernel test robot) and fix a typo.

Ian Rogers (6):
  perf test pmu-events: Make it clearer that pmu-events tests json
    events
  perf Document: Sysfs event names must be lower or upper case
  perf test pmu: Refactor format test and exposed test APIs
  perf test pmu: Add an eagerly loaded event test
  perf test pmu: Test all sysfs PMU event names are the same case
  perf pmu: Assume sysfs events are always the same case

 .../sysfs-bus-event_source-devices-events     |   6 +
 tools/perf/tests/pmu-events.c                 |   2 +-
 tools/perf/tests/pmu.c                        | 468 ++++++++++++------
 tools/perf/util/parse-events.c                |   2 +-
 tools/perf/util/parse-events.h                |   2 +-
 tools/perf/util/pmu.c                         | 111 +++--
 tools/perf/util/pmu.h                         |   4 +-
 tools/perf/util/pmus.c                        |  16 +-
 tools/perf/util/pmus.h                        |   2 +
 9 files changed, 416 insertions(+), 197 deletions(-)

-- 
2.45.0.rc0.197.gbae5840b3b-goog
Re: [PATCH v4 0/6] Assume sysfs event names are always the same case
Posted by Liang, Kan 1 year, 7 months ago

On 2024-05-02 12:01 a.m., Ian Rogers wrote:
> By assuming sysfs events are either upper or lower case, the case
> insensitive event parsing can probe for the existence of files 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.
> 
> v1 sent as an RFC:
>     https://lore.kernel.org/lkml/20240413040812.4042051-1-irogers@google.com/
> 
> v2: addresses review feedback from Kan Liang, by updating
>     documentation and adding tests.
> 
> v3: incorporate feedback from Thomas Richter <tmricht@linux.ibm.com>
>     that s390 event names are all upper case. Do a lower case probe
>     then an upper case probe, make documentation and tests also agree.
> 
> v4: add checks to write (kernel test robot) and fix a typo.
> 
> Ian Rogers (6):
>   perf test pmu-events: Make it clearer that pmu-events tests json
>     events
>   perf Document: Sysfs event names must be lower or upper case
>   perf test pmu: Refactor format test and exposed test APIs
>   perf test pmu: Add an eagerly loaded event test
>   perf test pmu: Test all sysfs PMU event names are the same case
>   perf pmu: Assume sysfs events are always the same case
> 
>  .../sysfs-bus-event_source-devices-events     |   6 +
>  tools/perf/tests/pmu-events.c                 |   2 +-
>  tools/perf/tests/pmu.c                        | 468 ++++++++++++------
>  tools/perf/util/parse-events.c                |   2 +-
>  tools/perf/util/parse-events.h                |   2 +-
>  tools/perf/util/pmu.c                         | 111 +++--
>  tools/perf/util/pmu.h                         |   4 +-
>  tools/perf/util/pmus.c                        |  16 +-
>  tools/perf/util/pmus.h                        |   2 +
>  9 files changed, 416 insertions(+), 197 deletions(-)
> 

Except the warning for the uninitialized 'ret', the rest looks good to me.

Reviewed-by: Kan Liang <kan.liang@linux.intel.com>

Thanks,
Kan
Re: [PATCH v4 0/6] Assume sysfs event names are always the same case
Posted by Ian Rogers 1 year, 7 months ago
On Thu, May 2, 2024 at 11:15 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
>
>
>
> On 2024-05-02 12:01 a.m., Ian Rogers wrote:
> > By assuming sysfs events are either upper or lower case, the case
> > insensitive event parsing can probe for the existence of files 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.
> >
> > v1 sent as an RFC:
> >     https://lore.kernel.org/lkml/20240413040812.4042051-1-irogers@google.com/
> >
> > v2: addresses review feedback from Kan Liang, by updating
> >     documentation and adding tests.
> >
> > v3: incorporate feedback from Thomas Richter <tmricht@linux.ibm.com>
> >     that s390 event names are all upper case. Do a lower case probe
> >     then an upper case probe, make documentation and tests also agree.
> >
> > v4: add checks to write (kernel test robot) and fix a typo.
> >
> > Ian Rogers (6):
> >   perf test pmu-events: Make it clearer that pmu-events tests json
> >     events
> >   perf Document: Sysfs event names must be lower or upper case
> >   perf test pmu: Refactor format test and exposed test APIs
> >   perf test pmu: Add an eagerly loaded event test
> >   perf test pmu: Test all sysfs PMU event names are the same case
> >   perf pmu: Assume sysfs events are always the same case
> >
> >  .../sysfs-bus-event_source-devices-events     |   6 +
> >  tools/perf/tests/pmu-events.c                 |   2 +-
> >  tools/perf/tests/pmu.c                        | 468 ++++++++++++------
> >  tools/perf/util/parse-events.c                |   2 +-
> >  tools/perf/util/parse-events.h                |   2 +-
> >  tools/perf/util/pmu.c                         | 111 +++--
> >  tools/perf/util/pmu.h                         |   4 +-
> >  tools/perf/util/pmus.c                        |  16 +-
> >  tools/perf/util/pmus.h                        |   2 +
> >  9 files changed, 416 insertions(+), 197 deletions(-)
> >
>
> Except the warning for the uninitialized 'ret', the rest looks good to me.

Thanks Kan, I'll hunt that down to fix in v5 and add your reviewed-by.
Would be awesome to get Thomas or someone else's s390 thumbs up. The
differences between v3 to v5 should be very minor, so I'd accept a
check on any of them :-)

Ian

> Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
>
> Thanks,
> Kan