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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 at intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

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;
 		}
 	}
-- 
1.7.10.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux