Skip to contentSkip to conversation

drm/i915: Implement fair lru eviction across both rings. (v2)

PATCH In review Chris Wilson 2 participants 3 messages Aug 6, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 drm/i915: Implement fair lru eviction across both rings. (v2)

In reply to a message not in the archive

Based in a large part upon Daniel Vetter's implementation and adapted for handling multiple rings in a single pass.

This should lead to better gtt usage and fixes the page-fault-of-doom triggered. The fairness is provided by scanning through the GTT space amalgamating space in rendering order. As soon as we have a contiguous space in the GTT large enough for the new object (and its alignment), evict any object which lies within that space. This should keep more objects resident in the GTT.

Doing throughput testing on a PineView machine with cairo-perf-trace indicates that there is very little difference with the new LRU scan, perhaps a small improvement... Except oddly for the poppler trace.

Reference:

Bug 15911 - Intermittent X crash (freeze)
https://bugzilla.kernel.org/show_bug.cgi?id=15911

Bug 20152 - cannot view JPG in firefox when running UXA
https://bugs.freedesktop.org/show_bug.cgi?id=20152

Bug 24369 - Hang when scrolling firefox page with window in front
https://bugs.freedesktop.org/show_bug.cgi?id=24369

Bug 28478 - Intermittent graphics lockups due to overflow/loop
https://bugs.freedesktop.org/show_bug.cgi?id=28478

v2: Attempt to clarify the logic and order of eviction through the use of comments and macros.

---
 drivers/gpu/drm/i915/i915_drv.h       |    2 +
 drivers/gpu/drm/i915/i915_gem_evict.c |  276 +++++++++++++++++----------------
 2 files changed, 144 insertions(+), 134 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 75fe397..61a8c90 100644
@@ -668,6 +668,8 @@ struct drm_i915_gem_object {
 	struct list_head list;
 	/** This object's place on GPU write list */
 	struct list_head gpu_write_list;
+	/** This object's place on eviction list */
+	struct list_head evict_list;
 
 	/**
 	 * This is set if the object is on the active or flushing lists
drivers/gpu/drm/i915/i915_gem_evict.c +141 -133

308 lines not on this page · raw message

Signature · 1 line
1.7.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 25 lines · Chris Wilson

Based in a large part upon Daniel Vetter's implementation and adapted for handling multiple rings in a single pass.

This should lead to better gtt usage and fixes the page-fault-of-doom triggered. The fairness is provided by scanning through the GTT space amalgamating space in rendering order. As soon as we have a contiguous space in the GTT large enough for the new object (and its alignment), evict any object which lies within that space. This should keep more objects resident in the GTT.

Doing throughput testing on a PineView machine with cairo-perf-trace indicates that there is very little difference with the new LRU scan, perhaps a small improvement... Except oddly for the poppler trace.

Reference:

Bug 15911 - Intermittent X crash (freeze)
https://bugzilla.kernel.org/show_bug.cgi?id=15911

Bug 20152 - cannot view JPG in firefox when running UXA
https://bugs.freedesktop.org/show_bug.cgi?id=20152

Bug 24369 - Hang when scrolling firefox page with window in front
https://bugs.freedesktop.org/show_bug.cgi?id=24369

Quoted 8 lines

Bug 28478 - Intermittent graphics lockups due to overflow/loop
https://bugs.freedesktop.org/show_bug.cgi?id=28478

v2: Attempt to clarify the logic and order of eviction through the use of comments and macros.

One small nitpick below.

drivers/gpu/drm/i915/i915_gem_evict.c

Quoted 9 lines

int

drivers/gpu/drm/i915/i915_gem_evict.c +2 -2
-i915_gem_evict_something(struct drm_device *dev,
-			 int min_size, unsigned alignment)
+i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignment)
 {
 
[cut]
 
+	return i915_gem_evict_everything(dev);

I think this should be equivalent to

	return -ENOMEM;

(minus wasting less cpu, of course ;) But that's easily fixable in another patch (and probably better for bisection). Otherwise the patch looks good, besides that my gut still thinks that One Scan to Rule Them All is overkill. But that's simply bike-shedding, hence:

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#3 lore raw
Quoted 6 lines · Daniel Vetter

drivers/gpu/drm/i915/i915_gem_evict.c line 170

Quoted 1 line · Chris Wilson
drivers/gpu/drm/i915/i915_gem_evict.c +1 -0
+	return i915_gem_evict_everything(dev);

I think this should be equivalent to

	return -ENOMEM;

Yes, we could return -ENOSPC and then do_execbuffer() would unpin and call i915_gem_evict_everything() before retrying.

I'm happy for anybody to paint it a completely different colour just as soon as it is heading upstream. :)

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre