[Intel-gfx] [PATCH v5 11/18] drm/i915/selftests: reset engine self tests
Chris Wilson
chris at chris-wilson.co.uk
Sat Mar 25 09:50:29 UTC 2017
On Fri, Mar 24, 2017 at 06:30:03PM -0700, Michel Thierry wrote:
> Check that we can reset specific engines, also check the fallback to
> full reset if something didn't work.
>
> Signed-off-by: Michel Thierry <michel.thierry at intel.com>
> ---
> drivers/gpu/drm/i915/selftests/intel_hangcheck.c | 144 +++++++++++++++++++++++
> 1 file changed, 144 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> index 76d5f78c1724..91b78e638494 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> @@ -323,6 +323,56 @@ static int igt_global_reset(void *arg)
> return err;
> }
>
> +static int igt_reset_engine(void *arg)
> +{
> + struct drm_i915_private *i915 = arg;
> + struct intel_engine_cs *engine;
> + enum intel_engine_id id;
> + unsigned int reset_count, reset_engine_count;
> + int err = 0;
> +
> + /* Check that we can issue a global GPU and engine reset */
> +
> + if (!intel_has_gpu_reset(i915))
> + return 0;
> +
> + if (!intel_has_reset_engine(i915))
> + return 0;
Where do you do the global reset in this function? So isn't the
has-engine-reset sufficient? And the caller does the global check for
you.
> + set_bit(I915_RESET_BACKOFF, &i915->gpu_error.flags);
> + mutex_lock(&i915->drm.struct_mutex);
This will all change! ;)
> +static int igt_render_engine_reset_fallback(void *arg)
> +{
> + struct drm_i915_private *i915 = arg;
> + struct intel_engine_cs *engine = i915->engine[RCS];
> + struct hang h;
> + struct drm_i915_gem_request *rq;
> + unsigned int reset_count, reset_engine_count;
> + int err = 0;
> +
> + /* Check that we can issue a global GPU and engine reset */
> +
> + if (!intel_has_gpu_reset(i915))
> + return 0;
> +
> + if (!intel_has_reset_engine(i915))
> + return 0;
> +
> + set_bit(I915_RESET_BACKOFF, &i915->gpu_error.flags);
> + mutex_lock(&i915->drm.struct_mutex);
> +
> + err = hang_init(&h, i915);
> + if (err)
> + goto unlock;
> +
> + rq = hang_create_request(&h, engine, i915->kernel_context);
> + if (IS_ERR(rq)) {
> + err = PTR_ERR(rq);
> + goto fini;
> + }
> +
> + i915_gem_request_get(rq);
> + __i915_add_request(rq, true);
...
> +fini:
i915_gem_request_put(rq);
> + hang_fini(&h);
> +unlock:
> + mutex_unlock(&i915->drm.struct_mutex);
> + clear_bit(I915_RESET_BACKOFF, &i915->gpu_error.flags);
> +
> + if (i915_terminally_wedged(&i915->gpu_error))
> + return -EIO;
> +
> + return err;
> +}
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list