public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/i915/debugfs: Show context objects in i915_gem_objects
Date: Wed, 25 May 2016 12:55:21 +0300	[thread overview]
Message-ID: <1464170121.4875.12.camel@linux.intel.com> (raw)
In-Reply-To: <1464008469-27512-1-git-send-email-chris@chris-wilson.co.uk>

On ma, 2016-05-23 at 14:01 +0100, Chris Wilson wrote:
> One of the uses for i915_gem_objects is pin-pointing leaks. For this, we
> can compare the number of allocated objects and who owns them, a
> discrepancy here often indicates a kernel bug. One allocator of unreported
> objects is for backing context objects, so include those in the listing.
> 
> v2: Take filelist_mutex which requires a little dance with struct_mutex
> to avoid nesting filelist_mutex inside struct_mutex.
> 

What's new in v3?

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 38 ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 30cb26fe2fa9..1300bad67f5c 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -417,6 +417,42 @@ static void print_batch_pool_stats(struct seq_file *m,
>  	print_file_stats(m, "[k]batch pool", stats);
>  }
>  
> +static int per_file_ctx_stats(int id, void *ptr, void *data)
> +{
> +	struct i915_gem_context *ctx = ptr;
> +	int n;
> +
> +	for (n = 0; n < ARRAY_SIZE(ctx->engine); n++) {
> +		if (ctx->engine[n].state)
> +			per_file_stats(0, ctx->engine[n].state, data);
> +		if (ctx->engine[n].ringbuf)
> +			per_file_stats(0, ctx->engine[n].ringbuf->obj, data);
> +	}
> +
> +	return 0;
> +}
> +
> +static void print_context_stats(struct seq_file *m,
> +				struct drm_i915_private *dev_priv)
> +{
> +	struct file_stats stats;
> +	struct drm_file *file;
> +
> +	memset(&stats, 0, sizeof(stats));
> +
> +	mutex_lock(&dev_priv->dev->struct_mutex);
> +	if (dev_priv->kernel_context)
> +		per_file_ctx_stats(0, dev_priv->kernel_context, &stats);
> +
> +	list_for_each_entry(file, &dev_priv->dev->filelist, lhead) {
> +		struct drm_i915_file_private *fpriv = file->driver_priv;
> +		idr_for_each(&fpriv->context_idr, per_file_ctx_stats, &stats);
> +	}
> +	mutex_unlock(&dev_priv->dev->struct_mutex);
> +
> +	print_file_stats(m, "[k]contexts", stats);
> +}
> +
>  #define count_vmas(list, member) do { \
>  	list_for_each_entry(vma, list, member) { \
>  		size += i915_gem_obj_total_ggtt_size(vma->obj); \
> @@ -521,10 +557,10 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
>  
>  	seq_putc(m, '\n');
>  	print_batch_pool_stats(m, dev_priv);
> -
>  	mutex_unlock(&dev->struct_mutex);
>  
>  	mutex_lock(&dev->filelist_mutex);
> +	print_context_stats(m, dev_priv);
>  	list_for_each_entry_reverse(file, &dev->filelist, lhead) {
>  		struct file_stats stats;
>  		struct task_struct *task;
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-05-25  9:55 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 11:34 Context churn Chris Wilson
2016-05-23 11:34 ` [PATCH v2 01/11] drm/i915: Rename struct intel_context Chris Wilson
2016-05-23 11:34 ` [PATCH v2 02/11] drm/i915: Apply lockdep annotations to i915_gem_context.c Chris Wilson
2016-05-23 11:34 ` [PATCH v2 03/11] drm/i915: Rename and inline i915_gem_context_get() Chris Wilson
2016-05-23 11:34 ` [PATCH v2 04/11] drm/i915: Rename i915_gem_context_reference/unreference() Chris Wilson
2016-05-24 11:21   ` Chris Wilson
2016-05-23 11:34 ` [PATCH v2 05/11] drm/i915: Name the inner most per-engine intel_context struct Chris Wilson
2016-05-23 11:34 ` [PATCH v2 06/11] drm/i915: Move pinning of dev_priv->kernel_context into its creator Chris Wilson
2016-05-23 12:09   ` Tvrtko Ursulin
2016-05-23 12:16     ` Chris Wilson
2016-05-23 12:23       ` Tvrtko Ursulin
2016-05-25  9:25   ` Joonas Lahtinen
2016-05-23 11:34 ` [PATCH v2 07/11] drm/i915: Show i915_gem_context owner in debugfs Chris Wilson
2016-05-23 12:18   ` Tvrtko Ursulin
2016-05-25  9:18   ` Joonas Lahtinen
2016-05-23 11:34 ` [PATCH v2 08/11] drm/i915: Put the kernel_context in drm_i915_private next to its friends Chris Wilson
2016-05-23 11:34 ` [PATCH v2 09/11] drm/i915: Merge legacy+execlists context structs Chris Wilson
2016-05-23 11:34 ` [PATCH v2 10/11] drm/i915: Rearrange i915_gem_context Chris Wilson
2016-05-25  9:15   ` Joonas Lahtinen
2016-05-23 11:34 ` [PATCH v2 11/11] drm/i915: Show context objects in debugfs/i915_gem_objects Chris Wilson
2016-05-23 12:31   ` Tvrtko Ursulin
2016-05-23 12:40     ` Chris Wilson
2016-05-23 13:01     ` [PATCH v3] drm/i915/debugfs: Show context objects in i915_gem_objects Chris Wilson
2016-05-23 13:42       ` kbuild test robot
2016-05-23 13:50       ` kbuild test robot
2016-05-24 11:15       ` Tvrtko Ursulin
2016-05-25  9:55       ` Joonas Lahtinen [this message]
2016-05-25 10:00         ` Chris Wilson
2016-05-25  9:33   ` [PATCH v2 11/11] drm/i915: Show context objects in debugfs/i915_gem_objects Joonas Lahtinen
2016-05-23 12:01 ` ✓ Ro.CI.BAT: success for series starting with [v2,01/11] drm/i915: Rename struct intel_context Patchwork
2016-05-23 14:30 ` ✗ Ro.CI.BAT: failure for series starting with [v2,01/11] drm/i915: Rename struct intel_context (rev2) Patchwork
2016-05-24 13:53 ` [CI 01/10] drm/i915: Rename struct intel_context Chris Wilson
2016-05-24 13:53   ` [CI 02/10] drm/i915: Apply lockdep annotations to i915_gem_context.c Chris Wilson
2016-05-24 13:53   ` [CI 03/10] drm/i915: Rename and inline i915_gem_context_get() Chris Wilson
2016-05-24 13:53   ` [CI 04/10] drm/i915: Name the inner most per-engine intel_context struct Chris Wilson
2016-05-24 13:53   ` [CI 05/10] drm/i915: Move pinning of dev_priv->kernel_context into its creator Chris Wilson
2016-05-24 13:53   ` [CI 06/10] drm/i915: Show i915_gem_context owner in debugfs Chris Wilson
2016-05-24 13:53   ` [CI 07/10] drm/i915: Put the kernel_context in drm_i915_private next to its friends Chris Wilson
2016-05-24 13:53   ` [CI 08/10] drm/i915: Merge legacy+execlists context structs Chris Wilson
2016-05-24 13:53   ` [CI 09/10] drm/i915: Rearrange i915_gem_context Chris Wilson
2016-05-24 13:53   ` [CI 10/10] drm/i915/debugfs: Show context objects in i915_gem_objects Chris Wilson
2016-05-24 14:19 ` ✗ Ro.CI.BAT: warning for series starting with [v2,01/11] drm/i915: Rename struct intel_context (rev10) Patchwork

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=1464170121.4875.12.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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