All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
To: Riana Tauro <riana.tauro@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 5/8] drm/xe/guc: Add PMU counter for total active ticks
Date: Wed, 3 Jan 2024 12:24:04 +0530	[thread overview]
Message-ID: <77d10f4c-afeb-415b-9976-588b93dc0298@linux.intel.com> (raw)
In-Reply-To: <20231222074602.817518-6-riana.tauro@intel.com>


On 12/22/23 13:15, Riana Tauro wrote:
> GuC provides engine busyness ticks as a 64 bit counter which count
> as clock ticks. These counters are maintained in a
> shared memory buffer and internally updated on a continuous basis.
>
> GuC also provides a periodically total active ticks that GT has been
> active for (GuC loaded and running).
> This counter is exposed to the user such that busyness can
> be calculated as a percentage using
>
> busyness % = (engine active ticks/total active ticks) * 100.
>
> This patch provides a pmu counter for total active ticks.
>
> This is listed by perf tool as
>
> sudo ./perf list
> 	  xe_0000_03_00.0/total-active-ticks-gt0/            [Kernel PMU event]
>
> and can be read using
>
> sudo ./perf stat -e xe_0000_03_00.0/total-active-ticks-gt0/ -I 1000
>         time 	    counts  unit 	events
>     1.001332764    58942964    xe_0000_03_00.0/total-active-ticks-gt0/
>     2.011421147	   21191869    xe_0000_03_00.0/total-active-ticks-gt0/
>     3.013223865	   19269012    xe_0000_03_00.0/total-active-ticks-gt0/
>
> v2: change commit message and comment for
>     total active ticks (Umesh, Tvrtko)
>
> Co-developed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt.c                  | 11 +++
>  drivers/gpu/drm/xe/xe_gt.h                  |  2 +-
>  drivers/gpu/drm/xe/xe_guc_engine_busyness.c | 72 ++++++++++++++++----
>  drivers/gpu/drm/xe/xe_guc_engine_busyness.h |  1 +
>  drivers/gpu/drm/xe/xe_pmu.c                 | 74 +++++++++++++++++++--
>  include/uapi/drm/xe_drm.h                   | 23 ++++++-
>  6 files changed, 162 insertions(+), 21 deletions(-)
>
<snip>
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index f8456cda5cda..3134930b0160 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -1341,12 +1341,29 @@ struct drm_xe_wait_user_fence {
>  };
>  
>  /**
> - * DOC: XE PMU event config IDs
> + * DOC: XE PMU Event Config ID's
>   *
> - * Check 'man perf_event_open' to use the ID's DRM_XE_PMU_XXXX listed in xe_drm.h
the reason for mentioning xe_drm.h is the defines will not be included in the documentation
> + * Check 'man perf_event_open' to use the ID's DRM_XE_PMU_XXXX listed here
>   * in 'struct perf_event_attr' as part of perf_event_open syscall to read a
>   * particular event.
>   *
> + * For example to open the DRM_XE_PMU_TOTAL_ACTIVE_TICKS(0):
> + *
> + * .. code-block:: C
> + *
> + *     struct perf_event_attr attr;
> + *     long long count;
> + *     int cpu = 0;
> + *     int fd;
> + *
> + *     memset(&attr, 0, sizeof(struct perf_event_attr));
> + *     attr.type = type; // eg: /sys/bus/event_source/devices/xe_0000_03_00.0/type
> + *     attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED;
> + *     attr.use_clockid = 1;
> + *     attr.clockid = CLOCK_MONOTONIC;
> + *     attr.config = DRM_XE_PMU_TOTAL_ACTIVE_TICKS(0);
> + *
> + *     fd = syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0);
>   */
>  
>  /**
> @@ -1381,6 +1398,8 @@ enum drm_xe_pmu_engine_sample {
>  	__DRM_XE_PMU_GT_EVENT(gt, __DRM_XE_PMU_ENGINE(class, instance, \
>  						      DRM_XE_PMU_SAMPLE_BUSY_TICKS))
>  
> +#define DRM_XE_PMU_TOTAL_ACTIVE_TICKS(gt)	__DRM_XE_PMU_OTHER(gt, 0)
> +
>  #if defined(__cplusplus)
>  }
>  #endif


Thanks,
Aravind.

  parent reply	other threads:[~2024-01-03  6:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  7:45 [PATCH v4 0/8] Engine busyness Riana Tauro
2023-12-22  7:45 ` [PATCH v4 1/8] drm/xe: Move user engine class mappings to functions Riana Tauro
2024-01-04  5:04   ` Aravind Iddamsetty
2024-01-05  5:31     ` Riana Tauro
2023-12-22  7:45 ` [PATCH v4 2/8] drm/xe/guc: Add interface for engine busyness ticks Riana Tauro
2023-12-22  7:45 ` [PATCH v4 3/8] drm/xe/uapi: Add configs for Engine busyness Riana Tauro
2024-01-03  5:26   ` Aravind Iddamsetty
2024-01-03  6:40     ` Riana Tauro
2024-01-03  7:02       ` Aravind Iddamsetty
2024-01-03  7:06         ` Riana Tauro
2024-01-03  7:08           ` Riana Tauro
2023-12-22  7:45 ` [PATCH v4 4/8] drm/xe/pmu: Enable PMU interface and add engine busyness counter Riana Tauro
2024-01-03  5:03   ` Aravind Iddamsetty
     [not found]     ` <85zfxnrlv0.wl-ashutosh.dixit@intel.com>
2024-01-03  6:16       ` Dixit, Ashutosh
2023-12-22  7:45 ` [PATCH v4 5/8] drm/xe/guc: Add PMU counter for total active ticks Riana Tauro
2023-12-22 20:03   ` Belgaumkar, Vinay
2024-01-03  6:54   ` Aravind Iddamsetty [this message]
2023-12-22  7:46 ` [PATCH v4 6/8] drm/xe/guc: Expose engine busyness only for supported GuC version Riana Tauro
2024-01-18  6:13   ` Nilawar, Badal
2024-01-19 10:13     ` Riana Tauro
2024-01-19 12:18       ` Nilawar, Badal
2023-12-22  7:46 ` [PATCH v4 7/8] drm/xe/guc: Dynamically enable/disable engine busyness stats Riana Tauro
2023-12-22  7:46 ` [PATCH v4 8/8] drm/xe/guc: Handle runtime suspend issues for engine busyness Riana Tauro

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=77d10f4c-afeb-415b-9976-588b93dc0298@linux.intel.com \
    --to=aravind.iddamsetty@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=riana.tauro@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.