[Intel-gfx] [PATCH 01/39] drm/i915: Add total count to context status debugfs output

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Fri Jan 8 01:50:52 PST 2016


On ma, 2015-11-23 at 11:38 +0000, John.C.Harrison at Intel.com wrote:
> From: John Harrison <John.C.Harrison at Intel.com>
> 
> When there are lots and lots and even more lots of contexts (e.g.
> when running
> with execlists) it is useful to be able to immediately see what the
> total
> context count is.
> 
> Change-Id: If9726d4df86567100ecf53867b43f4753f08bf84
> For: VIZ-1587

With below notes;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

> Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index 18dfb56..ecab9b8 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1953,6 +1953,7 @@ static int i915_context_status(struct seq_file
> *m, void *unused)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_engine_cs *ring;
>  	struct intel_context *ctx;
> +	uint32_t count = 0;

Should really be just of type 'int'. Overall the driver code use 'int'
for counting.

>  	int ret, i;
>  
>  	ret = mutex_lock_interruptible(&dev->struct_mutex);
> @@ -1966,6 +1967,7 @@ static int i915_context_status(struct seq_file
> *m, void *unused)
>  
>  		seq_puts(m, "HW context ");
>  		describe_ctx(m, ctx);
> +		count++;
>  		for_each_ring(ring, dev_priv, i) {
>  			if (ring->default_context == ctx)
>  				seq_printf(m, "(default context %s)
> ",
> @@ -1994,6 +1996,8 @@ static int i915_context_status(struct seq_file
> *m, void *unused)
>  		seq_putc(m, '\n');
>  	}
>  
> +	seq_printf(m, "Total: %d contexts\n", count);
> +

If the above variable is not changed, %d is wrong for uint32_t and unsi
gned int, should be %u.

>  	mutex_unlock(&dev->struct_mutex);
>  
>  	return 0;
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation



More information about the Intel-gfx mailing list