All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	"Nieto, David M" <David.Nieto@amd.com>, Roy Sun <Roy.Sun@amd.com>
Cc: "Intel Graphics Development" <Intel-gfx@lists.freedesktop.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Maling list - DRI developers" <dri-devel@lists.freedesktop.org>,
	"Tvrtko Ursulin" <tvrtko.ursulin@intel.com>
Subject: Re: [RFC 8/8] drm/amdgpu: Convert to common fdinfo format
Date: Fri, 23 Jul 2021 09:56:44 -0400	[thread overview]
Message-ID: <CADnq5_NHDEJohUdgjJqDXD4UX1zzU00WQGV4jSMJNDNDrxFAFQ@mail.gmail.com> (raw)
In-Reply-To: <20210715091820.1613726-9-tvrtko.ursulin@linux.intel.com>

+ David, Roy

On Thu, Jul 15, 2021 at 5:18 AM Tvrtko Ursulin
<tvrtko.ursulin@linux.intel.com> wrote:
>
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Convert fdinfo format to one documented in drm-usage-stats.rst.
>
> Opens:
>  * Does it work for AMD?
>  * What are the semantics of AMD engine utilisation reported in percents?
>    Can it align with what i915 does or needs to document the alternative
>    in the specification document?
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: David M Nieto <David.Nieto@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  Documentation/gpu/amdgpu.rst               | 26 ++++++++++++++++++++++
>  Documentation/gpu/drm-usage-stats.rst      |  7 +++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 18 ++++++++++-----
>  3 files changed, 45 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/gpu/amdgpu.rst b/Documentation/gpu/amdgpu.rst
> index 364680cdad2e..b9b79c810f28 100644
> --- a/Documentation/gpu/amdgpu.rst
> +++ b/Documentation/gpu/amdgpu.rst
> @@ -322,3 +322,29 @@ smartshift_bias
>
>  .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
>     :doc: smartshift_bias
> +
> +.. _amdgpu-usage-stats:
> +
> +amdgpu DRM client usage stats implementation
> +============================================
> +
> +The amdgpu driver implements the DRM client usage stats specification as
> +documented in :ref:`drm-client-usage-stats`.
> +
> +Example of the output showing the implemented key value pairs and entirety of
> +the currenly possible format options:
> +
> +::
> +
> +      pos:    0
> +      flags:  0100002
> +      mnt_id: 21
> +      drm-driver: amdgpu
> +      drm-pdev:   0000:00:02.0
> +      drm-client-id:      7
> +      drm-engine-... TODO
> +      drm-memory-... TODO
> +
> +Possible `drm-engine-` key names are: ``,... TODO.
> +
> +Possible `drm-memory-` key names are: ``,... TODO.
> diff --git a/Documentation/gpu/drm-usage-stats.rst b/Documentation/gpu/drm-usage-stats.rst
> index b87505438aaa..eaaa361805c0 100644
> --- a/Documentation/gpu/drm-usage-stats.rst
> +++ b/Documentation/gpu/drm-usage-stats.rst
> @@ -69,7 +69,7 @@ scope of each device, in which case `drm-pdev` shall be present as well.
>  Userspace should make sure to not double account any usage statistics by using
>  the above described criteria in order to associate data to individual clients.
>
> -- drm-engine-<str>: <uint> ns
> +- drm-engine-<str>: <uint> [ns|%]
>
>  GPUs usually contain multiple execution engines. Each shall be given a stable
>  and unique name (str), with possible values documented in the driver specific
> @@ -84,6 +84,9 @@ 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.
>
> +Where time unit is given as a percentage...[AMD folks to fill the semantics
> +and interpretation of that]...
> +
>  - drm-memory-<str>: <uint> [KiB|MiB]
>
>  Each possible memory type which can be used to store buffer objects by the
> @@ -101,3 +104,5 @@ Driver specific implementations
>  ===============================
>
>  :ref:`i915-usage-stats`
> +
> +:ref:`amdgpu-usage-stats`
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> index d94c5419ec25..d6b011008fe9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> @@ -76,11 +76,19 @@ void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
>         }
>         amdgpu_vm_get_memory(&fpriv->vm, &vram_mem, &gtt_mem, &cpu_mem);
>         amdgpu_bo_unreserve(fpriv->vm.root.bo);
> -       seq_printf(m, "pdev:\t%04x:%02x:%02x.%d\npasid:\t%u\n", domain, bus,
> +
> +       /*
> +        * ******************************************************************
> +        * For text output format description please see drm-usage-stats.rst!
> +        * ******************************************************************
> +        */
> +
> +       seq_puts(m, "drm-driver: amdgpu\n");
> +       seq_printf(m, "drm-pdev:\t%04x:%02x:%02x.%d\npasid:\t%u\n", domain, bus,
>                         dev, fn, fpriv->vm.pasid);
> -       seq_printf(m, "vram mem:\t%llu kB\n", vram_mem/1024UL);
> -       seq_printf(m, "gtt mem:\t%llu kB\n", gtt_mem/1024UL);
> -       seq_printf(m, "cpu mem:\t%llu kB\n", cpu_mem/1024UL);
> +       seq_printf(m, "drm-memory-vram:\t%llu KiB\n", vram_mem/1024UL);
> +       seq_printf(m, "drm-memory-gtt:\t%llu KiB\n", gtt_mem/1024UL);
> +       seq_printf(m, "drm-memory-cpu:\t%llu KiB\n", cpu_mem/1024UL);
>         for (i = 0; i < AMDGPU_HW_IP_NUM; i++) {
>                 uint32_t count = amdgpu_ctx_num_entities[i];
>                 int idx = 0;
> @@ -96,7 +104,7 @@ void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
>                         perc = div64_u64(10000 * total, min);
>                         frac = perc % 100;
>
> -                       seq_printf(m, "%s%d:\t%d.%d%%\n",
> +                       seq_printf(m, "drm-engine-%s%d:\t%d.%d %%\n",
>                                         amdgpu_ip_name[i],
>                                         idx, perc/100, frac);
>                 }
> --
> 2.30.2
>

WARNING: multiple messages have this Message-ID (diff)
From: Alex Deucher <alexdeucher@gmail.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	"Nieto, David M" <David.Nieto@amd.com>, Roy Sun <Roy.Sun@amd.com>
Cc: "Intel Graphics Development" <Intel-gfx@lists.freedesktop.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Maling list - DRI developers" <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [RFC 8/8] drm/amdgpu: Convert to common fdinfo format
Date: Fri, 23 Jul 2021 09:56:44 -0400	[thread overview]
Message-ID: <CADnq5_NHDEJohUdgjJqDXD4UX1zzU00WQGV4jSMJNDNDrxFAFQ@mail.gmail.com> (raw)
In-Reply-To: <20210715091820.1613726-9-tvrtko.ursulin@linux.intel.com>

+ David, Roy

On Thu, Jul 15, 2021 at 5:18 AM Tvrtko Ursulin
<tvrtko.ursulin@linux.intel.com> wrote:
>
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Convert fdinfo format to one documented in drm-usage-stats.rst.
>
> Opens:
>  * Does it work for AMD?
>  * What are the semantics of AMD engine utilisation reported in percents?
>    Can it align with what i915 does or needs to document the alternative
>    in the specification document?
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: David M Nieto <David.Nieto@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  Documentation/gpu/amdgpu.rst               | 26 ++++++++++++++++++++++
>  Documentation/gpu/drm-usage-stats.rst      |  7 +++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 18 ++++++++++-----
>  3 files changed, 45 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/gpu/amdgpu.rst b/Documentation/gpu/amdgpu.rst
> index 364680cdad2e..b9b79c810f28 100644
> --- a/Documentation/gpu/amdgpu.rst
> +++ b/Documentation/gpu/amdgpu.rst
> @@ -322,3 +322,29 @@ smartshift_bias
>
>  .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
>     :doc: smartshift_bias
> +
> +.. _amdgpu-usage-stats:
> +
> +amdgpu DRM client usage stats implementation
> +============================================
> +
> +The amdgpu driver implements the DRM client usage stats specification as
> +documented in :ref:`drm-client-usage-stats`.
> +
> +Example of the output showing the implemented key value pairs and entirety of
> +the currenly possible format options:
> +
> +::
> +
> +      pos:    0
> +      flags:  0100002
> +      mnt_id: 21
> +      drm-driver: amdgpu
> +      drm-pdev:   0000:00:02.0
> +      drm-client-id:      7
> +      drm-engine-... TODO
> +      drm-memory-... TODO
> +
> +Possible `drm-engine-` key names are: ``,... TODO.
> +
> +Possible `drm-memory-` key names are: ``,... TODO.
> diff --git a/Documentation/gpu/drm-usage-stats.rst b/Documentation/gpu/drm-usage-stats.rst
> index b87505438aaa..eaaa361805c0 100644
> --- a/Documentation/gpu/drm-usage-stats.rst
> +++ b/Documentation/gpu/drm-usage-stats.rst
> @@ -69,7 +69,7 @@ scope of each device, in which case `drm-pdev` shall be present as well.
>  Userspace should make sure to not double account any usage statistics by using
>  the above described criteria in order to associate data to individual clients.
>
> -- drm-engine-<str>: <uint> ns
> +- drm-engine-<str>: <uint> [ns|%]
>
>  GPUs usually contain multiple execution engines. Each shall be given a stable
>  and unique name (str), with possible values documented in the driver specific
> @@ -84,6 +84,9 @@ 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.
>
> +Where time unit is given as a percentage...[AMD folks to fill the semantics
> +and interpretation of that]...
> +
>  - drm-memory-<str>: <uint> [KiB|MiB]
>
>  Each possible memory type which can be used to store buffer objects by the
> @@ -101,3 +104,5 @@ Driver specific implementations
>  ===============================
>
>  :ref:`i915-usage-stats`
> +
> +:ref:`amdgpu-usage-stats`
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> index d94c5419ec25..d6b011008fe9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> @@ -76,11 +76,19 @@ void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
>         }
>         amdgpu_vm_get_memory(&fpriv->vm, &vram_mem, &gtt_mem, &cpu_mem);
>         amdgpu_bo_unreserve(fpriv->vm.root.bo);
> -       seq_printf(m, "pdev:\t%04x:%02x:%02x.%d\npasid:\t%u\n", domain, bus,
> +
> +       /*
> +        * ******************************************************************
> +        * For text output format description please see drm-usage-stats.rst!
> +        * ******************************************************************
> +        */
> +
> +       seq_puts(m, "drm-driver: amdgpu\n");
> +       seq_printf(m, "drm-pdev:\t%04x:%02x:%02x.%d\npasid:\t%u\n", domain, bus,
>                         dev, fn, fpriv->vm.pasid);
> -       seq_printf(m, "vram mem:\t%llu kB\n", vram_mem/1024UL);
> -       seq_printf(m, "gtt mem:\t%llu kB\n", gtt_mem/1024UL);
> -       seq_printf(m, "cpu mem:\t%llu kB\n", cpu_mem/1024UL);
> +       seq_printf(m, "drm-memory-vram:\t%llu KiB\n", vram_mem/1024UL);
> +       seq_printf(m, "drm-memory-gtt:\t%llu KiB\n", gtt_mem/1024UL);
> +       seq_printf(m, "drm-memory-cpu:\t%llu KiB\n", cpu_mem/1024UL);
>         for (i = 0; i < AMDGPU_HW_IP_NUM; i++) {
>                 uint32_t count = amdgpu_ctx_num_entities[i];
>                 int idx = 0;
> @@ -96,7 +104,7 @@ void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
>                         perc = div64_u64(10000 * total, min);
>                         frac = perc % 100;
>
> -                       seq_printf(m, "%s%d:\t%d.%d%%\n",
> +                       seq_printf(m, "drm-engine-%s%d:\t%d.%d %%\n",
>                                         amdgpu_ip_name[i],
>                                         idx, perc/100, frac);
>                 }
> --
> 2.30.2
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-07-23 13:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15  9:18 [RFC 0/8] Per client GPU stats Tvrtko Ursulin
2021-07-15  9:18 ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 1/8] drm/i915: Explicitly track DRM clients Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 2/8] drm/i915: Make GEM contexts " Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 3/8] drm/i915: Track runtime spent in closed and unreachable GEM contexts Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 4/8] drm/i915: Track all user contexts per client Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 5/8] drm/i915: Track context current active time Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 6/8] drm: Document fdinfo format specification Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-23 16:43   ` Daniel Stone
2021-07-23 16:43     ` [Intel-gfx] " Daniel Stone
2021-07-23 16:47     ` Daniel Vetter
2021-07-23 16:47       ` [Intel-gfx] " Daniel Vetter
2021-07-23 17:45       ` Nieto, David M
2021-07-23 17:45         ` [Intel-gfx] " Nieto, David M
2021-07-26  9:01         ` Tvrtko Ursulin
2021-07-26  9:01           ` [Intel-gfx] " Tvrtko Ursulin
2021-07-26  8:57     ` Tvrtko Ursulin
2021-07-26  8:57       ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 7/8] drm/i915: Expose client engine utilisation via fdinfo Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-15  9:18 ` [RFC 8/8] drm/amdgpu: Convert to common fdinfo format Tvrtko Ursulin
2021-07-15  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-07-23 13:56   ` Alex Deucher [this message]
2021-07-23 13:56     ` Alex Deucher
2021-07-16 17:58 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Per client GPU stats (rev2) Patchwork
2021-07-16 17:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-07-16 18:03 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2021-07-16 18:24 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-16 23:58 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-07-23 11:21 ` [Intel-gfx] [RFC 0/8] Per client GPU stats Tvrtko Ursulin
2021-07-23 11:21   ` Tvrtko Ursulin
2021-07-23 11:23   ` Christian König
2021-07-23 11:23     ` Christian König
2021-07-23 13:50     ` Tvrtko Ursulin
2021-07-23 13:50       ` Tvrtko Ursulin
2021-07-23 13:55       ` Alex Deucher
2021-07-23 13:55         ` Alex Deucher
2021-08-23 11:28 Tvrtko Ursulin
2021-08-23 11:28 ` [RFC 8/8] drm/amdgpu: Convert to common fdinfo format Tvrtko Ursulin

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=CADnq5_NHDEJohUdgjJqDXD4UX1zzU00WQGV4jSMJNDNDrxFAFQ@mail.gmail.com \
    --to=alexdeucher@gmail.com \
    --cc=David.Nieto@amd.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=Roy.Sun@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tvrtko.ursulin@intel.com \
    --cc=tvrtko.ursulin@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.