[Intel-gfx] [PATCH v3 2/4] drm/i915: Make engine state pretty-printer header configurable

Mika Kuoppala mika.kuoppala at linux.intel.com
Fri Nov 10 12:27:41 UTC 2017


Chris Wilson <chris at chris-wilson.co.uk> writes:

> Pass in a format string (and args) to specify the header to be emitted
> along with the engine state when pretty-printing. This allows the header
> to be emitted inside the drm_printer stream, so sharing the same prefix
> and output characteristics (e.g. debug level and filtering).
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c              |  2 +-
>  drivers/gpu/drm/i915/intel_engine_cs.c           | 18 ++++++++++++------
>  drivers/gpu/drm/i915/intel_ringbuffer.h          |  5 ++++-
>  drivers/gpu/drm/i915/selftests/intel_hangcheck.c | 21 ++++++++++++---------
>  4 files changed, 29 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 533ba096b9a6..8c5c4f161147 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3248,7 +3248,7 @@ static int i915_engine_info(struct seq_file *m, void *unused)
>  
>  	p = drm_seq_file_printer(m);
>  	for_each_engine(engine, dev_priv, id)
> -		intel_engine_dump(engine, &p);
> +		intel_engine_dump(engine, &p, "%s\n", engine->name);
>  
>  	intel_runtime_pm_put(dev_priv);
>  
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 403cc4749008..54d19784b6ab 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1652,12 +1652,12 @@ void intel_engines_park(struct drm_i915_private *i915)
>  		 * will be no more interrupts arriving later and the engines
>  		 * are truly idle.
>  		 */
> -		if (!intel_engine_is_idle(engine)) {
> +		if (GEM_WARN_ON(!intel_engine_is_idle(engine))) {
>  			struct drm_printer p = drm_debug_printer(__func__);
>  
> -			DRM_ERROR("%s is not idle before parking\n",
> -				  engine->name);
> -			intel_engine_dump(engine, &p);
> +			intel_engine_dump(engine, &p,
> +					  "%s is not idle before parking\n",
> +					  engine->name);
>  		}
>  
>  		if (engine->park)
> @@ -1727,7 +1727,9 @@ static void print_request(struct drm_printer *m,
>  		   rq->timeline->common->name);
>  }
>  
> -void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m)
> +void intel_engine_dump(struct intel_engine_cs *engine,
> +		       struct drm_printer *m,
> +		       const char *fmt, ...)
>  {
>  	struct intel_breadcrumbs * const b = &engine->breadcrumbs;
>  	const struct intel_engine_execlists * const execlists = &engine->execlists;
> @@ -1735,9 +1737,13 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m)
>  	struct drm_i915_private *dev_priv = engine->i915;
>  	struct drm_i915_gem_request *rq;
>  	struct rb_node *rb;
> +	va_list ap;
>  	u64 addr;
>  
> -	drm_printf(m, "%s\n", engine->name);
> +	va_start(ap, fmt);
> +	drm_vprintf(m, fmt, &ap);
> +	va_end(ap);
> +
>  	drm_printf(m, "\tcurrent seqno %x, last %x, hangcheck %x [%d ms], inflight %d\n",
>  		   intel_engine_get_seqno(engine),
>  		   intel_engine_last_submit(engine),
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index 2b0ae5468f48..a1a33466683b 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -936,6 +936,9 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915);
>  
>  bool intel_engine_can_store_dword(struct intel_engine_cs *engine);
>  
> -void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *p);
> +__printf(3, 4)
> +void intel_engine_dump(struct intel_engine_cs *engine,
> +		       struct drm_printer *m,
> +		       const char *fmt, ...);
>  
>  #endif /* _INTEL_RINGBUFFER_H_ */
> diff --git a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> index 71ce06680d66..18f181c46443 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> @@ -626,9 +626,10 @@ static int igt_wait_reset(void *arg)
>  	if (!wait_for_hang(&h, rq)) {
>  		struct drm_printer p = drm_info_printer(i915->drm.dev);
>  
> -		pr_err("Failed to start request %x, at %x\n",
> -		       rq->fence.seqno, hws_seqno(&h, rq));
> -		intel_engine_dump(rq->engine, &p);
> +		intel_engine_dump(rq->engine, &p,
> +				  "%s: Failed to start request %x, at %x\n",
> +				  rq->engine->name,
> +				  rq->fence.seqno, hws_seqno(&h, rq));
>  
>  		i915_reset(i915, 0);
>  		i915_gem_set_wedged(i915);
> @@ -721,9 +722,10 @@ static int igt_reset_queue(void *arg)
>  			if (!wait_for_hang(&h, prev)) {
>  				struct drm_printer p = drm_info_printer(i915->drm.dev);
>  
> -				pr_err("Failed to start request %x, at %x\n",
> -				       prev->fence.seqno, hws_seqno(&h, prev));
> -				intel_engine_dump(rq->engine, &p);
> +				intel_engine_dump(rq->engine, &p,
> +						  "%s: Failed to start request %x, at %x\n",
> +						  prev->engine->name,
> +						  prev->fence.seqno, hws_seqno(&h, prev));
>  
>  				i915_gem_request_put(rq);
>  				i915_gem_request_put(prev);
> @@ -827,9 +829,10 @@ static int igt_handle_error(void *arg)
>  	if (!wait_for_hang(&h, rq)) {
>  		struct drm_printer p = drm_info_printer(i915->drm.dev);
>  
> -		pr_err("Failed to start request %x, at %x\n",
> -		       rq->fence.seqno, hws_seqno(&h, rq));
> -		intel_engine_dump(rq->engine, &p);
> +		intel_engine_dump(rq->engine, &p,
> +				  "%s: Failed to start request %x, at %x\n",
> +				  rq->engine->name,
> +				  rq->fence.seqno, hws_seqno(&h, rq));
>  
>  		i915_reset(i915, 0);
>  		i915_gem_set_wedged(i915);
> -- 
> 2.15.0


More information about the Intel-gfx mailing list