diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-05-05 04:07:32 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-05-07 19:22:34 -0400 |
commit | dcfe050659bbd02e3b18d4b19eb0bcc8d0072bb0 (patch) | |
tree | 66adfd32356caa8db06641345519b51c7ee5c21b /drivers/gpu/drm/i915/intel_ringbuffer.c | |
parent | 6e7186af3b815adda710ee8b4a6f1402776661c0 (diff) |
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: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Brad 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: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 40a7aa4db589..e6c7a4dfea51 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1546,7 +1546,6 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n) | |||
1546 | /* force the tail write in case we have been skipping them */ | 1546 | /* force the tail write in case we have been skipping them */ |
1547 | __intel_ring_advance(ring); | 1547 | __intel_ring_advance(ring); |
1548 | 1548 | ||
1549 | trace_i915_ring_wait_begin(ring); | ||
1550 | /* With GEM the hangcheck timer should kick us out of the loop, | 1549 | /* With GEM the hangcheck timer should kick us out of the loop, |
1551 | * leaving it early runs the risk of corrupting GEM state (due | 1550 | * leaving it early runs the risk of corrupting GEM state (due |
1552 | * to running on almost untested codepaths). But on resume | 1551 | * 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 | * case by choosing an insanely large timeout. */ | 1553 | * case by choosing an insanely large timeout. */ |
1555 | end = jiffies + 60 * HZ; | 1554 | end = jiffies + 60 * HZ; |
1556 | 1555 | ||
1556 | trace_i915_ring_wait_begin(ring); | ||
1557 | do { | 1557 | do { |
1558 | ring->head = I915_READ_HEAD(ring); | 1558 | ring->head = I915_READ_HEAD(ring); |
1559 | ring->space = ring_space(ring); | 1559 | ring->space = ring_space(ring); |
1560 | if (ring->space >= n) { | 1560 | if (ring->space >= n) { |
1561 | trace_i915_ring_wait_end(ring); | 1561 | ret = 0; |
1562 | return 0; | 1562 | break; |
1563 | } | 1563 | } |
1564 | 1564 | ||
1565 | if (!drm_core_check_feature(dev, DRIVER_MODESET) && | 1565 | 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 | 1571 | ||
1572 | msleep(1); | 1572 | msleep(1); |
1573 | 1573 | ||
1574 | if (dev_priv->mm.interruptible && signal_pending(current)) { | ||
1575 | ret = -ERESTARTSYS; | ||
1576 | break; | ||
1577 | } | ||
1578 | |||
1574 | ret = i915_gem_check_wedge(&dev_priv->gpu_error, | 1579 | ret = i915_gem_check_wedge(&dev_priv->gpu_error, |
1575 | dev_priv->mm.interruptible); | 1580 | dev_priv->mm.interruptible); |
1576 | if (ret) | 1581 | if (ret) |
1577 | return ret; | 1582 | break; |
1578 | } while (!time_after(jiffies, end)); | 1583 | |
1584 | if (time_after(jiffies, end)) { | ||
1585 | ret = -EBUSY; | ||
1586 | break; | ||
1587 | } | ||
1588 | } while (1); | ||
1579 | trace_i915_ring_wait_end(ring); | 1589 | trace_i915_ring_wait_end(ring); |
1580 | return -EBUSY; | 1590 | return ret; |
1581 | } | 1591 | } |
1582 | 1592 | ||
1583 | static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring) | 1593 | static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring) |