Re: [PATCH 12/21] drm/i915: Mark up address spaces that may need to allocate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 02/09/2019 05:02, Chris Wilson wrote:
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.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
  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 9095f017162e..56d27cf09a3d 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1500,6 +1500,7 @@ static struct i915_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
  			goto err_free_pd;
  	}
+ ppgtt->vm.bind_alloc = I915_VMA_LOCAL_BIND;

So this is re-using I915_VMA_LOCAL_BIND as a trick? Is it clear how that works from these call sites? Should it be called bind_alloc*s*? bind_allocates? Or be a boolean which is converted to a trick flag in i915_vma_bind where a comment can be put explaining the trick?

Regards,

Tvrtko

  	ppgtt->vm.insert_entries = gen8_ppgtt_insert;
  	ppgtt->vm.allocate_va_range = gen8_ppgtt_alloc;
  	ppgtt->vm.clear_range = gen8_ppgtt_clear;
@@ -1947,6 +1948,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_alloc = 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;
@@ -2578,6 +2580,7 @@ static int init_aliasing_ppgtt(struct i915_ggtt *ggtt)
  		goto err_ppgtt;
ggtt->alias = ppgtt;
+	ggtt->vm.bind_alloc |= ppgtt->vm.bind_alloc;
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 57d27898639a..007bdaf4ba00 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_alloc;
+
  	bool closed;
struct mutex mutex; /* protects vma and our lists */

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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux