Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	dri-devel@lists.freedesktop.org,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH v4 0/8] drm/xe: Per client usage
Date: Wed, 15 May 2024 14:42:50 -0700	[thread overview]
Message-ID: <20240515214258.59209-1-lucas.demarchi@intel.com> (raw)

v4 of https://lore.kernel.org/all/20240507224510.442971-1-lucas.demarchi@intel.com

Add per-client usage statistics to xe. This ports xe to use the common
method in drm to export the usage to userspace per client (where 1
client == 1 drm fd open).

However instead of using the current format measured in nsec, this
creates a new one. The intention here is not to mix the GPU clock domain
with the CPU clock. It allows to cover a few more use cases without
extra complications.

This version is tested on an ADL-P and also checked gputop with i915 to
make sure not regressed. Last patch also contains the documentation for
the new key and sample output as requested in v1.

The pre-existent drm-cycles-<keystr> is used as is, which allows gputop
to work with xe.

This last patch still has some open discussion from v2, so we may need
to hold it a little more.

v2:
  - Create a new drm-total-cycles instead of re-using drm-engine with a
    different unit
  - Add documentation for the new interface and clarify usage of
    xe_lrc_update_timestamp()

v3:
  - Fix bugs in "drm/xe: Add helper to accumulate exec queue runtime" -
    see commit message
  - Reorder commits so the ones that are useful in other patch series
    come first

v4:
  - Fix some comments and documentation
  - Add 2 patches so we cache on the gt the mask of engines visible to
    userspace and the per-class capacity. Previously we were doing this
    during the query, but besides not being very efficient as pointed
    by Tvrtko, we were also not handling correclty reserved engines and
    engines "hidden" by e.g. ccs_mode.  So move that part to be executed
    on init and when changing the available engines.
  - Simplify the fdinfo output loop since now we have the information
    cached on gt. This also moves the read of the gpu timestamp out
    of the loop as suggested by Tvrtko and using the helpers implemented
    in the new patches.

Lucas De Marchi (6):
  drm/xe: Promote xe_hw_engine_class_to_str()
  drm/xe: Add XE_ENGINE_CLASS_OTHER to str conversion
  drm/xe: Add helper to capture engine timestamp
  drm/xe: Cache data about user-visible engines
  drm/xe: Add helper to return any available hw engine
  drm/xe/client: Print runtime to fdinfo

Umesh Nerlige Ramappa (2):
  drm/xe/lrc: Add helper to capture context timestamp
  drm/xe: Add helper to accumulate exec queue runtime

 Documentation/gpu/drm-usage-stats.rst         |  21 ++-
 Documentation/gpu/xe/index.rst                |   1 +
 Documentation/gpu/xe/xe-drm-usage-stats.rst   |  10 ++
 drivers/gpu/drm/xe/regs/xe_lrc_layout.h       |   1 +
 drivers/gpu/drm/xe/xe_device_types.h          |   3 +
 drivers/gpu/drm/xe/xe_drm_client.c            | 121 +++++++++++++++++-
 drivers/gpu/drm/xe/xe_exec_queue.c            |  37 ++++++
 drivers/gpu/drm/xe/xe_exec_queue.h            |   1 +
 drivers/gpu/drm/xe/xe_execlist.c              |   1 +
 drivers/gpu/drm/xe/xe_gt.c                    |  34 +++++
 drivers/gpu/drm/xe/xe_gt.h                    |  20 +++
 drivers/gpu/drm/xe/xe_gt_ccs_mode.c           |   1 +
 drivers/gpu/drm/xe/xe_gt_types.h              |  21 ++-
 drivers/gpu/drm/xe/xe_guc_submit.c            |   2 +
 drivers/gpu/drm/xe/xe_hw_engine.c             |  27 ++++
 drivers/gpu/drm/xe/xe_hw_engine.h             |   3 +
 drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c |  18 ---
 drivers/gpu/drm/xe/xe_lrc.c                   |  12 ++
 drivers/gpu/drm/xe/xe_lrc.h                   |  14 ++
 drivers/gpu/drm/xe/xe_lrc_types.h             |   3 +
 20 files changed, 329 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/gpu/xe/xe-drm-usage-stats.rst

-- 
2.43.0


             reply	other threads:[~2024-05-15 21:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15 21:42 Lucas De Marchi [this message]
2024-05-15 21:42 ` [PATCH v4 1/8] drm/xe: Promote xe_hw_engine_class_to_str() Lucas De Marchi
2024-05-15 21:42 ` [PATCH v4 2/8] drm/xe: Add XE_ENGINE_CLASS_OTHER to str conversion Lucas De Marchi
2024-05-15 21:42 ` [PATCH v4 3/8] drm/xe/lrc: Add helper to capture context timestamp Lucas De Marchi
2024-05-17 16:39   ` Francois Dugast
2024-05-15 21:42 ` [PATCH v4 4/8] drm/xe: Add helper to capture engine timestamp Lucas De Marchi
2024-05-15 21:42 ` [PATCH v4 5/8] drm/xe: Add helper to accumulate exec queue runtime Lucas De Marchi
2024-05-15 21:42 ` [PATCH v4 6/8] drm/xe: Cache data about user-visible engines Lucas De Marchi
2024-05-16 14:50   ` Cavitt, Jonathan
2024-05-16 18:33   ` Umesh Nerlige Ramappa
2024-05-16 19:52     ` Lucas De Marchi
2024-05-16 22:56       ` Umesh Nerlige Ramappa
2024-05-15 21:42 ` [PATCH v4 7/8] drm/xe: Add helper to return any available hw engine Lucas De Marchi
2024-05-16 18:55   ` Umesh Nerlige Ramappa
2024-05-15 21:42 ` [PATCH v4 8/8] drm/xe/client: Print runtime to fdinfo Lucas De Marchi
2024-05-16  7:57   ` Tvrtko Ursulin
2024-05-16 13:39     ` Lucas De Marchi
2024-05-16 19:21   ` Umesh Nerlige Ramappa
2024-05-15 21:51 ` ✓ CI.Patch_applied: success for drm/xe: Per client usage (rev4) Patchwork
2024-05-15 21:51 ` ✗ CI.checkpatch: warning " Patchwork
2024-05-15 21:53 ` ✓ CI.KUnit: success " Patchwork
2024-05-15 22:07 ` ✓ CI.Build: " Patchwork
2024-05-15 22:10 ` ✗ CI.Hooks: failure " Patchwork
2024-05-16 20:09   ` Lucas De Marchi
2024-05-15 22:11 ` ✓ CI.checksparse: success " Patchwork
2024-05-15 22:46 ` ✓ CI.BAT: " Patchwork
2024-05-16  0:05 ` ✗ CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240515214258.59209-1-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=tursulin@ursulin.net \
    --cc=umesh.nerlige.ramappa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox