Commit dcfe0506 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Improve fallback ring waiting

A few improvements to the fallback method for waiting upon ring space:

1. Fix the start/end wait tracepoints to always be paired.
2. Increase responsiveness of checking
3. Mark the process as waiting upon io
4. Check for signal interruptions
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarBrad Volkin <bradley.d.volkin@intel.com>
[danvet: Drop the s/msleep/io_schedule_timeout/ change again since the
latter isn't exported.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 6e7186af
...@@ -1546,7 +1546,6 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n) ...@@ -1546,7 +1546,6 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n)
/* force the tail write in case we have been skipping them */ /* force the tail write in case we have been skipping them */
__intel_ring_advance(ring); __intel_ring_advance(ring);
trace_i915_ring_wait_begin(ring);
/* With GEM the hangcheck timer should kick us out of the loop, /* With GEM the hangcheck timer should kick us out of the loop,
* leaving it early runs the risk of corrupting GEM state (due * leaving it early runs the risk of corrupting GEM state (due
* to running on almost untested codepaths). But on resume * to running on almost untested codepaths). But on resume
...@@ -1554,12 +1553,13 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n) ...@@ -1554,12 +1553,13 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n)
* case by choosing an insanely large timeout. */ * case by choosing an insanely large timeout. */
end = jiffies + 60 * HZ; end = jiffies + 60 * HZ;
trace_i915_ring_wait_begin(ring);
do { do {
ring->head = I915_READ_HEAD(ring); ring->head = I915_READ_HEAD(ring);
ring->space = ring_space(ring); ring->space = ring_space(ring);
if (ring->space >= n) { if (ring->space >= n) {
trace_i915_ring_wait_end(ring); ret = 0;
return 0; break;
} }
if (!drm_core_check_feature(dev, DRIVER_MODESET) && if (!drm_core_check_feature(dev, DRIVER_MODESET) &&
...@@ -1571,13 +1571,23 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n) ...@@ -1571,13 +1571,23 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n)
msleep(1); msleep(1);
if (dev_priv->mm.interruptible && signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}
ret = i915_gem_check_wedge(&dev_priv->gpu_error, ret = i915_gem_check_wedge(&dev_priv->gpu_error,
dev_priv->mm.interruptible); dev_priv->mm.interruptible);
if (ret) if (ret)
return ret; break;
} while (!time_after(jiffies, end));
if (time_after(jiffies, end)) {
ret = -EBUSY;
break;
}
} while (1);
trace_i915_ring_wait_end(ring); trace_i915_ring_wait_end(ring);
return -EBUSY; return ret;
} }
static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring) static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
......
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