Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a93615f9 authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Throw away the active object retirement complexity



Remove the accumulated optimisations that we have for i915_vma_retire
and reduce it to the bare essential of tracking the active object
reference. This allows us to only use atomic operations, and so will be
able to avoid the struct_mutex requirement.

The principal loss here is the shrinker MRU bumping, so now if we have
to shrink, we will do so in much more random order and more likely to
try and shrink recently used objects. That is a nuisance, but shrinking
active objects is a second step we try to avoid and will always be a
system-wide performance issue.

The other loss is here is in the automatic pruning of the
reservation_object when idling. This is not as large an issue as upon
reservation_object introduction as now adding new fences into the object
replaces already signaled fences, keeping the array compact. But we do
lose the auto-expiration of stale fences and unused arrays. That may be
a noticeable problem for which we need to re-implement autopruning.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190621183801.23252-3-chris@chris-wilson.co.uk
parent 5361db1a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -160,7 +160,6 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,

		mutex_lock(&i915->drm.struct_mutex);

		GEM_BUG_ON(i915_gem_object_is_active(obj));
		list_for_each_entry_safe(vma, vn, &obj->vma.list, obj_link) {
			GEM_BUG_ON(i915_vma_is_active(vma));
			vma->flags &= ~I915_VMA_PIN_MASK;
+0 −6
Original line number Diff line number Diff line
@@ -158,12 +158,6 @@ i915_gem_object_needs_async_cancel(const struct drm_i915_gem_object *obj)
	return obj->ops->flags & I915_GEM_OBJECT_ASYNC_CANCEL;
}

static inline bool
i915_gem_object_is_active(const struct drm_i915_gem_object *obj)
{
	return READ_ONCE(obj->active_count);
}

static inline bool
i915_gem_object_is_framebuffer(const struct drm_i915_gem_object *obj)
{
+0 −1
Original line number Diff line number Diff line
@@ -154,7 +154,6 @@ struct drm_i915_gem_object {

	/** Count of VMA actually bound by this object */
	atomic_t bind_count;
	unsigned int active_count;
	/** Count of how many global VMA are currently pinned for use by HW */
	unsigned int pin_global;

+3 −2
Original line number Diff line number Diff line
@@ -229,8 +229,9 @@ i915_gem_shrink(struct drm_i915_private *i915,
				continue;

			if (!(shrink & I915_SHRINK_ACTIVE) &&
			    (i915_gem_object_is_active(obj) ||
			     i915_gem_object_is_framebuffer(obj)))
			    (i915_gem_object_is_framebuffer(obj) ||
			     !reservation_object_test_signaled_rcu(obj->base.resv,
								   true)))
				continue;

			if (!(shrink & I915_SHRINK_BOUND) &&
+0 −9
Original line number Diff line number Diff line
@@ -475,15 +475,6 @@ static int igt_mmap_offset_exhaustion(void *arg)
			pr_err("[loop %d] Failed to busy the object\n", loop);
			goto err_obj;
		}

		/* NB we rely on the _active_ reference to access obj now */
		GEM_BUG_ON(!i915_gem_object_is_active(obj));
		err = create_mmap_offset(obj);
		if (err) {
			pr_err("[loop %d] create_mmap_offset failed with err=%d\n",
			       loop, err);
			goto out;
		}
	}

out:
Loading