Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Riana Tauro <riana.tauro@intel.com>, intel-xe@lists.freedesktop.org
Cc: anshuman.gupta@intel.com, umesh.nerlige.ramappa@intel.com,
	lucas.demarchi@intel.com, vinay.belgaumkar@intel.com,
	soham.purkait@intel.com,
	John Harrison <John.C.Harrison@Intel.com>
Subject: Re: [PATCH v5 3/8] drm/xe/guc: Expose engine activity only for supported GuC version
Date: Thu, 6 Feb 2025 19:39:10 +0100	[thread overview]
Message-ID: <810aa04d-0781-43be-8914-8f6c60f42f5e@intel.com> (raw)
In-Reply-To: <20250206104358.3436519-4-riana.tauro@intel.com>



On 06.02.2025 11:43, Riana Tauro wrote:
> Engine activity is supported only on GuC submission version >= 1.14.1
> Allow enabling/reading engine activity only on supported
> GuC versions. Warn once if not supported.
> 
> v2: use guc interface version (John)
> v3: do not use drm_WARN (Umesh)
> v4: use variable for supported and use gt logs
>     use a friendlier log message (Michal)
> 
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_engine_activity.c   | 42 +++++++++++++++++++
>  drivers/gpu/drm/xe/xe_guc_engine_activity.h   |  1 +
>  .../gpu/drm/xe/xe_guc_engine_activity_types.h |  3 ++
>  3 files changed, 46 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_engine_activity.c b/drivers/gpu/drm/xe/xe_guc_engine_activity.c
> index 9c08af273397..5d67fe38639a 100644
> --- a/drivers/gpu/drm/xe/xe_guc_engine_activity.c
> +++ b/drivers/gpu/drm/xe/xe_guc_engine_activity.c
> @@ -89,6 +89,22 @@ static int allocate_engine_activity_buffers(struct xe_guc *guc,
>  	return 0;
>  }
>  
> +static bool engine_activity_supported(struct xe_guc *guc)

maybe rename it a little to distinguish from other function that just
look at engine_activity->supported flag?

> +{
> +	struct xe_uc_fw_version *version = &guc->fw.versions.found[XE_UC_FW_VER_COMPATIBILITY];
> +	struct xe_gt *gt = guc_to_gt(guc);
> +
> +	/* engine activity stats is supported from GuC interface version (1.14.1) */
> +	if (GUC_SUBMIT_VER(guc) >= MAKE_GUC_VER(1, 14, 1))
> +		return true;

it also doesn't work on VFs
so maybe it should be different logic:

	if (IS_SRIOV_VF) {
		xt_gt_into("EA not supported on VFs\n");
		return false;
	}

	if (GUC_SUBMIT_VER < 1.14.1) {
		xt_gt_into("EA not supported on vA, need vB+\n");
		return false;
	}

> +
> +	xe_gt_warn(gt,

does it really need to be 'warn' level?

> +		   "engine activity stats unsupported in GuC interface v%u.%u.%u, v%u.%u.%u or newer required\n",
> +		   version->major, version->minor, version->patch, 1, 14, 1);
> +
> +	return false;
> +}
> +
>  static struct engine_activity *hw_engine_to_engine_activity(struct xe_hw_engine *hwe)
>  {
>  	struct xe_guc *guc = &hwe->gt->uc.guc;
> @@ -250,6 +266,9 @@ u64 xe_guc_engine_activity_active_ticks(struct xe_hw_engine *hwe)
>  {
>  	struct xe_guc *guc =  &hwe->gt->uc.guc;
>  
> +	if (!xe_guc_engine_activity_supported(guc))
> +		return 0;
> +
>  	return get_engine_active_ticks(guc, hwe);
>  }
>  
> @@ -263,9 +282,27 @@ u64 xe_guc_engine_activity_total_ticks(struct xe_hw_engine *hwe)
>  {
>  	struct xe_guc *guc =  &hwe->gt->uc.guc;
>  
> +	if (!xe_guc_engine_activity_supported(guc))
> +		return 0;
> +
>  	return get_engine_total_ticks(guc, hwe);
>  }
>  
> +/**
> + * xe_guc_engine_activity_supported - Check support for engine activity stats
> + * @guc: The GuC object
> + *
> + * Engine activity stats is supported from GuC interface version (1.14.1)

what about VFs?

> + *
> + * Return: true if engine activity stats supported, false otherwise
> + */
> +bool xe_guc_engine_activity_supported(struct xe_guc *guc)
> +{
> +	struct xe_guc_engine_activity *engine_activity = &guc->engine_activity;
> +
> +	return engine_activity->supported;
> +}
> +
>  /**
>   * xe_guc_engine_activity_enable_stats - Enable engine activity stats
>   * @guc: The GuC object
> @@ -276,6 +313,9 @@ void xe_guc_engine_activity_enable_stats(struct xe_guc *guc)
>  {
>  	int ret;
>  
> +	if (!xe_guc_engine_activity_supported(guc))
> +		return;
> +
>  	ret = enable_engine_activity_stats(guc);
>  	if (ret)
>  		xe_gt_err(guc_to_gt(guc), "failed to enable activity stats%d\n", ret);
> @@ -302,6 +342,8 @@ int xe_guc_engine_activity_init(struct xe_guc *guc)
>  	struct xe_gt *gt = guc_to_gt(guc);
>  	int ret;
>  
> +	engine_activity->supported = engine_activity_supported(guc);

should we continue if not supported ?

> +
>  	ret = allocate_engine_activity_group(guc);
>  	if (ret) {
>  		xe_gt_err(gt, "failed to allocate activity group %d\n", ret);
> diff --git a/drivers/gpu/drm/xe/xe_guc_engine_activity.h b/drivers/gpu/drm/xe/xe_guc_engine_activity.h
> index c00f3da5513d..9d3ea3f67b6a 100644
> --- a/drivers/gpu/drm/xe/xe_guc_engine_activity.h
> +++ b/drivers/gpu/drm/xe/xe_guc_engine_activity.h
> @@ -12,6 +12,7 @@ struct xe_hw_engine;
>  struct xe_guc;
>  
>  int xe_guc_engine_activity_init(struct xe_guc *guc);
> +bool xe_guc_engine_activity_supported(struct xe_guc *guc);
>  void xe_guc_engine_activity_enable_stats(struct xe_guc *guc);
>  u64 xe_guc_engine_activity_active_ticks(struct xe_hw_engine *hwe);
>  u64 xe_guc_engine_activity_total_ticks(struct xe_hw_engine *hwe);
> diff --git a/drivers/gpu/drm/xe/xe_guc_engine_activity_types.h b/drivers/gpu/drm/xe/xe_guc_engine_activity_types.h
> index a2ab327d3eec..81002c83d65e 100644
> --- a/drivers/gpu/drm/xe/xe_guc_engine_activity_types.h
> +++ b/drivers/gpu/drm/xe/xe_guc_engine_activity_types.h
> @@ -79,6 +79,9 @@ struct xe_guc_engine_activity {
>  	/** @num_activity_group: number of activity groups */
>  	u32 num_activity_group;
>  
> +	/** @supported: checks if engine activity is supported */

indicates?

> +	bool supported;
> +
>  	/** @eag: holds the device level engine activity data */
>  	struct engine_activity_group *eag;
>  


  reply	other threads:[~2025-02-06 18:39 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 10:43 [PATCH v5 0/8] PMU support for engine activity Riana Tauro
2025-02-06 10:40 ` ✓ CI.Patch_applied: success for " Patchwork
2025-02-06 10:41 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-06 10:42 ` ✓ CI.KUnit: success " Patchwork
2025-02-06 10:43 ` [PATCH v5 1/8] drm/xe: Add engine activity support Riana Tauro
2025-02-06 18:28   ` Michal Wajdeczko
2025-02-10  7:07     ` Riana Tauro
2025-02-06 10:43 ` [PATCH v5 2/8] drm/xe/trace: Add trace for engine activity Riana Tauro
2025-02-06 10:43 ` [PATCH v5 3/8] drm/xe/guc: Expose engine activity only for supported GuC version Riana Tauro
2025-02-06 18:39   ` Michal Wajdeczko [this message]
2025-02-07  7:59     ` Riana Tauro
2025-02-07 21:37   ` Umesh Nerlige Ramappa
2025-02-10  7:28     ` Riana Tauro
2025-02-06 10:43 ` [PATCH v5 4/8] drm/xe/xe_pmu: Add PMU support for engine activity Riana Tauro
2025-02-07 22:47   ` Umesh Nerlige Ramappa
2025-02-06 10:43 ` [PATCH v5 5/8] drm/xe/xe_pmu: Acquire forcewake on event init for engine events Riana Tauro
2025-02-07  3:09   ` Ghimiray, Himal Prasad
2025-02-07  6:18     ` Riana Tauro
2025-02-07  6:51       ` Ghimiray, Himal Prasad
2025-02-07 23:31         ` Umesh Nerlige Ramappa
2025-02-10 10:20           ` Riana Tauro
2025-02-11 17:33             ` Umesh Nerlige Ramappa
2025-02-12  5:01               ` Riana Tauro
2025-02-06 10:43 ` [PATCH v5 6/8] drm/xe: Add support for per-function engine activity Riana Tauro
2025-02-06 19:06   ` Michal Wajdeczko
2025-02-07  8:11     ` Riana Tauro
2025-02-07 23:50       ` Umesh Nerlige Ramappa
2025-02-06 10:43 ` [PATCH v5 7/8] drm/xe/xe_pmu: Add pmu support for per-function engine activity stats Riana Tauro
2025-02-06 19:15   ` Michal Wajdeczko
2025-02-07  7:52     ` Riana Tauro
2025-02-06 10:43 ` [PATCH v5 8/8] drm/xe/pf: Enable " Riana Tauro
2025-02-06 11:20   ` Riana Tauro
2025-02-06 19:29   ` Michal Wajdeczko
2025-02-07  6:25     ` Riana Tauro
2025-02-06 10:58 ` ✓ CI.Build: success for PMU support for engine activity Patchwork
2025-02-06 11:01 ` ✗ CI.Hooks: failure " Patchwork
2025-02-06 11:02 ` ✓ CI.checksparse: success " Patchwork
2025-02-06 11:28 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-02-06 12:36 ` ✗ Xe.CI.Full: " 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=810aa04d-0781-43be-8914-8f6c60f42f5e@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=John.C.Harrison@Intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=soham.purkait@intel.com \
    --cc=umesh.nerlige.ramappa@intel.com \
    --cc=vinay.belgaumkar@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