[PATCH v4 0/8] PMU Support for per-engine-class activity

Riana Tauro riana.tauro at intel.com
Wed Jan 29 10:16:43 UTC 2025


This series adds support for per-engine-class activity for native
and PF and VF's

PMU provides two counters (engine-active-ticks, engine-total-ticks)
to calculate engine activity. When querying this, user must group
these 2 counters using the perf_event group mechanism to ensure
both counters are sampled together.

To list the events

        ./perf list
                xe_0000_03_00.0/engine-active-ticks/    [Kernel PMU event]
                xe_0000_03_00.0/engine-total-ticks/     [Kernel PMU event]

The formats to be used with the above are

        function        - config:59-44
        engine_class    - config:20-27
        engine_instance - config:12-19
        gt              - config:60-63

The events can then be read using perf tool

        ./perf stat -e xe_<bdf>/engine-active-ticks,gt=<n>,engine_class=<n>,
                                engine_instance=<n>,function=<n>/,
                       xe_<bdf>/engine-total-ticks,gt=<n>,engine_class=<n>,
                                engine_instance=<n>,function<n>/
                       -I 1000

Engine activity can then be calculated as below
engine activity % = (engine active ticks/engine total ticks) * 100


Rev2: Add trace functions
      fix cosmetic review comments

Rev3: add engine class and instance as parameters
      bump minimum guc to 70.36.0
      replace busyness with engine activity

Rev4: add per-function per-engine-class activity
      fix review comments

Riana Tauro (8):
  drm/xe: Add per-engine-class activity support
  drm/xe/trace: Add trace for engine activity
  drm/xe/guc: Expose engine activity only for supported GuC version
  drm/xe/xe_pmu: Add PMU support for per-engine-class activity
  drm/xe/guc: Bump minimum required GuC version to v70.36.0
  drm/xe: Add support for per-function engine activity
  drm/xe/xe_pmu: Add pmu support for per-function engine activity stats
  drm/xe/pf: Enable per-function per-engine-class activity stats

 drivers/gpu/drm/xe/Makefile                   |   1 +
 drivers/gpu/drm/xe/abi/guc_actions_abi.h      |   2 +
 drivers/gpu/drm/xe/regs/xe_gt_regs.h          |   2 +
 drivers/gpu/drm/xe/xe_guc.c                   |   5 +
 drivers/gpu/drm/xe/xe_guc_engine_activity.c   | 500 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_guc_engine_activity.h   |  20 +
 .../gpu/drm/xe/xe_guc_engine_activity_types.h |  95 ++++
 drivers/gpu/drm/xe/xe_guc_fwif.h              |  19 +
 drivers/gpu/drm/xe/xe_guc_types.h             |   4 +
 drivers/gpu/drm/xe/xe_pci_sriov.c             |  23 +
 drivers/gpu/drm/xe/xe_pmu.c                   | 158 +++++-
 drivers/gpu/drm/xe/xe_trace_guc.h             |  49 ++
 drivers/gpu/drm/xe/xe_uc.c                    |   3 +
 drivers/gpu/drm/xe/xe_uc_fw.c                 |  28 +-
 14 files changed, 886 insertions(+), 23 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_guc_engine_activity.c
 create mode 100644 drivers/gpu/drm/xe/xe_guc_engine_activity.h
 create mode 100644 drivers/gpu/drm/xe/xe_guc_engine_activity_types.h

-- 
2.47.1



More information about the Intel-xe mailing list