[PATCH v3 0/4] Add support for a DRM tool like PMU

Ian Rogers posted 4 patches 10 months, 1 week ago
There is a newer version of this series
tools/perf/tests/shell/drm_pmu.sh |  78 ++++
tools/perf/util/Build             |   1 +
tools/perf/util/drm_pmu.c         | 689 ++++++++++++++++++++++++++++++
tools/perf/util/drm_pmu.h         |  39 ++
tools/perf/util/evsel.c           |   9 +
tools/perf/util/parse-events.c    |  30 +-
tools/perf/util/pmu.c             |  15 +
tools/perf/util/pmu.h             |   4 +-
tools/perf/util/pmus.c            | 101 ++++-
tools/perf/util/pmus.h            |   2 +
10 files changed, 952 insertions(+), 16 deletions(-)
create mode 100755 tools/perf/tests/shell/drm_pmu.sh
create mode 100644 tools/perf/util/drm_pmu.c
create mode 100644 tools/perf/util/drm_pmu.h
[PATCH v3 0/4] Add support for a DRM tool like PMU
Posted by Ian Rogers 10 months, 1 week ago
DRM clients expose information through usage stats as documented in
Documentation/gpu/drm-usage-stats.rst (available online at
https://docs.kernel.org/gpu/drm-usage-stats.html). Add a tool like
PMU, similar to the hwmon PMU, that exposes DRM information.

v3: Minor tweak to the test so the skip (exit 2) doesn't trigger the
    trap cleanup.

v2: Add support to only scan hwmon and drm PMUs if the event or PMU
wildcard can match. Add a test as requested by Namhyung. Add file
comments.

v1:
https://lore.kernel.org/lkml/20250211071727.364389-1-irogers@google.com/

Ian Rogers (4):
  perf parse-events: Avoid scanning PMUs that can't contain events
  perf parse-events: Avoid scanning PMUs that can't match a wildcard
  perf drm_pmu: Add a tool like PMU to expose DRM information
  perf tests: Add a DRM PMU test

 tools/perf/tests/shell/drm_pmu.sh |  78 ++++
 tools/perf/util/Build             |   1 +
 tools/perf/util/drm_pmu.c         | 689 ++++++++++++++++++++++++++++++
 tools/perf/util/drm_pmu.h         |  39 ++
 tools/perf/util/evsel.c           |   9 +
 tools/perf/util/parse-events.c    |  30 +-
 tools/perf/util/pmu.c             |  15 +
 tools/perf/util/pmu.h             |   4 +-
 tools/perf/util/pmus.c            | 101 ++++-
 tools/perf/util/pmus.h            |   2 +
 10 files changed, 952 insertions(+), 16 deletions(-)
 create mode 100755 tools/perf/tests/shell/drm_pmu.sh
 create mode 100644 tools/perf/util/drm_pmu.c
 create mode 100644 tools/perf/util/drm_pmu.h

-- 
2.49.0.504.g3bcea36a83-goog
Re: [PATCH v3 0/4] Add support for a DRM tool like PMU
Posted by Namhyung Kim 7 months, 2 weeks ago
Hi Ian,

On Thu, Apr 03, 2025 at 01:24:35PM -0700, Ian Rogers wrote:
> DRM clients expose information through usage stats as documented in
> Documentation/gpu/drm-usage-stats.rst (available online at
> https://docs.kernel.org/gpu/drm-usage-stats.html). Add a tool like
> PMU, similar to the hwmon PMU, that exposes DRM information.
> 
> v3: Minor tweak to the test so the skip (exit 2) doesn't trigger the
>     trap cleanup.
> 
> v2: Add support to only scan hwmon and drm PMUs if the event or PMU
> wildcard can match. Add a test as requested by Namhyung. Add file
> comments.
> 
> v1:
> https://lore.kernel.org/lkml/20250211071727.364389-1-irogers@google.com/
> 
> Ian Rogers (4):
>   perf parse-events: Avoid scanning PMUs that can't contain events
>   perf parse-events: Avoid scanning PMUs that can't match a wildcard
>   perf drm_pmu: Add a tool like PMU to expose DRM information
>   perf tests: Add a DRM PMU test

Can you please refresh this series?  It doesn't apply cleanly anymore.

Thanks,
Namhyung

> 
>  tools/perf/tests/shell/drm_pmu.sh |  78 ++++
>  tools/perf/util/Build             |   1 +
>  tools/perf/util/drm_pmu.c         | 689 ++++++++++++++++++++++++++++++
>  tools/perf/util/drm_pmu.h         |  39 ++
>  tools/perf/util/evsel.c           |   9 +
>  tools/perf/util/parse-events.c    |  30 +-
>  tools/perf/util/pmu.c             |  15 +
>  tools/perf/util/pmu.h             |   4 +-
>  tools/perf/util/pmus.c            | 101 ++++-
>  tools/perf/util/pmus.h            |   2 +
>  10 files changed, 952 insertions(+), 16 deletions(-)
>  create mode 100755 tools/perf/tests/shell/drm_pmu.sh
>  create mode 100644 tools/perf/util/drm_pmu.c
>  create mode 100644 tools/perf/util/drm_pmu.h
> 
> -- 
> 2.49.0.504.g3bcea36a83-goog
>
Re: [PATCH v3 0/4] Add support for a DRM tool like PMU
Posted by Ian Rogers 9 months, 1 week ago
On Thu, Apr 3, 2025 at 1:24 PM Ian Rogers <irogers@google.com> wrote:
>
> DRM clients expose information through usage stats as documented in
> Documentation/gpu/drm-usage-stats.rst (available online at
> https://docs.kernel.org/gpu/drm-usage-stats.html). Add a tool like
> PMU, similar to the hwmon PMU, that exposes DRM information.

I'm reminded by Brendan Gregg's new blog:
https://www.brendangregg.com/blog/2025-05-01/doom-gpu-flame-graphs.html
that this is still outstanding. The patches also reduce some directory
scanning for the hwmon "PMU", they are in Google's tree:
https://github.com/googleprodkernel/linux-perf/blob/google_tools_master/tools/perf/util/drm_pmu.c

Thanks,
Ian

> v3: Minor tweak to the test so the skip (exit 2) doesn't trigger the
>     trap cleanup.
>
> v2: Add support to only scan hwmon and drm PMUs if the event or PMU
> wildcard can match. Add a test as requested by Namhyung. Add file
> comments.
>
> v1:
> https://lore.kernel.org/lkml/20250211071727.364389-1-irogers@google.com/
>
> Ian Rogers (4):
>   perf parse-events: Avoid scanning PMUs that can't contain events
>   perf parse-events: Avoid scanning PMUs that can't match a wildcard
>   perf drm_pmu: Add a tool like PMU to expose DRM information
>   perf tests: Add a DRM PMU test
>
>  tools/perf/tests/shell/drm_pmu.sh |  78 ++++
>  tools/perf/util/Build             |   1 +
>  tools/perf/util/drm_pmu.c         | 689 ++++++++++++++++++++++++++++++
>  tools/perf/util/drm_pmu.h         |  39 ++
>  tools/perf/util/evsel.c           |   9 +
>  tools/perf/util/parse-events.c    |  30 +-
>  tools/perf/util/pmu.c             |  15 +
>  tools/perf/util/pmu.h             |   4 +-
>  tools/perf/util/pmus.c            | 101 ++++-
>  tools/perf/util/pmus.h            |   2 +
>  10 files changed, 952 insertions(+), 16 deletions(-)
>  create mode 100755 tools/perf/tests/shell/drm_pmu.sh
>  create mode 100644 tools/perf/util/drm_pmu.c
>  create mode 100644 tools/perf/util/drm_pmu.h
>
> --
> 2.49.0.504.g3bcea36a83-goog
>
Re: [PATCH v3 0/4] Add support for a DRM tool like PMU
Posted by Arnaldo Carvalho de Melo 9 months, 1 week ago
On Wed, Apr 30, 2025 at 08:21:59AM -0700, Ian Rogers wrote:
> On Thu, Apr 3, 2025 at 1:24 PM Ian Rogers <irogers@google.com> wrote:
> >
> > DRM clients expose information through usage stats as documented in
> > Documentation/gpu/drm-usage-stats.rst (available online at
> > https://docs.kernel.org/gpu/drm-usage-stats.html). Add a tool like
> > PMU, similar to the hwmon PMU, that exposes DRM information.

Looks useful, I'll try to review and test tomorrow, but most probably
Friday, as tomorrow is labour day in this part of the world.

- Arnaldo
 
> I'm reminded by Brendan Gregg's new blog:
> https://www.brendangregg.com/blog/2025-05-01/doom-gpu-flame-graphs.html
> that this is still outstanding. The patches also reduce some directory
> scanning for the hwmon "PMU", they are in Google's tree:
> https://github.com/googleprodkernel/linux-perf/blob/google_tools_master/tools/perf/util/drm_pmu.c
> 
> Thanks,
> Ian
> 
> > v3: Minor tweak to the test so the skip (exit 2) doesn't trigger the
> >     trap cleanup.
> >
> > v2: Add support to only scan hwmon and drm PMUs if the event or PMU
> > wildcard can match. Add a test as requested by Namhyung. Add file
> > comments.
> >
> > v1:
> > https://lore.kernel.org/lkml/20250211071727.364389-1-irogers@google.com/
> >
> > Ian Rogers (4):
> >   perf parse-events: Avoid scanning PMUs that can't contain events
> >   perf parse-events: Avoid scanning PMUs that can't match a wildcard
> >   perf drm_pmu: Add a tool like PMU to expose DRM information
> >   perf tests: Add a DRM PMU test
> >
> >  tools/perf/tests/shell/drm_pmu.sh |  78 ++++
> >  tools/perf/util/Build             |   1 +
> >  tools/perf/util/drm_pmu.c         | 689 ++++++++++++++++++++++++++++++
> >  tools/perf/util/drm_pmu.h         |  39 ++
> >  tools/perf/util/evsel.c           |   9 +
> >  tools/perf/util/parse-events.c    |  30 +-
> >  tools/perf/util/pmu.c             |  15 +
> >  tools/perf/util/pmu.h             |   4 +-
> >  tools/perf/util/pmus.c            | 101 ++++-
> >  tools/perf/util/pmus.h            |   2 +
> >  10 files changed, 952 insertions(+), 16 deletions(-)
> >  create mode 100755 tools/perf/tests/shell/drm_pmu.sh
> >  create mode 100644 tools/perf/util/drm_pmu.c
> >  create mode 100644 tools/perf/util/drm_pmu.h
> >
> > --
> > 2.49.0.504.g3bcea36a83-goog
> >
Re: [PATCH v3 0/4] Add support for a DRM tool like PMU
Posted by Ian Rogers 8 months, 2 weeks ago
On Wed, Apr 30, 2025 at 4:36 PM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> On Wed, Apr 30, 2025 at 08:21:59AM -0700, Ian Rogers wrote:
> > On Thu, Apr 3, 2025 at 1:24 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > DRM clients expose information through usage stats as documented in
> > > Documentation/gpu/drm-usage-stats.rst (available online at
> > > https://docs.kernel.org/gpu/drm-usage-stats.html). Add a tool like
> > > PMU, similar to the hwmon PMU, that exposes DRM information.
>
> Looks useful, I'll try to review and test tomorrow, but most probably
> Friday, as tomorrow is labour day in this part of the world.

Ping. Thanks,
Ian

> - Arnaldo
>
> > I'm reminded by Brendan Gregg's new blog:
> > https://www.brendangregg.com/blog/2025-05-01/doom-gpu-flame-graphs.html
> > that this is still outstanding. The patches also reduce some directory
> > scanning for the hwmon "PMU", they are in Google's tree:
> > https://github.com/googleprodkernel/linux-perf/blob/google_tools_master/tools/perf/util/drm_pmu.c
> >
> > Thanks,
> > Ian
> >
> > > v3: Minor tweak to the test so the skip (exit 2) doesn't trigger the
> > >     trap cleanup.
> > >
> > > v2: Add support to only scan hwmon and drm PMUs if the event or PMU
> > > wildcard can match. Add a test as requested by Namhyung. Add file
> > > comments.
> > >
> > > v1:
> > > https://lore.kernel.org/lkml/20250211071727.364389-1-irogers@google.com/
> > >
> > > Ian Rogers (4):
> > >   perf parse-events: Avoid scanning PMUs that can't contain events
> > >   perf parse-events: Avoid scanning PMUs that can't match a wildcard
> > >   perf drm_pmu: Add a tool like PMU to expose DRM information
> > >   perf tests: Add a DRM PMU test
> > >
> > >  tools/perf/tests/shell/drm_pmu.sh |  78 ++++
> > >  tools/perf/util/Build             |   1 +
> > >  tools/perf/util/drm_pmu.c         | 689 ++++++++++++++++++++++++++++++
> > >  tools/perf/util/drm_pmu.h         |  39 ++
> > >  tools/perf/util/evsel.c           |   9 +
> > >  tools/perf/util/parse-events.c    |  30 +-
> > >  tools/perf/util/pmu.c             |  15 +
> > >  tools/perf/util/pmu.h             |   4 +-
> > >  tools/perf/util/pmus.c            | 101 ++++-
> > >  tools/perf/util/pmus.h            |   2 +
> > >  10 files changed, 952 insertions(+), 16 deletions(-)
> > >  create mode 100755 tools/perf/tests/shell/drm_pmu.sh
> > >  create mode 100644 tools/perf/util/drm_pmu.c
> > >  create mode 100644 tools/perf/util/drm_pmu.h
> > >
> > > --
> > > 2.49.0.504.g3bcea36a83-goog
> > >