intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: John.C.Harrison@Intel.com
To: Intel-GFX@Lists.FreeDesktop.Org
Subject: [PATCH 04/13] android/sync: Improved debug dump to dmesg
Date: Fri, 11 Dec 2015 13:11:52 +0000	[thread overview]
Message-ID: <1449839521-21958-5-git-send-email-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <1449839521-21958-1-git-send-email-John.C.Harrison@Intel.com>

From: John Harrison <John.C.Harrison@Intel.com>

The sync code has a facility for dumping current state information via
debugfs. It also has a way to re-use the same code for dumping to the
kernel log on an internal error. However, the redirection was rather
clunky and split the output across multiple prints at arbitrary
boundaries. This made it difficult to read and could result in output
from different sources being randomly interspersed.

This patch improves the redirection code to split the output on line
feed boundaries instead. It also adds support for highlighting the
offending fence object that caused the state dump in the first place.

v4: New patch in series.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
---
 drivers/android/sync.c       |  9 ++++++--
 drivers/android/sync.h       |  5 +++--
 drivers/android/sync_debug.c | 50 ++++++++++++++++++++++++++++++++------------
 3 files changed, 47 insertions(+), 17 deletions(-)

diff --git a/drivers/android/sync.c b/drivers/android/sync.c
index 7f0e919..db4a54b 100644
--- a/drivers/android/sync.c
+++ b/drivers/android/sync.c
@@ -86,6 +86,11 @@ static void sync_timeline_put(struct sync_timeline *obj)
 
 void sync_timeline_destroy(struct sync_timeline *obj)
 {
+	if (!list_empty(&obj->active_list_head)) {
+		pr_info("destroying timeline with outstanding fences!\n");
+		sync_dump_timeline(obj);
+	}
+
 	obj->destroyed = true;
 	/*
 	 * Ensure timeline is marked as destroyed before
@@ -397,7 +402,7 @@ int sync_fence_wait(struct sync_fence *fence, long timeout)
 		if (timeout) {
 			pr_info("fence timeout on [%p] after %dms\n", fence,
 				jiffies_to_msecs(timeout));
-			sync_dump();
+			sync_dump(fence);
 		}
 		return -ETIME;
 	}
@@ -405,7 +410,7 @@ int sync_fence_wait(struct sync_fence *fence, long timeout)
 	ret = atomic_read(&fence->status);
 	if (ret) {
 		pr_info("fence error %ld on [%p]\n", ret, fence);
-		sync_dump();
+		sync_dump(fence);
 	}
 	return ret;
 }
diff --git a/drivers/android/sync.h b/drivers/android/sync.h
index 4ccff01..d57fa0a 100644
--- a/drivers/android/sync.h
+++ b/drivers/android/sync.h
@@ -351,14 +351,15 @@ void sync_timeline_debug_add(struct sync_timeline *obj);
 void sync_timeline_debug_remove(struct sync_timeline *obj);
 void sync_fence_debug_add(struct sync_fence *fence);
 void sync_fence_debug_remove(struct sync_fence *fence);
-void sync_dump(void);
+void sync_dump(struct sync_fence *fence);
+void sync_dump_timeline(struct sync_timeline *timeline);
 
 #else
 # define sync_timeline_debug_add(obj)
 # define sync_timeline_debug_remove(obj)
 # define sync_fence_debug_add(fence)
 # define sync_fence_debug_remove(fence)
-# define sync_dump()
+# define sync_dump(fence)
 #endif
 int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode,
 				 int wake_flags, void *key);
diff --git a/drivers/android/sync_debug.c b/drivers/android/sync_debug.c
index f45d13c..9b87e0a 100644
--- a/drivers/android/sync_debug.c
+++ b/drivers/android/sync_debug.c
@@ -229,28 +229,52 @@ late_initcall(sync_debugfs_init);
 
 #define DUMP_CHUNK 256
 static char sync_dump_buf[64 * 1024];
-void sync_dump(void)
+
+static void sync_dump_dfs(struct seq_file *s, void *targetPtr)
+{
+	char *start, *end;
+	char targetStr[100];
+
+	if (targetPtr)
+		snprintf(targetStr, sizeof(targetStr) - 1, "%p", targetPtr);
+
+	start = end = s->buf;
+	while( (end = strchr(end, '\n'))) {
+		*end = 0;
+		if (targetPtr && strstr(start, targetStr))
+			pr_info("*** %s ***\n", start);
+		else
+			pr_info("%s\n", start);
+		start = ++end;
+	}
+
+	if ((start - s->buf) < s->count)
+		pr_info("%d vs %d: >?>%s<?<\n", (uint32_t) (start - s->buf), (uint32_t) s->count, start);
+}
+
+void sync_dump(struct sync_fence *targetPtr)
 {
 	struct seq_file s = {
 		.buf = sync_dump_buf,
 		.size = sizeof(sync_dump_buf) - 1,
 	};
-	int i;
 
 	sync_debugfs_show(&s, NULL);
 
-	for (i = 0; i < s.count; i += DUMP_CHUNK) {
-		if ((s.count - i) > DUMP_CHUNK) {
-			char c = s.buf[i + DUMP_CHUNK];
+	sync_dump_dfs(&s, targetPtr);
+}
 
-			s.buf[i + DUMP_CHUNK] = 0;
-			pr_cont("%s", s.buf + i);
-			s.buf[i + DUMP_CHUNK] = c;
-		} else {
-			s.buf[s.count] = 0;
-			pr_cont("%s", s.buf + i);
-		}
-	}
+void sync_dump_timeline(struct sync_timeline *timeline)
+{
+	struct seq_file s = {
+		.buf = sync_dump_buf,
+		.size = sizeof(sync_dump_buf) - 1,
+	};
+
+	pr_info("timeline: %p\n", timeline);
+	sync_print_obj(&s, timeline);
+
+	sync_dump_dfs(&s, NULL);
 }
 
 #endif
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-12-11 13:12 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 13:11 [PATCH 00/13] Convert requests to use struct fence John.C.Harrison
2015-12-11 13:11 ` [PATCH 01/13] staging/android/sync: Support sync points created from dma-fences John.C.Harrison
2015-12-17 17:32   ` [Intel-gfx] " Jesse Barnes
2015-12-11 13:11 ` [PATCH 02/13] staging/android/sync: add sync_fence_create_dma John.C.Harrison
2015-12-17 17:29   ` Jesse Barnes
2015-12-11 13:11 ` [PATCH 03/13] staging/android/sync: Move sync framework out of staging John.C.Harrison
2015-12-17 17:35   ` Jesse Barnes
2015-12-21 10:03     ` Daniel Vetter
2015-12-21 14:20       ` John Harrison
2015-12-21 15:46         ` Daniel Vetter
2015-12-22 12:14           ` John Harrison
2015-12-11 13:11 ` John.C.Harrison [this message]
2015-12-17 17:36   ` [PATCH 04/13] android/sync: Improved debug dump to dmesg Jesse Barnes
2015-12-11 13:11 ` [PATCH 05/13] drm/i915: Convert requests to use struct fence John.C.Harrison
2015-12-17 17:43   ` Jesse Barnes
2016-01-04 17:20     ` Jesse Barnes
2016-01-04 20:57       ` Chris Wilson
2016-01-04 21:16         ` Jesse Barnes
2016-01-08 21:47           ` Chris Wilson
2016-01-08 21:55             ` Jesse Barnes
2015-12-11 13:11 ` [PATCH 06/13] drm/i915: Removed now redudant parameter to i915_gem_request_completed() John.C.Harrison
2015-12-11 13:11 ` [PATCH 07/13] drm/i915: Add per context timelines to fence object John.C.Harrison
2015-12-17 17:49   ` Jesse Barnes
2015-12-21 10:16     ` Chris Wilson
2015-12-11 13:11 ` [PATCH 08/13] drm/i915: Delay the freeing of requests until retire time John.C.Harrison
2015-12-11 13:11 ` [PATCH 09/13] drm/i915: Interrupt driven fences John.C.Harrison
2015-12-11 15:30   ` John Harrison
2015-12-11 16:07     ` Tvrtko Ursulin
2015-12-11 13:11 ` [PATCH 10/13] drm/i915: Updated request structure tracing John.C.Harrison
2015-12-11 13:11 ` [PATCH 11/13] android/sync: Fix reversed sense of signaled fence John.C.Harrison
2015-12-11 15:57   ` Tvrtko Ursulin
2015-12-14 11:22     ` John Harrison
2015-12-14 12:37       ` Tvrtko Ursulin
2015-12-11 13:12 ` [PATCH 12/13] drm/i915: Add sync framework support to execbuff IOCTL John.C.Harrison
2015-12-11 15:29   ` Tvrtko Ursulin
2015-12-14 11:46     ` John Harrison
2015-12-14 12:23       ` Chris Wilson
2015-12-11 13:12 ` [PATCH 13/13] drm/i915: Cache last IRQ seqno to reduce IRQ overhead John.C.Harrison
2015-12-11 14:28   ` Tvrtko Ursulin
2015-12-14 11:58     ` John Harrison
2015-12-14 12:52       ` Tvrtko Ursulin
2015-12-11 14:55   ` Chris Wilson
2015-12-11 15:35     ` John Harrison
2015-12-11 16:07       ` Chris Wilson
2016-01-08 18:47 ` [PATCH 0/7] Convert requests to use struct fence John.C.Harrison
2016-01-08 18:47   ` [PATCH 1/7] drm/i915: " John.C.Harrison
2016-01-08 21:59     ` Chris Wilson
2016-01-11 19:03       ` John Harrison
2016-01-11 22:41         ` Jesse Barnes
2016-01-08 18:47   ` [PATCH 2/7] drm/i915: Removed now redudant parameter to i915_gem_request_completed() John.C.Harrison
2016-01-11 22:43     ` Jesse Barnes
2016-01-08 18:47   ` [PATCH 3/7] drm/i915: Add per context timelines to fence object John.C.Harrison
2016-01-08 22:05     ` Chris Wilson
2016-01-11 19:03       ` John Harrison
2016-01-11 22:47         ` Jesse Barnes
2016-01-11 22:58           ` Chris Wilson
2016-01-12 11:03             ` John Harrison
2016-01-12 11:26               ` Chris Wilson
2016-01-08 18:47   ` [PATCH 4/7] drm/i915: Delay the freeing of requests until retire time John.C.Harrison
2016-01-08 22:08     ` Chris Wilson
2016-01-11 19:06       ` John Harrison
2016-01-25 11:52         ` Maarten Lankhorst
2016-01-25 12:11           ` Chris Wilson
2016-01-08 18:47   ` [PATCH 5/7] drm/i915: Interrupt driven fences John.C.Harrison
2016-01-08 22:14     ` Chris Wilson
2016-01-09  0:30       ` Chris Wilson
2016-01-08 22:46     ` Chris Wilson
2016-01-11 19:10       ` John Harrison
2016-01-11 23:01         ` Jesse Barnes
2016-01-08 18:47   ` [PATCH 6/7] drm/i915: Updated request structure tracing John.C.Harrison
2016-01-08 22:16     ` Chris Wilson
2016-01-08 18:47   ` [PATCH 7/7] drm/i915: Cache last IRQ seqno to reduce IRQ overhead John.C.Harrison
2016-01-08 22:47   ` [PATCH 0/7] Convert requests to use struct fence Chris Wilson
2016-01-11 19:15     ` John Harrison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449839521-21958-5-git-send-email-John.C.Harrison@Intel.com \
    --to=john.c.harrison@intel.com \
    --cc=Intel-GFX@Lists.FreeDesktop.Org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).