Re: [PATCH 03/25] drm/i915: Prevent user context creation while wedged

Chris Wilson
2019-02-19T13:20:11Z

Quoting Mika Kuoppala (2019-02-19 13:07:08)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
>
> > Introduce a new ABI method for detecting a wedged driver by reporting
> > -EIO from DRM_IOCTL_I915_GEM_CONTEXT_CREATE.
>
> Need more on the 'why' department. What is lacking with
> the method of submitting and noticing the wedged?
>
> Also detecting banned from wedged is not trivial.

The biggest problem is our transient wedging, where we use
i915_gem_set_wedged() to cancel inflight rendering to avoid a deadlock
during reset. That is an issue here as we may submit and see -EIO even
though the driver isn't strictly terminally wedged and may reset.

We've even seen that once in practice,
https://bugs.freedesktop.org/show_bug.cgi?id=109580.

Hmm, pre-existing problem requiring more general solution. I'm thinking
along the lines of

if (i915_terminally_wedged())
return i915_reset_backoff() ? -EAGAIN : -EIO;

Joy. /o\

ret = i915_reset_backoff();

static int i915_reset_backoff()
{
unsigned long flags = READ_ONCE(error->flags);

if (!(flags & WEDGED))
return 0;

if (flags & BACKOFF)
return -EAGAIN;

return -EIO;
}

Seems eerily familiar, like a full circle.
-Chris