[Intel-gfx] [PATCH 2/2] drm/i915: Capture module params on hang

Chris Wilson chris at chris-wilson.co.uk
Thu Nov 6 12:13:33 CET 2014


On Thu, Nov 06, 2014 at 01:03:47PM +0200, Mika Kuoppala wrote:
> as it helps with bug triaging.
> 
> Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h       |  1 +
>  drivers/gpu/drm/i915/i915_gpu_error.c | 32 ++++++++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 0f00e58..c0ae57c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -339,6 +339,7 @@ struct drm_i915_error_state {
>  	struct timeval time;
>  
>  	char error_msg[128];
> +	char module_params_msg[1024];
>  	u32 reset_count;
>  	u32 suspend_count;
>  
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 89a2f3d..c5e55b3 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -342,6 +342,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
>  	err_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
>  		   error->time.tv_usec);
>  	err_printf(m, "Kernel: " UTS_RELEASE "\n");
> +	err_printf(m, "Module params: %s\n", error->module_params_msg);
>  	max_hangcheck_score = 0;
>  	for (i = 0; i < ARRAY_SIZE(error->ring); i++) {
>  		if (error->ring[i].hangcheck_score > max_hangcheck_score)
> @@ -1258,6 +1259,34 @@ static void i915_error_capture_msg(struct drm_device *dev,
>  		  wedged ? "reset" : "continue");
>  }
>  
> +static void i915_error_capture_module_params(struct drm_i915_error_state *error)
> +{
> +	const struct module *m = THIS_MODULE;
> +	int i, len;
> +	char *buf;
> +
> +	if (!m)
> +		return;
> +
> +	buf = kmalloc(4096, GFP_ATOMIC);

Better to express this as PAGE_SIZE like kernel/module.c does.

>  static void i915_capture_gen_state(struct drm_i915_private *dev_priv,
>  				   struct drm_i915_error_state *error)
>  {
> @@ -1303,7 +1332,10 @@ void i915_capture_error_state(struct drm_device *dev, bool wedged,
>  	error->display = intel_display_capture_error_state(dev);
>  
>  	i915_error_capture_msg(dev, error, wedged, error_msg);
> +	i915_error_capture_module_params(error);
> +
>  	DRM_INFO("%s\n", error->error_msg);
> +	DRM_INFO("%s\n", error->module_params_msg);

Just add it to the error state, not the dmesg every single time.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list