public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: mika.kuoppala@intel.com
Subject: Re: [PATCH 14/22] drm/i915: Throw away the active object retirement complexity
Date: Mon, 17 Jun 2019 14:43:34 +0100	[thread overview]
Message-ID: <2991203f-1b3a-2292-7f3b-6e973e4f371e@intel.com> (raw)
In-Reply-To: <20190617071912.20256-14-chris@chris-wilson.co.uk>

On 17/06/2019 08:19, Chris Wilson wrote:
> 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: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/gem/i915_gem_object.c    |  1 -
>   drivers/gpu/drm/i915/gem/i915_gem_object.h    |  6 ---
>   .../gpu/drm/i915/gem/i915_gem_object_types.h  |  1 -
>   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c  |  5 +-
>   .../drm/i915/gem/selftests/i915_gem_mman.c    |  9 ----
>   drivers/gpu/drm/i915/gt/intel_lrc.c           |  4 +-
>   drivers/gpu/drm/i915/gt/intel_ringbuffer.c    |  1 -
>   drivers/gpu/drm/i915/gt/selftest_hangcheck.c  | 32 +++++------
>   drivers/gpu/drm/i915/i915_debugfs.c           |  8 +--
>   drivers/gpu/drm/i915/i915_gem_batch_pool.c    | 42 ++++++---------
>   drivers/gpu/drm/i915/i915_vma.c               | 54 ++++---------------
>   11 files changed, 47 insertions(+), 116 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index bb5b6e63a2cc..252e752da211 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -162,7 +162,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;
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> index 7cb1871d7128..454bfb498001 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> @@ -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)
>   {
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
> index 5b05698619ce..c299fed2c6b1 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object_types.h
> @@ -156,7 +156,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;
>   
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> index 3a926a8755c6..f4677f70cce7 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
> @@ -230,8 +230,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->resv,
> +								  true)))

Wait, isn't it the other way around, so 
!reservation_object_test_signaled_rcu() ?

>   				continue;
>   
>   			if (!(shrink & I915_SHRINK_BOUND) &&
> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> index 5c81f4b4813a..2053194a8b70 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> @@ -474,15 +474,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;
> -		}

Do we really want to drop the create_mmap_offset?

>   	}
>   
>   out:
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index bbbdc63906c6..cd4cf4d0b30c 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -1509,9 +1509,7 @@ static void execlists_submit_request(struct i915_request *request)
>   static void __execlists_context_fini(struct intel_context *ce)
>   {
>   	intel_ring_put(ce->ring);
> -
> -	GEM_BUG_ON(i915_gem_object_is_active(ce->state->obj));
> -	i915_gem_object_put(ce->state->obj);
> +	i915_vma_put(ce->state);

I guess vma_put atm is still just an alias...though this hunk seems a 
little misplaced for this patch? Not sure.

Fwiw,
Reviewed-by: Matthew Auld <matthew.auld@intel.com>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-06-17 13:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17  7:18 [PATCH 01/22] drm/i915: Restore -Wunused-but-set-variable Chris Wilson
2019-06-17  7:18 ` [PATCH 02/22] drm/i915/gtt: Serialise both updates to PDE and our shadow Chris Wilson
2019-06-17 10:36   ` Matthew Auld
2019-06-17 10:40     ` Chris Wilson
2019-06-17  7:18 ` [PATCH 03/22] drm/i915: Skip shrinking already freed pages Chris Wilson
2019-06-17  7:18 ` [PATCH 04/22] drm/i915: Stop passing I915_WAIT_LOCKED to i915_request_wait() Chris Wilson
2019-06-17  7:18 ` [PATCH 05/22] drm/i915: Flush the execution-callbacks on retiring Chris Wilson
2019-06-17  7:18 ` [PATCH 06/22] drm/i915/execlists: Preempt-to-busy Chris Wilson
2019-06-17  7:18 ` [PATCH 07/22] drm/i915/execlists: Minimalistic timeslicing Chris Wilson
2019-06-17  7:18 ` [PATCH 08/22] drm/i915/execlists: Force preemption Chris Wilson
2019-06-17  7:18 ` [PATCH 09/22] drm/i915: Make the semaphore saturation mask global Chris Wilson
2019-06-17  7:19 ` [PATCH 10/22] dma-fence: Propagate errors to dma-fence-array container Chris Wilson
2019-06-17  7:19 ` [PATCH 11/22] dma-fence: Report the composite sync_file status Chris Wilson
2019-06-17  7:19 ` [PATCH 12/22] dma-fence: Refactor signaling for manual invocation Chris Wilson
2019-06-17  7:19 ` [PATCH 13/22] dma-fence: Always execute signal callbacks Chris Wilson
2019-06-17  7:19 ` [PATCH 14/22] drm/i915: Throw away the active object retirement complexity Chris Wilson
2019-06-17 13:43   ` Matthew Auld [this message]
2019-06-17 13:49     ` Chris Wilson
2019-06-17  7:19 ` [PATCH 15/22] drm/i915: Provide an i915_active.acquire callback Chris Wilson
2019-06-17 18:58   ` Matthew Auld
2019-06-17  7:19 ` [PATCH 16/22] drm/i915: Push the i915_active.retire into a worker Chris Wilson
2019-06-17 19:25   ` Matthew Auld
2019-06-17  7:19 ` [PATCH 17/22] drm/i915/overlay: Switch to using i915_active tracking Chris Wilson
2019-06-17  7:19 ` [PATCH 18/22] drm/i915: Forgo last_fence active request tracking Chris Wilson
2019-06-17 19:34   ` Matthew Auld
2019-06-17  7:19 ` [PATCH 19/22] drm/i915: Extract intel_frontbuffer active tracking Chris Wilson
2019-06-17  7:19 ` [PATCH 20/22] drm/i915: Coordinate i915_active with its own mutex Chris Wilson
2019-06-17  7:19 ` [PATCH 21/22] drm/i915: Replace struct_mutex for batch pool serialisation Chris Wilson
2019-06-17  7:19 ` [PATCH 22/22] drm/i915: Move idle barrier cleanup into engine-pm Chris Wilson
2019-06-17  7:56 ` [PATCH 01/22] drm/i915: Restore -Wunused-but-set-variable Chris Wilson
2019-06-17  8:02 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/22] " Patchwork
2019-06-17  8:13 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-17 13:05 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-06-17 13:18   ` Chris Wilson
2019-06-18  7:54 ` [PATCH 01/22] " Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2991203f-1b3a-2292-7f3b-6e973e4f371e@intel.com \
    --to=matthew.auld@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox