drm/i915: Created a sized object error dump
Subsystems (2)
PATCH 1/2 drm/i915: Created a sized object error dump
--- drivers/gpu/drm/i915/i915_irq.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +11 -7
@@ -952,24 +952,25 @@ static void i915_get_extra_instdone(struct drm_device *dev,#ifdef CONFIG_DEBUG_FS static struct drm_i915_error_object * -i915_error_object_create (struct drm_i915_private *dev_priv, -struct drm_i915_gem_object *src) +i915_error_object_create_sized (struct drm_i915_private *dev_priv, +struct drm_i915_gem_object *src, +int num_pages) {struct drm_i915_error_object *dst; -int i, count; +int i;u32 reloc_offset;if (src ==NULL || src->pages ==NULL )return NULL ; - count = src->base.size /PAGE_SIZE ; + num_pages = src->base.size /PAGE_SIZE ; - dst =kmalloc (sizeof (*dst) + count *sizeof (u32 *),GFP_ATOMIC ); + dst =kmalloc (sizeof (*dst) + num_pages *sizeof (u32 *),GFP_ATOMIC );if (dst ==NULL )return NULL ; reloc_offset = src->gtt_offset; -for (i =0 ; i < count; i++) { +for (i =0 ; i < num_pages; i++) {unsigned long flags;void *d;
@@ -1019,7 +1020,7 @@ i915_error_object_create(struct drm_i915_private *dev_priv, reloc_offset +=PAGE_SIZE ; } - dst->page_count = count; + dst->page_count = num_pages; dst->gtt_offset = src->gtt_offset;return dst;
@@ -1030,6 +1031,9 @@ unwind:kfree (dst);return NULL ; } +#define i915_error_object_create (dev_priv, src) \ + i915_error_object_create_sized((dev_priv), (src), \ + (src)->base.size>>PAGE_SHIFT)static void i915_error_object_free (struct drm_i915_error_object *obj)
Signature · 1 line
1.8.1.4
PATCH 2/2 drm/i915: Capture current context on error
On error, this represents the state of the currently running context at the time it was loaded.
Unfortunately, since we're hung and can't switch out the context this may not tell us too much about the most current state of the context, but does give clues about what has happened since loading.
Thanks to recent doc updates, we have a little more confidence regarding what is actually in this memory, and perhaps it will help us gain more insight into certain bugs. AFAICT, the most interesting info is in the first page. To save space, we only capture the first page. In the future, we might want to dump more.
Sample of the relevant part of error state:
--- HW Context = 0x01b20000
00000000 : 00000000 1100105f 00002028 ffff0880 00000010 : 0000209c feff4040 000020c0 efdf0080 00000020 : 00002178 00000001 0000217c 00145855 00000030 : 00002310 00000000 00002314 00000000 00000040 : 00002318 00000000 0000231c 00000000
References: https://bugs.freedesktop.org/show_bug.cgi?id=55845
--- drivers/gpu/drm/i915/i915_debugfs.c | 16 ++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_irq.c | 8 ++++++++ 3 files changed, 25 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +16 -0
@@ -774,6 +774,22 @@ static int i915_error_state(struct seq_file *m, void *unused) } } +if (error->ctx_obj) { +struct drm_i915_error_object *obj = error->ctx_obj; +seq_printf (m,"--- HW Context = 0x%08x\n" , + obj->gtt_offset); + offset =0 ; +for (elt =0 ; elt <PAGE_SIZE /16 ; elt+=4 ) { +seq_printf (m,"%08x : %08x %08x %08x %08x\n" , + offset, + obj->pages[0 ][elt], + obj->pages[0 ][elt+1 ], + obj->pages[0 ][elt+2 ], + obj->pages[0 ][elt+3 ]); + offset +=16 ; + } + } +if (error->overlay)intel_overlay_print_error_state (m, error->overlay);
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -209,6 +209,7 @@ struct drm_i915_error_state {u32 pgtbl_er;u32 ier;u32 ccid; +struct drm_i915_error_object *ctx_obj;u32 derrmr;u32 forcewake;bool waiting[I915_NUM_RINGS ];
drivers/gpu/drm/i915/i915_irq.c +8 -0
@@ -1321,6 +1321,14 @@ static void i915_capture_error_state(struct drm_device *dev) error->pgtbl_er =I915_READ (PGTBL_ER ); error->ccid =I915_READ (CCID ); +if (error->ccid && !dev_priv->hw_contexts_disabled) { +list_for_each_entry (obj, &dev_priv->mm.active_list, mm_list) +if ((error->ccid &PAGE_MASK ) == obj->gtt_offset) + error->ctx_obj = +i915_error_object_create_sized (dev_priv, + obj,1 ); + } +if (HAS_PCH_SPLIT (dev)) error->ier =I915_READ (DEIER ) |I915_READ (GTIER );else if (IS_VALLEYVIEW (dev))
Signature · 1 line
1.8.1.4
Re: [PATCH 2/2] drm/i915: Capture current context on error
Quoted 13 lines · Ben Widawsky
On error, this represents the state of the currently running context at the time it was loaded.
Unfortunately, since we're hung and can't switch out the context this may not tell us too much about the most current state of the context, but does give clues about what has happened since loading.
Thanks to recent doc updates, we have a little more confidence regarding what is actually in this memory, and perhaps it will help us gain more insight into certain bugs. AFAICT, the most interesting info is in the first page. To save space, we only capture the first page. In the future, we might want to dump more.
Quoted 7 lines
Sample of the relevant part of error state:
--- HW Context =0x01b2000000000000 : 00000000 1100105f 00002028 ffff0880 00000010 : 0000209c feff4040 000020c0 efdf0080 00000020 : 00002178 00000001 0000217c 00145855 00000030 : 00002310 00000000 00002314 00000000 00000040 : 00002318 00000000 0000231c 00000000
Presentation looks reasonable, except it will confuse intel_error_decode as it will match "%x : %x". How about "[%03x] %08x %08x %08x %08x"?
Quoted 11 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=55845
Cc Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>---
drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 212
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -209,6 +209,7 @@ struct drm_i915_error_state {u32 pgtbl_er;u32 ier;u32 ccid; +struct drm_i915_error_object *ctx_obj;
Put it next to the other pointers; lest we want to start digging holes.
drivers/gpu/drm/i915/i915_irq.c static void i915_capture_error_state(struct drm_device *dev) · line 1325
Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0u32 derrmr;u32 forcewake;bool waiting[I915_NUM_RINGS ];drivers/gpu/drm/i915/i915_irq.c +2
-0@@ -1321,6 +1321,14 @@ static void i915_capture_error_state(struct drm_device *dev) error->pgtbl_er =I915_READ (PGTBL_ER ); error->ccid =I915_READ (CCID ); +if (error->ccid && !dev_priv->hw_contexts_disabled) { +list_for_each_entry (obj, &dev_priv->mm.active_list, mm_list)
I am doubtful that the active list will hold the object in all cases, as we only put the context obj onto the active list when switching away. I'd check the gtt_list to be on the safe side. And ignore what we think of hw_context_disabled - if the CCID randomly points to one of our objects, lets attach it.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 2/2] drm/i915: Capture current context on error
Quoted 22 lines · Chris Wilson
Quoted 13 lines · Ben Widawsky
On error, this represents the state of the currently running context at the time it was loaded.
Unfortunately, since we're hung and can't switch out the context this may not tell us too much about the most current state of the context, but does give clues about what has happened since loading.
Thanks to recent doc updates, we have a little more confidence regarding what is actually in this memory, and perhaps it will help us gain more insight into certain bugs. AFAICT, the most interesting info is in the first page. To save space, we only capture the first page. In the future, we might want to dump more.
Quoted 7 lines
Sample of the relevant part of error state:
--- HW Context =0x01b2000000000000 : 00000000 1100105f 00002028 ffff0880 00000010 : 0000209c feff4040 000020c0 efdf0080 00000020 : 00002178 00000001 0000217c 00145855 00000030 : 00002310 00000000 00002314 00000000 00000040 : 00002318 00000000 0000231c 00000000
Quoted 3 lines
Presentation looks reasonable, except it will confuse
intel_error_decodeas it will match "%x : %x". How about "[%03x] %08x %08x %08x %08x"?
Will %4x be okay? I suspect 1 page may not be sufficient at some point. Also, it's probably worth modifying intel_error_decode since I suspect over time we'll want to dump more objects.
Quoted 7 lines
Quoted 6 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=55845
Cc Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>---
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 212
Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -209,6 +209,7 @@ struct drm_i915_error_state {u32 pgtbl_er;u32 ier;u32 ccid; +struct drm_i915_error_object *ctx_obj;Put it next to the other pointers; lest we want to start digging holes.
On that request, I am going to make 1 per ring then. We don't have any non-ring error objects currently. I've also always been in favor of having the code more ring independent but that was removed because of Daniel.
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0u32 derrmr;u32 forcewake;bool waiting[I915_NUM_RINGS ];drivers/gpu/drm/i915/i915_irq.c +0
-0@@ -1321,6 +1321,14 @@ static void i915_capture_error_state(struct drm_device *dev) error->pgtbl_er =I915_READ (PGTBL_ER ); error->ccid =I915_READ (CCID );
Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c static void i915_capture_error_state(struct drm_device *dev) · line 1325
Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0+if (error->ccid && !dev_priv->hw_contexts_disabled) { +list_for_each_entry (obj, &dev_priv->mm.active_list, mm_list)I am doubtful that the active list will hold the object in all cases, as we only put the context obj onto the active list when switching away. I'd check the
gtt_listto be on the safe side.
Hmm, that shouldn't have been how the code worked when I wrote it, and I'm too lazy to look if it's changed. The context should be made active on the switch to it. If we use rc6, and don't do that, that's really bad because rc6 will automatically save/restore the context (though as long as it remained pinned we're safe). In any case, gtt_list is fine with me, though I still believe if it's not on the active list, it's an error.
Quoted 2 lines
And ignore what we think of
hw_context_disabled- if the CCID randomly points to one of our objects, lets attach it.
I can switch to HAS_HW_CONTEXTS for this. I'm really hoping we never see CCID != 0 when not using contexts though.
Quoted 4 lines
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Re: [PATCH 2/2] drm/i915: Capture current context on error
Quoted 23 lines · Ben Widawsky
Quoted 22 lines · Chris Wilson
Quoted 20 lines · Ben Widawsky
On error, this represents the state of the currently running context at the time it was loaded.
Unfortunately, since we're hung and can't switch out the context this may not tell us too much about the most current state of the context, but does give clues about what has happened since loading.
Thanks to recent doc updates, we have a little more confidence regarding what is actually in this memory, and perhaps it will help us gain more insight into certain bugs. AFAICT, the most interesting info is in the first page. To save space, we only capture the first page. In the future, we might want to dump more.
Sample of the relevant part of error state:
--- HW Context =0x01b2000000000000 : 00000000 1100105f 00002028 ffff0880 00000010 : 0000209c feff4040 000020c0 efdf0080 00000020 : 00002178 00000001 0000217c 00145855 00000030 : 00002310 00000000 00002314 00000000 00000040 : 00002318 00000000 0000231c 00000000
Quoted 7 lines
Quoted 3 lines
Presentation looks reasonable, except it will confuse
intel_error_decodeas it will match "%x : %x". How about "[%03x] %08x %08x %08x %08x"?Will %4x be okay? I suspect 1 page may not be sufficient at some point. Also, it's probably worth modifying
intel_error_decodesince I suspect over time we'll want to dump more objects.
%04x is fine. I was simply trimming a few zeroes for brevity. Using [] was the key to making it distinct enough for intel_error_decode was still being comprehensible for us.
Quoted 17 lines
Quoted 5 lines
Quoted 4 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=55845
Cc Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>---
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_error_state { · line 212
Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -209,6 +209,7 @@ struct drm_i915_error_state {u32 pgtbl_er;u32 ier;u32 ccid; +struct drm_i915_error_object *ctx_obj;Put it next to the other pointers; lest we want to start digging holes.
Quoted 4 lines
On that request, I am going to make 1 per ring then. We don't have any non-ring error objects currently. I've also always been in favor of having the code more ring independent but that was removed because of Daniel.
Yes. I also think of contexts as being a far more generic constructs than just the current automagic hw save/restore.
Quoted 18 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0u32 derrmr;u32 forcewake;bool waiting[I915_NUM_RINGS ];drivers/gpu/drm/i915/i915_irq.c +0
-0@@ -1321,6 +1321,14 @@ static void i915_capture_error_state(struct drm_device *dev) error->pgtbl_er =I915_READ (PGTBL_ER ); error->ccid =I915_READ (CCID );Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c static void i915_capture_error_state(struct drm_device *dev) · line 1325
Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0+if (error->ccid && !dev_priv->hw_contexts_disabled) { +list_for_each_entry (obj, &dev_priv->mm.active_list, mm_list)I am doubtful that the active list will hold the object in all cases, as we only put the context obj onto the active list when switching away. I'd check the
gtt_listto be on the safe side.
Quoted 7 lines
Hmm, that shouldn't have been how the code worked when I wrote it, and I'm too lazy to look if it's changed. The context should be made active on the switch to it. If we use rc6, and don't do that, that's really bad because rc6 will automatically save/restore the context (though as long as it remained pinned we're safe). In any case,
gtt_listis fine with me, though I still believe if it's not on the active list, it's an error.
Hmm, the code we ended up with only did move_to_active() when switching away in order for it to remain pinned until after the MI_SET_CONTEXT had been processed. Before then it is kept alive through explicit pinning and referencing from the ring.
Quoted 5 lines
Quoted 2 lines
And ignore what we think of
hw_context_disabled- if the CCID randomly points to one of our objects, lets attach it.I can switch to
HAS_HW_CONTEXTSfor this. I'm really hoping we never see CCID != 0 when not using contexts though.
Complete agree. I also dread the day we see random CCID values. But stanger things have happened.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 19 lines · Ben Widawsky
Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/i915_irq.c +3
-2@@ -952,24 +952,25 @@ static void i915_get_extra_instdone(struct drm_device *dev,#ifdef CONFIG_DEBUG_FS static struct drm_i915_error_object * -i915_error_object_create (struct drm_i915_private *dev_priv, -struct drm_i915_gem_object *src) +i915_error_object_create_sized (struct drm_i915_private *dev_priv, +struct drm_i915_gem_object *src, +int num_pages) {
drivers/gpu/drm/i915/i915_irq.c static void i915_get_extra_instdone(struct drm_device *dev, · line 966
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +2
-2struct drm_i915_error_object *dst; -int i, count; +int i;u32 reloc_offset;if (src ==NULL || src->pages ==NULL )return NULL ; - count = src->base.size /PAGE_SIZE ; + num_pages = src->base.size /PAGE_SIZE ;
Probably didn't mean to overwrite your new parameter with the old value. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 25 lines · Chris Wilson
Quoted 24 lines · Ben Widawsky
Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/i915_irq.c +4
-3@@ -952,24 +952,25 @@ static void i915_get_extra_instdone(struct drm_device *dev,#ifdef CONFIG_DEBUG_FS static struct drm_i915_error_object * -i915_error_object_create (struct drm_i915_private *dev_priv, -struct drm_i915_gem_object *src) +i915_error_object_create_sized (struct drm_i915_private *dev_priv, +struct drm_i915_gem_object *src, +int num_pages) {struct drm_i915_error_object *dst; -int i, count; +int i;u32 reloc_offset;
Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c static void i915_get_extra_instdone(struct drm_device *dev, · line 966
Quoted 5 lines
drivers/gpu/drm/i915/i915_irq.c +1
-1if (src ==NULL || src->pages ==NULL )return NULL ; - count = src->base.size /PAGE_SIZE ; + num_pages = src->base.size /PAGE_SIZE ;Probably didn't mean to overwrite your new parameter with the old value.
Sorry, thanks. This was not in the version of the patch I tested.
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center