Commit d75a92a8 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Allow for different modes of interruptible i915_active_wait

Allow some users the discretion to not immediately return on a normal
signal. Hopefully, they will opt to use TASK_KILLABLE instead.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200327112212.16046-1-chris@chris-wilson.co.uk
parent 4b379a48
...@@ -496,7 +496,7 @@ static int flush_lazy_signals(struct i915_active *ref) ...@@ -496,7 +496,7 @@ static int flush_lazy_signals(struct i915_active *ref)
return err; return err;
} }
int i915_active_wait(struct i915_active *ref) int __i915_active_wait(struct i915_active *ref, int state)
{ {
int err; int err;
...@@ -511,7 +511,9 @@ int i915_active_wait(struct i915_active *ref) ...@@ -511,7 +511,9 @@ int i915_active_wait(struct i915_active *ref)
if (err) if (err)
return err; return err;
if (wait_var_event_interruptible(ref, i915_active_is_idle(ref))) if (!i915_active_is_idle(ref) &&
___wait_var_event(ref, i915_active_is_idle(ref),
state, 0, 0, schedule()))
return -EINTR; return -EINTR;
flush_work(&ref->work); flush_work(&ref->work);
......
...@@ -181,7 +181,11 @@ static inline bool i915_active_has_exclusive(struct i915_active *ref) ...@@ -181,7 +181,11 @@ static inline bool i915_active_has_exclusive(struct i915_active *ref)
return rcu_access_pointer(ref->excl.fence); return rcu_access_pointer(ref->excl.fence);
} }
int i915_active_wait(struct i915_active *ref); int __i915_active_wait(struct i915_active *ref, int state);
static inline int i915_active_wait(struct i915_active *ref)
{
return __i915_active_wait(ref, TASK_INTERRUPTIBLE);
}
int i915_sw_fence_await_active(struct i915_sw_fence *fence, int i915_sw_fence_await_active(struct i915_sw_fence *fence,
struct i915_active *ref, struct i915_active *ref,
......
...@@ -153,7 +153,7 @@ static int live_active_wait(void *arg) ...@@ -153,7 +153,7 @@ static int live_active_wait(void *arg)
if (IS_ERR(active)) if (IS_ERR(active))
return PTR_ERR(active); return PTR_ERR(active);
i915_active_wait(&active->base); __i915_active_wait(&active->base, TASK_UNINTERRUPTIBLE);
if (!READ_ONCE(active->retired)) { if (!READ_ONCE(active->retired)) {
struct drm_printer p = drm_err_printer(__func__); struct drm_printer p = drm_err_printer(__func__);
...@@ -228,11 +228,11 @@ static int live_active_barrier(void *arg) ...@@ -228,11 +228,11 @@ static int live_active_barrier(void *arg)
} }
i915_active_release(&active->base); i915_active_release(&active->base);
if (err)
goto out;
if (err == 0) __i915_active_wait(&active->base, TASK_UNINTERRUPTIBLE);
err = i915_active_wait(&active->base); if (!READ_ONCE(active->retired)) {
if (err == 0 && !READ_ONCE(active->retired)) {
pr_err("i915_active not retired after flushing barriers!\n"); pr_err("i915_active not retired after flushing barriers!\n");
err = -EINVAL; err = -EINVAL;
} }
......
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