All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: List objects allocated from stolen memory in debugfs
@ 2013-08-07 17:30 Chris Wilson
  2013-08-07 21:44 ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2013-08-07 17:30 UTC (permalink / raw)
  To: intel-gfx

I was curious as to what objects were currently allocated from stolen
memory, and so exported it from debugfs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 63 +++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 07f5896..4243b63 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -30,6 +30,7 @@
 #include <linux/debugfs.h>
 #include <linux/slab.h>
 #include <linux/export.h>
+#include <linux/list_sort.h>
 #include <drm/drmP.h>
 #include "intel_drv.h"
 #include "intel_ringbuffer.h"
@@ -187,6 +188,67 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
 	return 0;
 }
 
+static int obj_rank_by_stolen(void *priv,
+			      struct list_head *A, struct list_head *B)
+{
+	struct drm_i915_gem_object *a =
+		container_of(A, struct drm_i915_gem_object, exec_list);
+	struct drm_i915_gem_object *b =
+		container_of(B, struct drm_i915_gem_object, exec_list);
+
+	return a->stolen->start - b->stolen->start;
+}
+
+static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_gem_object *obj;
+	size_t total_obj_size, total_gtt_size;
+	LIST_HEAD(stolen);
+	int count, ret;
+
+	ret = mutex_lock_interruptible(&dev->struct_mutex);
+	if (ret)
+		return ret;
+
+	total_obj_size = total_gtt_size = count = 0;
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
+		if (obj->stolen == NULL)
+			continue;
+
+		list_add(&obj->exec_list, &stolen);
+
+		total_obj_size += obj->base.size;
+		total_gtt_size += i915_gem_obj_ggtt_size(obj);
+		count++;
+	}
+	list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) {
+		if (obj->stolen == NULL)
+			continue;
+
+		list_add(&obj->exec_list, &stolen);
+
+		total_obj_size += obj->base.size;
+		count++;
+	}
+	list_sort(NULL, &stolen, obj_rank_by_stolen);
+	seq_puts(m, "Stolen:\n");
+	while (!list_empty(&stolen)) {
+		obj = list_first_entry(&stolen, typeof(*obj), exec_list);
+		seq_puts(m, "   ");
+		describe_obj(m, obj);
+		seq_putc(m, '\n');
+		list_del_init(&obj->exec_list);
+	}
+	mutex_unlock(&dev->struct_mutex);
+
+	seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
+		   count, total_obj_size, total_gtt_size);
+	return 0;
+}
+
 #define count_objects(list, member) do { \
 	list_for_each_entry(obj, list, member) { \
 		size += i915_gem_obj_ggtt_size(obj); \
@@ -2092,6 +2154,7 @@ static struct drm_info_list i915_debugfs_list[] = {
 	{"i915_gem_pinned", i915_gem_gtt_info, 0, (void *) PINNED_LIST},
 	{"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
 	{"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
+	{"i915_gem_stolen", i915_gem_stolen_list_info },
 	{"i915_gem_pageflip", i915_gem_pageflip_info, 0},
 	{"i915_gem_request", i915_gem_request_info, 0},
 	{"i915_gem_seqno", i915_gem_seqno_info, 0},
-- 
1.8.1.2

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

* Re: [PATCH] drm/i915: List objects allocated from stolen memory in debugfs
  2013-08-07 17:30 [PATCH] drm/i915: List objects allocated from stolen memory in debugfs Chris Wilson
@ 2013-08-07 21:44 ` Daniel Vetter
  2013-08-08  9:15   ` Chris Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2013-08-07 21:44 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Aug 07, 2013 at 06:30:54PM +0100, Chris Wilson wrote:
> I was curious as to what objects were currently allocated from stolen
> memory, and so exported it from debugfs.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

I liike this, but since I've just merged Ben's exec_list vma conversion it
doesn't apply any more cleanly. Can you please rebase and resend?
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 63 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 07f5896..4243b63 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -30,6 +30,7 @@
>  #include <linux/debugfs.h>
>  #include <linux/slab.h>
>  #include <linux/export.h>
> +#include <linux/list_sort.h>
>  #include <drm/drmP.h>
>  #include "intel_drv.h"
>  #include "intel_ringbuffer.h"
> @@ -187,6 +188,67 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
>  	return 0;
>  }
>  
> +static int obj_rank_by_stolen(void *priv,
> +			      struct list_head *A, struct list_head *B)
> +{
> +	struct drm_i915_gem_object *a =
> +		container_of(A, struct drm_i915_gem_object, exec_list);
> +	struct drm_i915_gem_object *b =
> +		container_of(B, struct drm_i915_gem_object, exec_list);
> +
> +	return a->stolen->start - b->stolen->start;
> +}
> +
> +static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
> +{
> +	struct drm_info_node *node = (struct drm_info_node *) m->private;
> +	struct drm_device *dev = node->minor->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_i915_gem_object *obj;
> +	size_t total_obj_size, total_gtt_size;
> +	LIST_HEAD(stolen);
> +	int count, ret;
> +
> +	ret = mutex_lock_interruptible(&dev->struct_mutex);
> +	if (ret)
> +		return ret;
> +
> +	total_obj_size = total_gtt_size = count = 0;
> +	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
> +		if (obj->stolen == NULL)
> +			continue;
> +
> +		list_add(&obj->exec_list, &stolen);
> +
> +		total_obj_size += obj->base.size;
> +		total_gtt_size += i915_gem_obj_ggtt_size(obj);
> +		count++;
> +	}
> +	list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) {
> +		if (obj->stolen == NULL)
> +			continue;
> +
> +		list_add(&obj->exec_list, &stolen);
> +
> +		total_obj_size += obj->base.size;
> +		count++;
> +	}
> +	list_sort(NULL, &stolen, obj_rank_by_stolen);
> +	seq_puts(m, "Stolen:\n");
> +	while (!list_empty(&stolen)) {
> +		obj = list_first_entry(&stolen, typeof(*obj), exec_list);
> +		seq_puts(m, "   ");
> +		describe_obj(m, obj);
> +		seq_putc(m, '\n');
> +		list_del_init(&obj->exec_list);
> +	}
> +	mutex_unlock(&dev->struct_mutex);
> +
> +	seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
> +		   count, total_obj_size, total_gtt_size);
> +	return 0;
> +}
> +
>  #define count_objects(list, member) do { \
>  	list_for_each_entry(obj, list, member) { \
>  		size += i915_gem_obj_ggtt_size(obj); \
> @@ -2092,6 +2154,7 @@ static struct drm_info_list i915_debugfs_list[] = {
>  	{"i915_gem_pinned", i915_gem_gtt_info, 0, (void *) PINNED_LIST},
>  	{"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
>  	{"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
> +	{"i915_gem_stolen", i915_gem_stolen_list_info },
>  	{"i915_gem_pageflip", i915_gem_pageflip_info, 0},
>  	{"i915_gem_request", i915_gem_request_info, 0},
>  	{"i915_gem_seqno", i915_gem_seqno_info, 0},
> -- 
> 1.8.1.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

* Re: [PATCH] drm/i915: List objects allocated from stolen memory in debugfs
  2013-08-07 21:44 ` Daniel Vetter
@ 2013-08-08  9:15   ` Chris Wilson
  2013-08-08  9:54     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2013-08-08  9:15 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

On Wed, Aug 07, 2013 at 11:44:20PM +0200, Daniel Vetter wrote:
> On Wed, Aug 07, 2013 at 06:30:54PM +0100, Chris Wilson wrote:
> > I was curious as to what objects were currently allocated from stolen
> > memory, and so exported it from debugfs.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> I liike this, but since I've just merged Ben's exec_list vma conversion it
> doesn't apply any more cleanly. Can you please rebase and resend?

It applies cleanly to current -nightly. Or at least the local
approximation thereof.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [PATCH] drm/i915: List objects allocated from stolen memory in debugfs
  2013-08-08  9:15   ` Chris Wilson
@ 2013-08-08  9:54     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2013-08-08  9:54 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Thu, Aug 08, 2013 at 10:15:31AM +0100, Chris Wilson wrote:
> On Wed, Aug 07, 2013 at 11:44:20PM +0200, Daniel Vetter wrote:
> > On Wed, Aug 07, 2013 at 06:30:54PM +0100, Chris Wilson wrote:
> > > I was curious as to what objects were currently allocated from stolen
> > > memory, and so exported it from debugfs.
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > 
> > I liike this, but since I've just merged Ben's exec_list vma conversion it
> > doesn't apply any more cleanly. Can you please rebase and resend?
> 
> It applies cleanly to current -nightly. Or at least the local
> approximation thereof.

I've gotten ahead of myself here, it applies cleanly. But it'll fail once
patch 25 is in from Ben. Otoh that one has review outstanding, so I think
it's the one to give in. Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2013-08-08  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07 17:30 [PATCH] drm/i915: List objects allocated from stolen memory in debugfs Chris Wilson
2013-08-07 21:44 ` Daniel Vetter
2013-08-08  9:15   ` Chris Wilson
2013-08-08  9:54     ` Daniel Vetter

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.