All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-buf: fence debugging
@ 2017-03-31 10:00 Russell King
  2017-03-31 12:06   ` Christian König
  2017-03-31 16:12 ` Gustavo Padovan
  0 siblings, 2 replies; 4+ messages in thread
From: Russell King @ 2017-03-31 10:00 UTC (permalink / raw)
  To: Sumit Semwal; +Cc: linux-media, dri-devel, linaro-mm-sig

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>
---
 drivers/dma-buf/dma-buf.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 0007b792827b..f72aaacbe023 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)
 	int ret;
 	struct dma_buf *buf_obj;
 	struct dma_buf_attachment *attach_obj;
-	int count = 0, attach_count;
+	struct reservation_object *robj;
+	struct reservation_object_list *fobj;
+	struct dma_fence *fence;
+	unsigned seq;
+	int count = 0, attach_count, shared_count, i;
 	size_t size = 0;
 
 	ret = mutex_lock_interruptible(&db_list.lock);
@@ -1085,6 +1090,34 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
 				file_count(buf_obj->file),
 				buf_obj->exp_name);
 
+		robj = buf_obj->resv;
+		while (true) {
+			seq = read_seqcount_begin(&robj->seq);
+			rcu_read_lock();
+			fobj = rcu_dereference(robj->fence);
+			shared_count = fobj ? fobj->shared_count : 0;
+			fence = rcu_dereference(robj->fence_excl);
+			if (!read_seqcount_retry(&robj->seq, seq))
+				break;
+			rcu_read_unlock();
+		}
+
+		if (fence)
+			seq_printf(s, "\tExclusive fence: %s %s %ssignalled\n",
+				   fence->ops->get_driver_name(fence),
+				   fence->ops->get_timeline_name(fence),
+				   dma_fence_is_signaled(fence) ? "" : "un");
+		for (i = 0; i < shared_count; i++) {
+			fence = rcu_dereference(fobj->shared[i]);
+			if (!dma_fence_get_rcu(fence))
+				continue;
+			seq_printf(s, "\tShared fence: %s %s %ssignalled\n",
+				   fence->ops->get_driver_name(fence),
+				   fence->ops->get_timeline_name(fence),
+				   dma_fence_is_signaled(fence) ? "" : "un");
+		}
+		rcu_read_unlock();
+
 		seq_puts(s, "\tAttached Devices:\n");
 		attach_count = 0;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-buf: fence debugging
  2017-03-31 10:00 [PATCH] dma-buf: fence debugging Russell King
@ 2017-03-31 12:06   ` Christian König
  2017-03-31 16:12 ` Gustavo Padovan
  1 sibling, 0 replies; 4+ messages in thread
From: Christian König @ 2017-03-31 12:06 UTC (permalink / raw)
  To: Russell King, Sumit Semwal; +Cc: linaro-mm-sig, dri-devel, linux-media

Am 31.03.2017 um 12:00 schrieb Russell King:
> 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>

> ---
>   drivers/dma-buf/dma-buf.c | 34 +++++++++++++++++++++++++++++++++-
>   1 file changed, 33 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 0007b792827b..f72aaacbe023 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)
>   	int ret;
>   	struct dma_buf *buf_obj;
>   	struct dma_buf_attachment *attach_obj;
> -	int count = 0, attach_count;
> +	struct reservation_object *robj;
> +	struct reservation_object_list *fobj;
> +	struct dma_fence *fence;
> +	unsigned seq;
> +	int count = 0, attach_count, shared_count, i;
>   	size_t size = 0;
>   
>   	ret = mutex_lock_interruptible(&db_list.lock);
> @@ -1085,6 +1090,34 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
>   				file_count(buf_obj->file),
>   				buf_obj->exp_name);
>   
> +		robj = buf_obj->resv;
> +		while (true) {
> +			seq = read_seqcount_begin(&robj->seq);
> +			rcu_read_lock();
> +			fobj = rcu_dereference(robj->fence);
> +			shared_count = fobj ? fobj->shared_count : 0;
> +			fence = rcu_dereference(robj->fence_excl);
> +			if (!read_seqcount_retry(&robj->seq, seq))
> +				break;
> +			rcu_read_unlock();
> +		}
> +
> +		if (fence)
> +			seq_printf(s, "\tExclusive fence: %s %s %ssignalled\n",
> +				   fence->ops->get_driver_name(fence),
> +				   fence->ops->get_timeline_name(fence),
> +				   dma_fence_is_signaled(fence) ? "" : "un");
> +		for (i = 0; i < shared_count; i++) {
> +			fence = rcu_dereference(fobj->shared[i]);
> +			if (!dma_fence_get_rcu(fence))
> +				continue;
> +			seq_printf(s, "\tShared fence: %s %s %ssignalled\n",
> +				   fence->ops->get_driver_name(fence),
> +				   fence->ops->get_timeline_name(fence),
> +				   dma_fence_is_signaled(fence) ? "" : "un");
> +		}
> +		rcu_read_unlock();
> +
>   		seq_puts(s, "\tAttached Devices:\n");
>   		attach_count = 0;
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-buf: fence debugging
@ 2017-03-31 12:06   ` Christian König
  0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2017-03-31 12:06 UTC (permalink / raw)
  To: Russell King, Sumit Semwal; +Cc: linaro-mm-sig, dri-devel, linux-media

Am 31.03.2017 um 12:00 schrieb Russell King:
> 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>

> ---
>   drivers/dma-buf/dma-buf.c | 34 +++++++++++++++++++++++++++++++++-
>   1 file changed, 33 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 0007b792827b..f72aaacbe023 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)
>   	int ret;
>   	struct dma_buf *buf_obj;
>   	struct dma_buf_attachment *attach_obj;
> -	int count = 0, attach_count;
> +	struct reservation_object *robj;
> +	struct reservation_object_list *fobj;
> +	struct dma_fence *fence;
> +	unsigned seq;
> +	int count = 0, attach_count, shared_count, i;
>   	size_t size = 0;
>   
>   	ret = mutex_lock_interruptible(&db_list.lock);
> @@ -1085,6 +1090,34 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
>   				file_count(buf_obj->file),
>   				buf_obj->exp_name);
>   
> +		robj = buf_obj->resv;
> +		while (true) {
> +			seq = read_seqcount_begin(&robj->seq);
> +			rcu_read_lock();
> +			fobj = rcu_dereference(robj->fence);
> +			shared_count = fobj ? fobj->shared_count : 0;
> +			fence = rcu_dereference(robj->fence_excl);
> +			if (!read_seqcount_retry(&robj->seq, seq))
> +				break;
> +			rcu_read_unlock();
> +		}
> +
> +		if (fence)
> +			seq_printf(s, "\tExclusive fence: %s %s %ssignalled\n",
> +				   fence->ops->get_driver_name(fence),
> +				   fence->ops->get_timeline_name(fence),
> +				   dma_fence_is_signaled(fence) ? "" : "un");
> +		for (i = 0; i < shared_count; i++) {
> +			fence = rcu_dereference(fobj->shared[i]);
> +			if (!dma_fence_get_rcu(fence))
> +				continue;
> +			seq_printf(s, "\tShared fence: %s %s %ssignalled\n",
> +				   fence->ops->get_driver_name(fence),
> +				   fence->ops->get_timeline_name(fence),
> +				   dma_fence_is_signaled(fence) ? "" : "un");
> +		}
> +		rcu_read_unlock();
> +
>   		seq_puts(s, "\tAttached Devices:\n");
>   		attach_count = 0;
>   


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-buf: fence debugging
  2017-03-31 10:00 [PATCH] dma-buf: fence debugging Russell King
  2017-03-31 12:06   ` Christian König
@ 2017-03-31 16:12 ` Gustavo Padovan
  1 sibling, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2017-03-31 16:12 UTC (permalink / raw)
  To: Russell King; +Cc: Sumit Semwal, linux-media, dri-devel, linaro-mm-sig

Hi Russell,

2017-03-31 Russell King <rmk+kernel@arm.linux.org.uk>:

> 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>
> ---
>  drivers/dma-buf/dma-buf.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletions(-)

Applied to to drm-misc-next.

> 
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 0007b792827b..f72aaacbe023 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)
>  	int ret;
>  	struct dma_buf *buf_obj;
>  	struct dma_buf_attachment *attach_obj;
> -	int count = 0, attach_count;
> +	struct reservation_object *robj;
> +	struct reservation_object_list *fobj;
> +	struct dma_fence *fence;
> +	unsigned seq;

Our maintainer tools warned about this line, so I made it "unsigned
int"

Gustavo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-31 16:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31 10:00 [PATCH] dma-buf: fence debugging Russell King
2017-03-31 12:06 ` Christian König
2017-03-31 12:06   ` Christian König
2017-03-31 16:12 ` Gustavo Padovan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.