[igt-dev] [Intel-gfx] [PATCH i-g-t] igt/gem_ctx_exec: Exercise I915_CONTEXT_PARAM_RECOVERABLE
Chris Wilson
chris at chris-wilson.co.uk
Thu Oct 4 15:19:08 UTC 2018
Quoting Mika Kuoppala (2018-10-04 14:26:16)
> Chris Wilson <chris at chris-wilson.co.uk> writes:
>
> > When RECOVERABLE is set, the kernel will attempt to automatically recover
> > a context after a hang. But if it is unset, the kernel will ban the
> > guilty context on a hang, preventing subsequent execution.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> > tests/gem_ctx_exec.c | 38 ++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 38 insertions(+)
> >
> > diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
> > index 908b59af..1cd3b20e 100644
> > --- a/tests/gem_ctx_exec.c
> > +++ b/tests/gem_ctx_exec.c
> > @@ -147,6 +147,41 @@ static void invalid_context(int fd, unsigned ring, uint32_t handle)
> > igt_assert_eq(__gem_execbuf(fd, &execbuf), -ENOENT);
> > }
> >
> > +static void norecovery(int i915)
> > +{
> > + for (int pass = 1; pass >= 0; pass--) {
> > + struct drm_i915_gem_context_param param = {
> > + .ctx_id = gem_context_create(i915),
> > + .param = 0x7,
> > + .value = pass,
> > + };
> > + int expect = pass == 0 ? -EIO : 0;
> > + igt_spin_t *spin;
> > +
> > + if (pass)
> > + igt_require(__gem_context_set_param(i915, ¶m) == 0);
> > + else
> > + gem_context_set_param(i915, ¶m);
>
> You are trying in here to make the asserts unique?
Nah, since pass=1 was meant to be standard procedure, this was just a
"has param check". So I was being lazy and not separating it out into
its own little helper.
> > + gem_context_get_param(i915, ¶m);
> > + igt_assert_eq(param.value, pass);
> > +
> > + spin = __igt_spin_batch_new(i915,
> > + .ctx = param.ctx_id,
> > + .flags = IGT_SPIN_POLL_RUN);
> > + igt_assert(spin->running);
> > +
> > + while (!READ_ONCE(*spin->running))
> > + ;
>
> wait that it is running...
>
> > + igt_force_gpu_reset(i915);
> > +
>
> then reset.
Aye, that's our current MO for gpu resets.
> > + igt_spin_batch_end(spin);
>
> > + igt_assert_eq(__gem_execbuf(i915, &spin->execbuf), expect);
>
> Hmm where do we sync with hang resolution. Is it the handoff in
> the wedged debugfs entry?
Yes. The force-gpu reset is synchronous, you should be able to remember
the fun we had with that little race.
-Chris
More information about the igt-dev
mailing list