[Intel-gfx] [PATCH v2] drm/i915: Tidy load failure reporting

Chris Wilson chris at chris-wilson.co.uk
Tue Dec 6 22:12:20 UTC 2016


On Tue, Dec 06, 2016 at 07:00:26PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Several changes here:
> 
>  * Remove unused i915_report_error.

The plan was to start using it for the more prominent errors. (Any and
every DRM_ERROR should be considered to be a userfacing error message
and incorporate a request to file a bug. Almost all need massaging to be
useful though.)

>  * Unexport __i915_printk and rename it to i915_load_error,
>    converting the latter from a macro to a static function.
>  * Use drm_dev_printk instead of open-coding the same.
> 
> v2: Fix reversed error condition.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 45 +++++++++++++++++++----------------------
>  drivers/gpu/drm/i915/i915_drv.h |  7 -------
>  2 files changed, 21 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index ae583c79c19f..7217ecdb790d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -68,52 +68,49 @@ bool __i915_inject_load_failure(const char *func, int line)
>  	return false;
>  }
>  
> +static bool i915_error_injected(struct drm_i915_private *dev_priv)
> +{
> +	return i915.inject_load_failure &&
> +	       i915_load_fail_count == i915.inject_load_failure;
> +}
> +
>  #define FDO_BUG_URL "https://bugs.freedesktop.org/enter_bug.cgi?product=DRI"
>  #define FDO_BUG_MSG "Please file a bug at " FDO_BUG_URL " against DRM/Intel " \
>  		    "providing the dmesg log by booting with drm.debug=0xf"
>  
> -void
> -__i915_printk(struct drm_i915_private *dev_priv, const char *level,
> -	      const char *fmt, ...)
> +static void __printf(2, 3)
> +i915_load_error(struct drm_i915_private *dev_priv, const char *fmt, ...)
>  {
> -	static bool shown_bug_once;
> +	static bool shown_bug_once __read_mostly;
>  	struct device *kdev = dev_priv->drm.dev;
> -	bool is_error = level[1] <= KERN_ERR[1];
> -	bool is_debug = level[1] == KERN_DEBUG[1];
> +	char *level;
> +	bool is_error;
>  	struct va_format vaf;
>  	va_list args;
>  
> -	if (is_debug && !(drm_debug & DRM_UT_DRIVER))
> -		return;
> +	if (i915_error_injected(dev_priv)) {
> +		is_error = false;
> +		level = KERN_DEBUG;
> +	} else {
> +		is_error = true;
> +		level = KERN_ERR;
> +	};

Stray ';'

The drm_dev_printk replacement looks reasonable.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list