From: John.C.Harrison@Intel.com
To: Intel-GFX@Lists.FreeDesktop.Org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>,
"Riley Andrews" <riandrews@android.com>
Subject: [RFC 4/9] android/sync: Improved debug dump to dmesg
Date: Wed, 13 Jan 2016 17:57:30 +0000 [thread overview]
Message-ID: <1452707855-9791-5-git-send-email-John.C.Harrison@Intel.com> (raw)
In-Reply-To: <1452707855-9791-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.
v0.4: New patch in series.
v0.5: Twiddled white space and line wrapping to keep style checker
happy.
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Riley Andrews <riandrews@android.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
drivers/android/sync.c | 9 ++++++--
drivers/android/sync.h | 5 +++--
drivers/android/sync_debug.c | 51 +++++++++++++++++++++++++++++++++-----------
3 files changed, 48 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 02a1649..4a2f9f5 100644
--- a/drivers/android/sync_debug.c
+++ b/drivers/android/sync_debug.c
@@ -228,28 +228,53 @@ 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
next prev parent reply other threads:[~2016-01-13 17:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 17:57 [RFC 0/9] Add native sync support to i915 driver John.C.Harrison
2016-01-13 17:57 ` [RFC 1/9] staging/android/sync: Support sync points created from dma-fences John.C.Harrison
2016-01-13 17:57 ` [RFC 2/9] staging/android/sync: add sync_fence_create_dma John.C.Harrison
2016-01-13 19:03 ` Gustavo Padovan
2016-01-13 17:57 ` [RFC 3/9] staging/android/sync: Move sync framework out of staging John.C.Harrison
2016-01-13 19:00 ` Gustavo Padovan
2016-01-14 11:31 ` John Harrison
2016-01-14 13:42 ` Gustavo Padovan
2016-01-14 14:19 ` John Harrison
2016-01-13 19:51 ` Gustavo Padovan
2016-01-14 4:55 ` Greg Kroah-Hartman
2016-01-13 17:57 ` John.C.Harrison [this message]
2016-01-13 17:57 ` [RFC 5/9] android/sync: Fix reversed sense of signaled fence John.C.Harrison
2016-01-13 17:57 ` [RFC 6/9] drm/i915: Add sync framework support to execbuff IOCTL John.C.Harrison
2016-01-13 18:43 ` Chris Wilson
2016-01-14 11:47 ` John Harrison
2016-01-14 12:07 ` Chris Wilson
2016-01-21 14:47 ` Maarten Lankhorst
2016-01-21 15:07 ` Chris Wilson
2016-01-13 17:57 ` [RFC 7/9] drm/i915: Add sync wait support to scheduler John.C.Harrison
2016-01-13 17:57 ` [RFC 8/9] drm/i915: Connecting execbuff fences " John.C.Harrison
2016-01-13 17:57 ` [RFC 9/9] drm/i915: Add sync support to the scheduler statistics and status dump John.C.Harrison
2016-01-19 16:04 ` [RFC] igt/gem_exec_fence: New test for sync/fence interface John.C.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=1452707855-9791-5-git-send-email-John.C.Harrison@Intel.com \
--to=john.c.harrison@intel.com \
--cc=Intel-GFX@Lists.FreeDesktop.Org \
--cc=arve@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo.padovan@collabora.co.uk \
--cc=riandrews@android.com \
/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