diff mbox

drm/i915: fix crash in error state readout on non-execlist platforms v2

Message ID 1442336581-12442-1-git-send-email-jbarnes@virtuousgeek.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jesse Barnes Sept. 15, 2015, 5:03 p.m. UTC
Looks like this was introduced in:
commit d1675198ed1f21aec6e036336e4340c40b726497
Author: Alex Dai <yu.dai@intel.com>
Date:   Wed Aug 12 15:43:43 2015 +0100

    drm/i915: Integrate GuC-based command submission

This patch assumed LRC contexts and HWS layout, which is incorrect on
platforms without execlists.  This can lead to a crash in GPU error
state readout on those platforms.

I don't see a bug filed for this, but there may be one that I haven't
found.

v2: fixup offset handling for error capture fix (Dave)

Cc: Alex Dai <yu.dai@intel.com>
Reviewed-by: Dave Gordon <david.s.gordon@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Comments

Daniel Vetter Sept. 23, 2015, 8:34 a.m. UTC | #1
On Tue, Sep 15, 2015 at 10:03:01AM -0700, Jesse Barnes wrote:
> Looks like this was introduced in:
> commit d1675198ed1f21aec6e036336e4340c40b726497
> Author: Alex Dai <yu.dai@intel.com>
> Date:   Wed Aug 12 15:43:43 2015 +0100
> 
>     drm/i915: Integrate GuC-based command submission
> 
> This patch assumed LRC contexts and HWS layout, which is incorrect on
> platforms without execlists.  This can lead to a crash in GPU error
> state readout on those platforms.
> 
> I don't see a bug filed for this, but there may be one that I haven't
> found.
> 
> v2: fixup offset handling for error capture fix (Dave)
> 
> Cc: Alex Dai <yu.dai@intel.com>
> Reviewed-by: Dave Gordon <david.s.gordon@intel.com>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gpu_error.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 3379f9c..f95de05 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -457,17 +457,23 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
>  		}
>  
>  		if ((obj = error->ring[i].hws_page)) {
> +			u64 hws_offset = obj->gtt_offset;
> +			u32 *hws_page = &obj->pages[0][0];
> +
> +			if (i915.enable_execlists) {
> +				hws_offset += LRC_PPHWSP_PN * PAGE_SIZE;
> +				hws_page = &obj->pages[LRC_PPHWSP_PN][0];
> +			}
>  			err_printf(m, "%s --- HW Status = 0x%08llx\n",
> -				dev_priv->ring[i].name,
> -				obj->gtt_offset + LRC_PPHWSP_PN * PAGE_SIZE);
> +				   dev_priv->ring[i].name, hws_offset);
>  			offset = 0;
>  			for (elt = 0; elt < PAGE_SIZE/16; elt += 4) {
>  				err_printf(m, "[%04x] %08x %08x %08x %08x\n",
>  					   offset,
> -					   obj->pages[LRC_PPHWSP_PN][elt],
> -					   obj->pages[LRC_PPHWSP_PN][elt+1],
> -					   obj->pages[LRC_PPHWSP_PN][elt+2],
> -					   obj->pages[LRC_PPHWSP_PN][elt+3]);
> +					   hws_page[elt],
> +					   hws_page[elt+1],
> +					   hws_page[elt+2],
> +					   hws_page[elt+3]);
>  					offset += 16;
>  			}
>  		}
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 3379f9c..f95de05 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -457,17 +457,23 @@  int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 		}
 
 		if ((obj = error->ring[i].hws_page)) {
+			u64 hws_offset = obj->gtt_offset;
+			u32 *hws_page = &obj->pages[0][0];
+
+			if (i915.enable_execlists) {
+				hws_offset += LRC_PPHWSP_PN * PAGE_SIZE;
+				hws_page = &obj->pages[LRC_PPHWSP_PN][0];
+			}
 			err_printf(m, "%s --- HW Status = 0x%08llx\n",
-				dev_priv->ring[i].name,
-				obj->gtt_offset + LRC_PPHWSP_PN * PAGE_SIZE);
+				   dev_priv->ring[i].name, hws_offset);
 			offset = 0;
 			for (elt = 0; elt < PAGE_SIZE/16; elt += 4) {
 				err_printf(m, "[%04x] %08x %08x %08x %08x\n",
 					   offset,
-					   obj->pages[LRC_PPHWSP_PN][elt],
-					   obj->pages[LRC_PPHWSP_PN][elt+1],
-					   obj->pages[LRC_PPHWSP_PN][elt+2],
-					   obj->pages[LRC_PPHWSP_PN][elt+3]);
+					   hws_page[elt],
+					   hws_page[elt+1],
+					   hws_page[elt+2],
+					   hws_page[elt+3]);
 					offset += 16;
 			}
 		}