All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 02/20] drm/i915: Mark up address spaces that may need to allocate
Date: Fri,  4 Oct 2019 14:39:57 +0100	[thread overview]
Message-ID: <20191004134015.13204-3-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20191004134015.13204-1-chris@chris-wilson.co.uk>

Since we cannot allocate underneath the vm->mutex (it is used in the
direct-reclaim paths), we need to shift the allocations off into a
mutexless worker with fence recursion prevention. To know when we need
this protection, we mark up the address spaces that do allocate before
insertion. In the future, we may wish to extend the async bind scheme to
more than just allocations.

v2: s/vm->bind_alloc/vm->bind_async_flags/

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 3 +++
 drivers/gpu/drm/i915/i915_gem_gtt.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index ad9eb2d68f3f..8eba63ecdb03 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1502,6 +1502,7 @@ static struct i915_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
 			goto err_free_pd;
 	}
 
+	ppgtt->vm.bind_async_flags = I915_VMA_LOCAL_BIND;
 	ppgtt->vm.insert_entries = gen8_ppgtt_insert;
 	ppgtt->vm.allocate_va_range = gen8_ppgtt_alloc;
 	ppgtt->vm.clear_range = gen8_ppgtt_clear;
@@ -1950,6 +1951,7 @@ static struct i915_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915)
 	ppgtt_init(&ppgtt->base, &i915->gt);
 	ppgtt->base.vm.top = 1;
 
+	ppgtt->base.vm.bind_async_flags = I915_VMA_LOCAL_BIND;
 	ppgtt->base.vm.allocate_va_range = gen6_alloc_va_range;
 	ppgtt->base.vm.clear_range = gen6_ppgtt_clear_range;
 	ppgtt->base.vm.insert_entries = gen6_ppgtt_insert_entries;
@@ -2581,6 +2583,7 @@ static int init_aliasing_ppgtt(struct i915_ggtt *ggtt)
 		goto err_ppgtt;
 
 	ggtt->alias = ppgtt;
+	ggtt->vm.bind_async_flags |= ppgtt->vm.bind_async_flags;
 
 	GEM_BUG_ON(ggtt->vm.vma_ops.bind_vma != ggtt_bind_vma);
 	ggtt->vm.vma_ops.bind_vma = aliasing_gtt_bind_vma;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index bbdc735466c1..3502b9c85a8e 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -305,6 +305,8 @@ struct i915_address_space {
 	u64 total;		/* size addr space maps (ex. 2GB for ggtt) */
 	u64 reserved;		/* size addr space reserved */
 
+	unsigned int bind_async_flags;
+
 	bool closed;
 
 	struct mutex mutex; /* protects vma and our lists */
-- 
2.23.0

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

  parent reply	other threads:[~2019-10-04 13:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 13:39 struct_mutex, last round? Chris Wilson
2019-10-04 13:39 ` [PATCH 01/20] drm/i915: Only track bound elements of the GTT Chris Wilson
2019-10-04 13:39 ` Chris Wilson [this message]
2019-10-04 13:39 ` [PATCH 03/20] drm/i915: Pull i915_vma_pin under the vm->mutex Chris Wilson
2019-10-18  8:44   ` Daniel Vetter
2019-10-18  8:51     ` Daniel Vetter
2019-10-04 13:39 ` [PATCH 04/20] drm/i915: Push the i915_active.retire into a worker Chris Wilson
2019-10-04 13:40 ` [PATCH 05/20] drm/i915: Coordinate i915_active with its own mutex Chris Wilson
2019-10-04 13:40 ` [PATCH 06/20] drm/i915: Move idle barrier cleanup into engine-pm Chris Wilson
2019-10-04 13:40 ` [PATCH 07/20] drm/i915: Drop struct_mutex from around i915_retire_requests() Chris Wilson
2019-10-04 13:40 ` [PATCH 08/20] drm/i915: Remove the GEM idle worker Chris Wilson
2019-10-04 13:40 ` [PATCH 09/20] drm/i915: Merge wait_for_timelines with retire_request Chris Wilson
2019-10-04 13:40 ` [PATCH 10/20] drm/i915/gem: Retire directly for mmap-offset shrinking Chris Wilson
2019-10-04 13:40 ` [PATCH 11/20] drm/i915: Move request runtime management onto gt Chris Wilson
2019-10-04 13:40 ` [PATCH 12/20] drm/i915: Move global activity tracking from GEM to GT Chris Wilson
2019-10-04 13:40 ` [PATCH 13/20] drm/i915: Remove logical HW ID Chris Wilson
2019-10-04 13:40 ` [PATCH 14/20] drm/i915: Move context management under GEM Chris Wilson
2019-10-04 13:46   ` Tvrtko Ursulin
2019-10-04 13:40 ` [PATCH 15/20] drm/i915/overlay: Drop struct_mutex guard Chris Wilson
2019-10-04 13:40 ` [PATCH 16/20] drm/i915: Drop struct_mutex guard from debugfs/framebuffer_info Chris Wilson
2019-10-04 13:40 ` [PATCH 17/20] drm/i915: Remove struct_mutex guard for debugfs/opregion Chris Wilson
2019-10-04 13:40 ` [PATCH 18/20] drm/i915: Drop struct_mutex from suspend state save/restore Chris Wilson
2019-10-04 13:40 ` [PATCH 19/20] drm/i915/selftests: Drop vestigal struct_mutex guards Chris Wilson
2019-10-04 13:40 ` [PATCH 20/20] drm/i915: Drop struct_mutex from around GEM initialisation Chris Wilson
2019-10-04 14:14 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/20] drm/i915: Only track bound elements of the GTT Patchwork
2019-10-04 14:49 ` ✗ Fi.CI.BAT: failure " Patchwork

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=20191004134015.13204-3-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.