summaryrefslogtreecommitdiff
path: root/drivers/staging/android/sync.c
diff options
context:
space:
mode:
authorErik Gilling <konkers@android.com>2013-02-28 16:43:15 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-04 17:44:08 +0800
commitf56388f3bd15a853d5718bf31c5d4dbc8f499cbe (patch)
treee6adcf5c49a48b82c169297ccbd97527501d5339 /drivers/staging/android/sync.c
parent3b640f5dd050f972439e5c67ba618a5377b61d34 (diff)
staging: sync: Dump sync state to console on timeout
If we hit a timeout, dump sync state to console Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com> Cc: Erik Gilling <konkers@android.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Rob Clark <robclark@gmail.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: dri-devel@lists.freedesktop.org Cc: Android Kernel Team <kernel-team@android.com> Signed-off-by: Erik Gilling <konkers@android.com> [jstultz: Add commit message, whitespace fixups] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android/sync.c')
-rw-r--r--drivers/staging/android/sync.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 7fccfcdd9772..d54fa8dd5341 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -31,6 +31,7 @@
static void sync_fence_signal_pt(struct sync_pt *pt);
static int _sync_pt_has_signaled(struct sync_pt *pt);
static void sync_fence_free(struct kref *kref);
+static void sync_dump(void);
static LIST_HEAD(sync_timeline_list_head);
static DEFINE_SPINLOCK(sync_timeline_list_lock);
@@ -574,8 +575,10 @@ int sync_fence_wait(struct sync_fence *fence, long timeout)
if (fence->status < 0)
return fence->status;
- if (fence->status == 0)
+ if (fence->status == 0) {
+ sync_dump();
return -ETIME;
+ }
return 0;
}
@@ -914,7 +917,34 @@ static __init int sync_debugfs_init(void)
debugfs_create_file("sync", S_IRUGO, NULL, NULL, &sync_debugfs_fops);
return 0;
}
-
late_initcall(sync_debugfs_init);
+#define DUMP_CHUNK 256
+static char sync_dump_buf[64 * 1024];
+void sync_dump(void)
+{
+ 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];
+ 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);
+ }
+ }
+}
+#else
+static void sync_dump(void)
+{
+}
#endif