OSDN Git Service

drm/i915: Remove (struct_mutex) locking for wait-ioctl
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 5 Aug 2016 09:14:17 +0000 (10:14 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 5 Aug 2016 09:54:40 +0000 (10:54 +0100)
commit033d549b811ea8512efd57fa5fb5c53e498e0db3
treec8bc4860945f71962e34c6d202a872d86eab2af5
parent258a5edee0a306d52f5f84ca8a45736efa309ca4
drm/i915: Remove (struct_mutex) locking for wait-ioctl

With a bit of care (and leniency) we can iterate over the object and
wait for previous rendering to complete with judicial use of atomic
reference counting. The ABI requires us to ensure that an active object
is eventually flushed (like the busy-ioctl) which is guaranteed by our
management of requests (i.e. everything that is submitted to hardware is
flushed in the same request). All we have to do is ensure that we can
detect when the requests are complete for reporting when the object is
idle (without triggering ETIME), locklessly - this is handled by
i915_gem_active_wait_unlocked().

The impact of this is actually quite small - the return to userspace
following the wait was already lockless and so we don't see much gain in
latency improvement upon completing the wait. What we do achieve here is
completing an already finished wait without hitting the struct_mutex,
our hold is quite short and so we are typically just a victim of
contention rather than a cause - but it is still one less contention
point!

v2: Break up a long line.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470388464-28458-12-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c