Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	intel-xe@lists.freedesktop.org
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: Re: [PATCH 0/7] drm/xe: Per client usage
Date: Tue, 16 Apr 2024 09:37:44 +0100	[thread overview]
Message-ID: <f2c46934-e137-419d-ba34-cff864a988ce@ursulin.net> (raw)
In-Reply-To: <20240416030454.3739862-1-lucas.demarchi@intel.com>


On 16/04/2024 04:04, Lucas De Marchi wrote:
> 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 insted of using the current format, this creates a new one with
> the unit "ticks". 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.
> 
> Last patch was a quick implemenation of a gputop-like tool in python.
> I ended doing it to cross check the gputop implementation. I's not
> really meant to be applied here.
> 
> I tested this on DG2 and TGL with kmscube (console-only) and vkcube
> (in a gnome session), but it would be good to soak this under more
> tests. The biggest goal for this patch series right now is to get
> consensus on the new UAPI.
> 
> TODO: Add documentation on top with the new interface.

Yeah a drm-usage-stats.rst patch would be nice to have in the RFC so one 
does not have to look into the driver implementation to discuss the 
proposed uapi.

Nevertheless I understand the proposal is to add this:

  drm-engine-<class>: <GPU_TIMESTAMP> <RUNTIME> ticks

That's two values per key. I guess "one key value pair for per one line 
of text" does not get strictly broken and that you propose a heuristics 
in parsing to detect that the <RUNTIME> cannot be mis-interpreted as the 
unit?

Not sure it is a good idea though. If you instead added a new key for 
the gpu time what would be the downside in your view? Like:

drm-engine-<class>: <uint> ticks
drm-ticks-<class>: <uint>

Or maybe even obsfuscate/generalise as:

drm-engine-<class>: <uint> gpu-time
drm-gpu-time-<class>: <uint>

Potentially could also add a key saying how much wall time is one unit 
of GPU time.

Or.. would even the existing drm-cycles, plus abuse of drm-maxfreq, 
work? Ticks == cycles, maxfreq == ticks per wall second.

Secondly, wrap behaviour every 25-30 seconds patch 6/7 describes 
definitely breaks the format spec and in my view should be worked around 
in the driver:

"""
Values are not required to be constantly monotonic if it makes the driver
implementation easier, but are required to catch up with the previously 
reported
larger value within a reasonable period. Upon observing a value lower 
than what
was previously read, userspace is expected to stay with that larger previous
value until a monotonic update is seen.
"""

Regards,

Tvrtko

> 
> Test-with: https://lore.kernel.org/igt-dev/20240405060056.59379-1-lucas.demarchi@intel.com/
> 
> Lucas De Marchi (5):
>    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/client: Print runtime to fdinfo
>    HACK: simple gputop-like impl in python
> 
> Umesh Nerlige Ramappa (2):
>    drm/xe/lrc: Add helper to capture context timestamp
>    drm/xe: Add helper to capture context runtime
> 
>   drivers/gpu/drm/xe/regs/xe_lrc_layout.h       |   1 +
>   drivers/gpu/drm/xe/xe_device_types.h          |   9 ++
>   drivers/gpu/drm/xe/xe_drm_client.c            |  81 ++++++++++++-
>   drivers/gpu/drm/xe/xe_exec_queue.c            |  37 ++++++
>   drivers/gpu/drm/xe/xe_exec_queue.h            |   1 +
>   drivers/gpu/drm/xe/xe_hw_engine.c             |  29 +++++
>   drivers/gpu/drm/xe/xe_hw_engine.h             |   4 +
>   drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c |  18 ---
>   drivers/gpu/drm/xe/xe_lrc.c                   |  11 ++
>   drivers/gpu/drm/xe/xe_lrc.h                   |   2 +
>   drivers/gpu/drm/xe/xe_lrc_types.h             |   3 +
>   drivers/gpu/drm/xe/xe_sched_job.c             |   2 +
>   pyfdinfo                                      | 113 ++++++++++++++++++
>   13 files changed, 292 insertions(+), 19 deletions(-)
>   create mode 100755 pyfdinfo
> 

  parent reply	other threads:[~2024-04-16  8:37 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  3:04 [PATCH 0/7] drm/xe: Per client usage Lucas De Marchi
2024-04-16  3:04 ` [PATCH 1/7] drm/xe/lrc: Add helper to capture context timestamp Lucas De Marchi
2024-04-16  3:04 ` [PATCH 2/7] drm/xe: Add helper to capture context runtime Lucas De Marchi
2024-04-16  5:26   ` Vivekanandan, Balasubramani
2024-04-16 13:42     ` Lucas De Marchi
2024-04-16 15:45       ` Vivekanandan, Balasubramani
2024-04-16 15:53         ` Lucas De Marchi
2024-04-16  3:04 ` [PATCH 3/7] drm/xe: Promote xe_hw_engine_class_to_str() Lucas De Marchi
2024-04-16  9:36   ` Nirmoy Das
2024-04-19 18:36     ` Zeng, Oak
2024-04-16  3:04 ` [PATCH 4/7] drm/xe: Add XE_ENGINE_CLASS_OTHER to str conversion Lucas De Marchi
2024-04-16  9:37   ` Nirmoy Das
2024-04-16  3:04 ` [PATCH 5/7] drm/xe: Add helper to capture engine timestamp Lucas De Marchi
2024-04-16 22:56   ` Umesh Nerlige Ramappa
2024-04-17  3:14     ` Lucas De Marchi
2024-04-18 18:24       ` Umesh Nerlige Ramappa
2024-04-16  3:04 ` [PATCH 6/7] drm/xe/client: Print runtime to fdinfo Lucas De Marchi
2024-04-16 23:20   ` Umesh Nerlige Ramappa
2024-04-17  3:11     ` Lucas De Marchi
2024-04-18 23:12       ` Umesh Nerlige Ramappa
2024-04-19 13:25         ` Lucas De Marchi
2024-04-16  3:04 ` [PATCH 7/7] HACK: simple gputop-like impl in python Lucas De Marchi
2024-04-16  3:17 ` ✓ CI.Patch_applied: success for drm/xe: Per client usage Patchwork
2024-04-16  3:17 ` ✗ CI.checkpatch: warning " Patchwork
2024-04-16  3:18 ` ✓ CI.KUnit: success " Patchwork
2024-04-16  3:30 ` ✓ CI.Build: " Patchwork
2024-04-16  3:32 ` ✓ CI.Hooks: " Patchwork
2024-04-16  3:34 ` ✓ CI.checksparse: " Patchwork
2024-04-16  3:59 ` ✗ CI.BAT: failure " Patchwork
2024-04-16  8:37 ` Tvrtko Ursulin [this message]
2024-04-16 13:30   ` [PATCH 0/7] " Lucas De Marchi
2024-04-16 13:51     ` Lucas De Marchi
2024-04-16 14:22       ` Tvrtko Ursulin
2024-04-16 18:29         ` Lucas De Marchi
2024-04-17  8:51           ` Tvrtko Ursulin
2024-04-17 19:05             ` Lucas De Marchi
2024-04-17 20:35               ` Umesh Nerlige Ramappa
2024-04-17 23:19                 ` Lucas De Marchi
2024-04-18  8:09                   ` Tvrtko Ursulin
2024-04-19 10:44                   ` Tvrtko Ursulin
2024-04-19 23:51                     ` Umesh Nerlige Ramappa
2024-04-22 10:40                       ` Tvrtko Ursulin
2024-04-22 17:17                         ` Umesh Nerlige Ramappa
2024-04-23  8:44                           ` Tvrtko Ursulin
2024-04-24  0:40                             ` Lucas De Marchi
2024-04-16 22:12 ` ✗ CI.FULL: failure for " 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=f2c46934-e137-419d-ba34-cff864a988ce@ursulin.net \
    --to=tursulin@ursulin.net \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --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