[Intel-gfx] [PATCH 7/7] drm/i915/debug: Warn when waiting on condition timeouts

Chris Wilson chris at chris-wilson.co.uk
Wed May 18 11:16:00 UTC 2016


On Tue, May 17, 2016 at 06:43:28PM +0300, Mika Kuoppala wrote:
> Warn if we timeout on waiting register or other condition.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h     | 25 ++++++++++++++++++++-----
>  drivers/gpu/drm/i915/intel_drv.h    | 10 +++++++++-
>  drivers/gpu/drm/i915/intel_uncore.c | 10 +++++-----
>  3 files changed, 34 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index ccf6747894b1..3d03a17a8b7c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2873,11 +2873,26 @@ static inline bool intel_vgpu_active(struct drm_i915_private *dev_priv)
>  	return dev_priv->vgpu.active;
>  }
>  
> -int intel_wait_until_register(struct drm_i915_private *dev_priv,
> -			      i915_reg_t reg,
> -			      u32 mask,
> -			      u32 value,
> -			      unsigned long timeout_ms);
> +int __intel_wait_until_register(struct drm_i915_private *dev_priv,
> +				i915_reg_t reg,
> +				u32 mask,
> +				u32 value,
> +				unsigned long timeout_ms);
> +
> +#if defined(CONFIG_DRM_I915_DEBUG)
> +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) ({ \
> +	int __ret; \
> +	WARN_ON(__ret = __intel_wait_until_register((dev_priv), \
> +						    (reg), (mask), \
> +						    (value), \
> +						    (timeout_ms))); \
> +	__ret; \
> +	})
> +#else
> +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) \
> +	__intel_wait_until_register((dev_priv), \
> +				    (reg), (mask), (value), timeout_ms);
> +#endif

Stuff it inside intel_wait_until_register. One more frame in the WARN
isn't going to confuse us? And make it a WARN() with more interesting
fmt string. Seems silly to undo the bloat you were fighting!

Good idea nevertheless.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list