Commit f1925f33 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Use EAGAIN for trylock failures

While not good behaviour, it is, however, established behaviour that we
can punt EAGAIN to userspace if we need to retry the ioctl. When trying
to acquire a mutex, prefer to use EAGAIN to propagate losing the race
so that if it does end up back in userspace, we try again.

Fixes: c81471f5 ("drm/i915: Copy across scheduler behaviour flags across submit fences")
Closes: https://gitlab.freedesktop.org/drm/intel/issues/800Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191213160347.1789004-1-chris@chris-wilson.co.uk
parent 639f2f24
...@@ -527,7 +527,7 @@ int intel_timeline_read_hwsp(struct i915_request *from, ...@@ -527,7 +527,7 @@ int intel_timeline_read_hwsp(struct i915_request *from,
GEM_BUG_ON(rcu_access_pointer(to->timeline) == tl); GEM_BUG_ON(rcu_access_pointer(to->timeline) == tl);
err = -EBUSY; err = -EAGAIN;
if (mutex_trylock(&tl->mutex)) { if (mutex_trylock(&tl->mutex)) {
struct intel_timeline_cacheline *cl = from->hwsp_cacheline; struct intel_timeline_cacheline *cl = from->hwsp_cacheline;
......
...@@ -771,7 +771,7 @@ i915_request_await_start(struct i915_request *rq, struct i915_request *signal) ...@@ -771,7 +771,7 @@ i915_request_await_start(struct i915_request *rq, struct i915_request *signal)
if (!tl) /* already started or maybe even completed */ if (!tl) /* already started or maybe even completed */
return 0; return 0;
fence = ERR_PTR(-EBUSY); fence = ERR_PTR(-EAGAIN);
if (mutex_trylock(&tl->mutex)) { if (mutex_trylock(&tl->mutex)) {
fence = NULL; fence = NULL;
if (!i915_request_started(signal) && if (!i915_request_started(signal) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment