[Intel-gfx] [PATCH v4 4/4] drm/i915: Fix premature LRC unpin in GuC mode

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 21 06:10:46 PST 2016

On Thu, Jan 21, 2016 at 01:51:30PM +0000, Tvrtko Ursulin wrote:
> But I can't really figure where would you put this poisoning? You
> could put something in in exec list mode after context complete and
> check it before it is used next time,

I was thinking just in context-free. Move the pages to a poisoned list
and check at the end of the test. The issue is that the GPU may write to
the pages as we release them, so instead of releasing them we just
poison them (or CRC them).

> but I did not think we can hit
> this in exec list mode, only in GuC. You think it is possible?

With the current code, no since the last context unreference is done
from i915_gem_request_free(), and the request reference is only dropped
after we see the context-switch/active->idle state change (i.e. the
context save should always be flushed by the time we unpin and free the
context). However, that ordering imposes the struct_mutex upon
request-free which leads to fairly severe issues that can be eleviated
by moving the context-unreference into the request-retire - which opens
up the context-close race to normal execlists, as the context can be
unreferenced before the next context-switch-interrupt, now fixed in this
patch. And reducing the context-pin lifetime even further should help
mitigate context thrashing and certain userspace stress tests (OpenGL

Chris Wilson, Intel Open Source Technology Centre

More information about the Intel-gfx mailing list