diff mbox

[RFC,2/2] drm/i915: truncate zero dumps in error state

Message ID d528fa93a30cf4a1c951030d530ddda9b37d4075.1366359294.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula April 19, 2013, 8:16 a.m. UTC
It seems the error state often contains plenty of zero data [citation
needed]. It's also fairly big. Truncate more than (arbitrarily chosen)
three consecutive zero values:

00000000 :  0b640001
00000004 :  000047f8
00000008 :  00002044
0000000c :  00000000
00000010 :  00000000
00000014 :  00000000 ...
00000024 :  01000000
00000028 :  13000001

It could be prettier and more informative, but care must be taken not to
confuse intel_error_decode. I didn't put much effort into either before
getting an ack on the idea.

This was inspired by "You have exceeded the maximum file size of 500
kilobytes per paste." from pastebin.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Chris Wilson April 19, 2013, 8:57 a.m. UTC | #1
On Fri, Apr 19, 2013 at 11:16:11AM +0300, Jani Nikula wrote:
> It seems the error state often contains plenty of zero data [citation
> needed]. It's also fairly big. Truncate more than (arbitrarily chosen)
> three consecutive zero values:
> 
> 00000000 :  0b640001
> 00000004 :  000047f8
> 00000008 :  00002044
> 0000000c :  00000000
> 00000010 :  00000000
> 00000014 :  00000000 ...
> 00000024 :  01000000
> 00000028 :  13000001
> 
> It could be prettier and more informative, but care must be taken not to
> confuse intel_error_decode. I didn't put much effort into either before
> getting an ack on the idea.

This would be safer if it were only applied to rings and after
MI_BATCHBUFFER_END in batches. In the larger 3DSTATE commands, we can
indeed end up with large blocks of zeroes and the decoder relies on the
correct count to skip instructions.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 0b3b9ac..2b348d3 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -680,11 +680,21 @@  struct i915_error_state_file_priv {
 
 static void i915_dump_error_object(struct seq_file *m, struct drm_i915_error_object *obj)
 {
-	int page, elt, offset = 0;
+	int page, elt, offset = 0, zerocount = 0;
 
 	for (page = 0; page < obj->page_count; page++) {
 		for (elt = 0; elt < PAGE_SIZE / 4; elt++) {
-			seq_printf(m, "%08x :  %08x\n", offset, obj->pages[page][elt]);
+			u32 val = obj->pages[page][elt];
+			if (val)
+				zerocount = 0;
+			else
+				zerocount++;
+
+			if (zerocount < 3)
+				seq_printf(m, "%08x :  %08x\n", offset, val);
+			else if (zerocount == 3)
+				seq_printf(m, "%08x :  %08x ...\n", offset, val);
+
 			offset += 4;
 		}
 	}