[Intel-gfx] [PATCH 3/6] drm/i915/selftests: Fixup atomic reset checking

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 26 13:39:28 UTC 2019


Quoting Mika Kuoppala (2019-06-26 14:35:01)
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > We require that the intel_gpu_reset() was atomic, not the whole of
> > i915_reset() which is guarded by a mutex. However, we do require that
> > i915_reset_engine() is atomic for use from within the submission tasklet.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/gt/selftest_reset.c | 65 +++++++++++++++++++++++-
> >  1 file changed, 63 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gt/selftest_reset.c b/drivers/gpu/drm/i915/gt/selftest_reset.c
> > index 64c2c8ab64ec..641cf3aee8d5 100644
> > --- a/drivers/gpu/drm/i915/gt/selftest_reset.c
> > +++ b/drivers/gpu/drm/i915/gt/selftest_reset.c
> > @@ -73,11 +73,13 @@ static int igt_atomic_reset(void *arg)
> >       for (p = igt_atomic_phases; p->name; p++) {
> >               GEM_TRACE("intel_gpu_reset under %s\n", p->name);
> >  
> > -             p->critical_section_begin();
> >               reset_prepare(i915);
> > +             p->critical_section_begin();
> > +
> >               err = intel_gpu_reset(i915, ALL_ENGINES);
> > -             reset_finish(i915);
> > +
> >               p->critical_section_end();
> > +             reset_finish(i915);
> >  
> >               if (err) {
> >                       pr_err("intel_gpu_reset failed under %s\n", p->name);
> > @@ -95,12 +97,71 @@ static int igt_atomic_reset(void *arg)
> >       return err;
> >  }
> >  
> > +static int igt_atomic_engine_reset(void *arg)
> > +{
> > +     struct drm_i915_private *i915 = arg;
> > +     const typeof(*igt_atomic_phases) *p;
> 
> I did admire the nastyness of this array.
> 
> > +     struct intel_engine_cs *engine;
> > +     enum intel_engine_id id;
> > +     int err = 0;
> > +
> > +     /* Check that the resets are usable from atomic context */
> > +
> > +     if (!intel_has_reset_engine(i915))
> > +             return 0;
> > +
> > +     if (USES_GUC_SUBMISSION(i915))
> > +             return 0;
> > +
> > +     intel_gt_pm_get(&i915->gt);
> > +     igt_global_reset_lock(i915);
> > +
> > +     /* Flush any requests before we get started and check basics */
> > +     if (!igt_force_reset(i915))
> > +             goto out_unlock;
> 
> I would still go out with error if the prerequisites
> are not met?

It's just so that the selftests report green except for the 1 or 2 that
explicitly report as red if the machine is terminally wedged at boot.

It's just damage control.
-Chris


More information about the Intel-gfx mailing list