[Intel-gfx] [PATCH 5/8] drm/i915/selftests: Add tests for GT and engine workaround verification

Chris Wilson chris at chris-wilson.co.uk
Fri Nov 30 15:21:20 UTC 2018


Quoting Tvrtko Ursulin (2018-11-30 15:15:28)
> 
> On 30/11/2018 11:43, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2018-11-30 11:31:58)
> >> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> >>
> >> Two simple selftests which test that both GT and engine workarounds are
> >> not lost after either a full GPU reset, or after the per-engine ones.
> >>
> >> (Including checks that one engine reset is not affecting workarounds not
> >> belonging to itself.)
> >>
> >> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> >> ---
> >> +static int
> >> +live_engine_reset_gt_engine_workarounds(void *arg)
> >> +{
> >> +       struct drm_i915_private *i915 = arg;
> >> +       struct i915_gpu_error *error = &i915->gpu_error;
> >> +       struct intel_engine_cs *engine;
> >> +       enum intel_engine_id id;
> >> +       bool ok;
> >> +
> >> +       if (!intel_has_reset_engine(i915))
> >> +               return 0;
> > 
> > May be easier to take global_reset_lock/unlock from
> > selftests/intel_hanghceck.
> 
> I looked inside and did not find anything with this name so I don't know 
> what you mean?

This function
static void global_reset_lock(struct drm_i915_private *i915)
{
        struct intel_engine_cs *engine;
        enum intel_engine_id id;

        pr_debug("%s: current gpu_error=%08lx\n",
                 __func__, i915->gpu_error.flags);

        while (test_and_set_bit(I915_RESET_BACKOFF, &i915->gpu_error.flags))
                wait_event(i915->gpu_error.reset_queue,
                           !test_bit(I915_RESET_BACKOFF,
                                     &i915->gpu_error.flags));

        for_each_engine(engine, i915, id) {
                while (test_and_set_bit(I915_RESET_ENGINE + id,
                                        &i915->gpu_error.flags))
                        wait_on_bit(&i915->gpu_error.flags,
                                    I915_RESET_ENGINE + id,
                                    TASK_UNINTERRUPTIBLE);
        }
}
in selftests/intel_hangcheck.c

> >> +
> >> +       for_each_engine(engine, i915, id) {
> >> +               pr_info("Verifying after %s reset...\n", engine->name);
> >> +
> >> +               set_bit(I915_RESET_BACKOFF, &error->flags);
> >> +               set_bit(I915_RESET_ENGINE + engine->id, &error->flags);
> >> +
> >> +               ok = verify_gt_engine_wa(i915, "before reset");
> >> +               if (!ok)
> >> +                       goto out;
> >> +
> >> +               intel_runtime_pm_get(i915);
> >> +               i915_reset_engine(engine, "live_workarounds");
> >> +               intel_runtime_pm_put(i915);
> > 
> > Once idle, and once with a spinner?
> 
> If idle then engine reset does nothing, so maybe I am again not 
> following you.

The engine is idle here, so no reset, right?

Also worth verifying in case we change the implementation and there is
variation in HW between resetting from different states.
-Chris


More information about the Intel-gfx mailing list