aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2017-03-31 06:00:42 -0400
committerGustavo Padovan <gustavo.padovan@collabora.com>2017-03-31 11:52:22 -0400
commit5eb2c72c8acc3f84c85f9d504b87f25f78ef0eb0 (patch)
tree4a3b3cdf9fb08d0b62376e6ffebe65acd209706a
parentb121b051d14cc6e4e799e96e9c06c55989f9e073 (diff)
dma-buf: fence debugging
Add debugfs output to report shared and exclusive fences on a dma_buf object. This produces output such as: Dma-buf Objects: size flags mode count exp_name 08294400 00000000 00000005 00000005 drm Exclusive fence: etnaviv 134000.gpu signalled Attached Devices: gpu-subsystem Total 1 devices attached Total 1 objects, 8294400 bytes Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Link: http://patchwork.freedesktop.org/patch/msgid/E1cttMI-00068z-3X@rmk-PC.armlinux.org.uk
-rw-r--r--drivers/dma-buf/dma-buf.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 0007b792827b..ebaf1923ad6b 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -1059,7 +1059,11 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
1059 int ret; 1059 int ret;
1060 struct dma_buf *buf_obj; 1060 struct dma_buf *buf_obj;
1061 struct dma_buf_attachment *attach_obj; 1061 struct dma_buf_attachment *attach_obj;
1062 int count = 0, attach_count; 1062 struct reservation_object *robj;
1063 struct reservation_object_list *fobj;
1064 struct dma_fence *fence;
1065 unsigned seq;
1066 int count = 0, attach_count, shared_count, i;
1063 size_t size = 0; 1067 size_t size = 0;
1064 1068
1065 ret = mutex_lock_interruptible(&db_list.lock); 1069 ret = mutex_lock_interruptible(&db_list.lock);
@@ -1085,6 +1089,34 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
1085 file_count(buf_obj->file), 1089 file_count(buf_obj->file),
1086 buf_obj->exp_name); 1090 buf_obj->exp_name);
1087 1091
1092 robj = buf_obj->resv;
1093 while (true) {
1094 seq = read_seqcount_begin(&robj->seq);
1095 rcu_read_lock();
1096 fobj = rcu_dereference(robj->fence);
1097 shared_count = fobj ? fobj->shared_count : 0;
1098 fence = rcu_dereference(robj->fence_excl);
1099 if (!read_seqcount_retry(&robj->seq, seq))
1100 break;
1101 rcu_read_unlock();
1102 }
1103
1104 if (fence)
1105 seq_printf(s, "\tExclusive fence: %s %s %ssignalled\n",
1106 fence->ops->get_driver_name(fence),
1107 fence->ops->get_timeline_name(fence),
1108 dma_fence_is_signaled(fence) ? "" : "un");
1109 for (i = 0; i < shared_count; i++) {
1110 fence = rcu_dereference(fobj->shared[i]);
1111 if (!dma_fence_get_rcu(fence))
1112 continue;
1113 seq_printf(s, "\tShared fence: %s %s %ssignalled\n",
1114 fence->ops->get_driver_name(fence),
1115 fence->ops->get_timeline_name(fence),
1116 dma_fence_is_signaled(fence) ? "" : "un");
1117 }
1118 rcu_read_unlock();
1119
1088 seq_puts(s, "\tAttached Devices:\n"); 1120 seq_puts(s, "\tAttached Devices:\n");
1089 attach_count = 0; 1121 attach_count = 0;
1090 1122