Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v3 3/5] drm/xe: Include additional info on failed force-wake operation
Date: Tue, 11 Jun 2024 13:04:47 -0400	[thread overview]
Message-ID: <ZmiDr5oOi-l_9V6R@intel.com> (raw)
In-Reply-To: <20240611163537.1944-4-michal.wajdeczko@intel.com>

On Tue, Jun 11, 2024 at 06:35:35PM +0200, Michal Wajdeczko wrote:
> For debug purposes it might be useful to look at the values of the
> force-wake ack registers in case wake/sleep operations failures.
> 
> Move xe_gt_notice() from the caller to the helper function, where
> we have the latest value of force-wake ack register available.
> 

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> v2: remove ret2 (Rodrigo)
> ---
>  drivers/gpu/drm/xe/xe_force_wake.c | 48 +++++++++++++++++-------------
>  1 file changed, 28 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_force_wake.c b/drivers/gpu/drm/xe/xe_force_wake.c
> index 8799a2544648..afbca81c12dd 100644
> --- a/drivers/gpu/drm/xe/xe_force_wake.c
> +++ b/drivers/gpu/drm/xe/xe_force_wake.c
> @@ -97,9 +97,17 @@ static void domain_wake(struct xe_gt *gt, struct xe_force_wake_domain *domain)
>  static int domain_wake_wait(struct xe_gt *gt,
>  			    struct xe_force_wake_domain *domain)
>  {
> -	return xe_mmio_wait32(gt, domain->reg_ack, domain->val, domain->val,
> -			      XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC,
> -			      NULL, true);
> +	u32 value;
> +	int ret;
> +
> +	ret = xe_mmio_wait32(gt, domain->reg_ack, domain->val, domain->val,
> +			     XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC,
> +			     &value, true);
> +	if (ret)
> +		xe_gt_notice(gt, "Force wake domain %d failed to ack wake (%pe) reg[%#x] = %#x\n",
> +			     domain->id, ERR_PTR(ret), domain->reg_ack.addr, value);
> +
> +	return ret;
>  }
>  
>  static void domain_sleep(struct xe_gt *gt, struct xe_force_wake_domain *domain)
> @@ -110,9 +118,17 @@ static void domain_sleep(struct xe_gt *gt, struct xe_force_wake_domain *domain)
>  static int domain_sleep_wait(struct xe_gt *gt,
>  			     struct xe_force_wake_domain *domain)
>  {
> -	return xe_mmio_wait32(gt, domain->reg_ack, domain->val, 0,
> -			      XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC,
> -			      NULL, true);
> +	u32 value;
> +	int ret;
> +
> +	ret = xe_mmio_wait32(gt, domain->reg_ack, domain->val, 0,
> +			     XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC,
> +			     &value, true);
> +	if (ret)
> +		xe_gt_notice(gt, "Force wake domain %d failed to ack sleep (%pe) reg[%#x] = %#x\n",
> +			     domain->id, ERR_PTR(ret), domain->reg_ack.addr, value);
> +
> +	return ret;
>  }
>  
>  #define for_each_fw_domain_masked(domain__, mask__, fw__, tmp__) \
> @@ -128,7 +144,7 @@ int xe_force_wake_get(struct xe_force_wake *fw,
>  	struct xe_force_wake_domain *domain;
>  	enum xe_force_wake_domains tmp, woken = 0;
>  	unsigned long flags;
> -	int ret, ret2 = 0;
> +	int ret = 0;
>  
>  	spin_lock_irqsave(&fw->lock, flags);
>  	for_each_fw_domain_masked(domain, domains, fw, tmp) {
> @@ -138,16 +154,12 @@ int xe_force_wake_get(struct xe_force_wake *fw,
>  		}
>  	}
>  	for_each_fw_domain_masked(domain, woken, fw, tmp) {
> -		ret = domain_wake_wait(gt, domain);
> -		ret2 |= ret;
> -		if (ret)
> -			xe_gt_notice(gt, "Force wake domain (%d) failed to ack wake, ret=%d\n",
> -				     domain->id, ret);
> +		ret |= domain_wake_wait(gt, domain);
>  	}
>  	fw->awake_domains |= woken;
>  	spin_unlock_irqrestore(&fw->lock, flags);
>  
> -	return ret2;
> +	return ret;
>  }
>  
>  int xe_force_wake_put(struct xe_force_wake *fw,
> @@ -157,7 +169,7 @@ int xe_force_wake_put(struct xe_force_wake *fw,
>  	struct xe_force_wake_domain *domain;
>  	enum xe_force_wake_domains tmp, sleep = 0;
>  	unsigned long flags;
> -	int ret, ret2 = 0;
> +	int ret = 0;
>  
>  	spin_lock_irqsave(&fw->lock, flags);
>  	for_each_fw_domain_masked(domain, domains, fw, tmp) {
> @@ -167,14 +179,10 @@ int xe_force_wake_put(struct xe_force_wake *fw,
>  		}
>  	}
>  	for_each_fw_domain_masked(domain, sleep, fw, tmp) {
> -		ret = domain_sleep_wait(gt, domain);
> -		ret2 |= ret;
> -		if (ret)
> -			xe_gt_notice(gt, "Force wake domain (%d) failed to ack sleep, ret=%d\n",
> -				     domain->id, ret);
> +		ret |= domain_sleep_wait(gt, domain);
>  	}
>  	fw->awake_domains &= ~sleep;
>  	spin_unlock_irqrestore(&fw->lock, flags);
>  
> -	return ret2;
> +	return ret;
>  }
> -- 
> 2.43.0
> 

  reply	other threads:[~2024-06-11 17:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 16:35 [PATCH v3 0/5] Prepare Xe force-wake code for VFs Michal Wajdeczko
2024-06-11 16:35 ` [PATCH v3 1/5] drm/xe: Prefer GT oriented messages in xe_force_wake.c Michal Wajdeczko
2024-06-12 10:11   ` Nirmoy Das
2024-06-11 16:35 ` [PATCH v3 2/5] drm/xe: Kill fw_to_gt() helper Michal Wajdeczko
2024-06-11 16:41   ` Francois Dugast
2024-06-12 10:12   ` Nirmoy Das
2024-06-11 16:35 ` [PATCH v3 3/5] drm/xe: Include additional info on failed force-wake operation Michal Wajdeczko
2024-06-11 17:04   ` Rodrigo Vivi [this message]
2024-06-12 10:13   ` Nirmoy Das
2024-06-11 16:35 ` [PATCH v3 4/5] drm/xe: Combine common force-wake code into helpers Michal Wajdeczko
2024-06-12 10:14   ` Nirmoy Das
2024-06-11 16:35 ` [PATCH v3 5/5] drm/xe/vf: Ignore force-wake requests if VF Michal Wajdeczko
2024-06-12 10:15   ` Nirmoy Das
2024-06-11 17:36 ` ✓ CI.Patch_applied: success for Prepare Xe force-wake code for VFs (rev4) Patchwork
2024-06-11 17:36 ` ✓ CI.checkpatch: " Patchwork
2024-06-11 17:37 ` ✓ CI.KUnit: " Patchwork
2024-06-11 17:49 ` ✓ CI.Build: " Patchwork
2024-06-11 17:51 ` ✗ CI.Hooks: failure " Patchwork
2024-06-11 17:53 ` ✓ CI.checksparse: success " Patchwork
2024-06-11 18:34 ` ✓ CI.BAT: " Patchwork
2024-06-11 22:27 ` ✗ CI.FULL: failure " Patchwork
2024-06-12  9:54   ` Michal Wajdeczko

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=ZmiDr5oOi-l_9V6R@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@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