[PATCH 26/63] drm/i915: Hold wakeref for the duration of the vma GGTT binding
Chris Wilson
chris at chris-wilson.co.uk
Fri Jul 10 10:33:25 UTC 2020
Now that we have pushed the binding itself outside of the vm->mutex, we
are clear of the potential wakeref inversions and can take the wakeref
around the actual duration of the HW interaction.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/gt/intel_ggtt.c | 5 ++++-
drivers/gpu/drm/i915/i915_vma.c | 6 ------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c
index 59a4a3ab6bfd..94bcd4768627 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
@@ -441,6 +441,7 @@ static void ggtt_bind_vma(struct i915_address_space *vm,
u32 flags)
{
struct drm_i915_gem_object *obj = vma->obj;
+ intel_wakeref_t wakeref;
u32 pte_flags;
if (i915_vma_is_bound(vma, ~flags & I915_VMA_BIND_MASK))
@@ -451,7 +452,9 @@ static void ggtt_bind_vma(struct i915_address_space *vm,
if (i915_gem_object_is_readonly(obj))
pte_flags |= PTE_READ_ONLY;
- vm->insert_entries(vm, vma, cache_level, pte_flags);
+ with_intel_runtime_pm(vm->gt->uncore->rpm, wakeref)
+ vm->insert_entries(vm, vma, cache_level, pte_flags);
+
vma->page_sizes.gtt = I915_GTT_PAGE_SIZE;
}
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 633f335ce892..e584a3355911 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -820,7 +820,6 @@ static int __wait_for_unbind(struct i915_vma *vma, unsigned int flags)
int i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
{
struct i915_vma_work *work = NULL;
- intel_wakeref_t wakeref = 0;
unsigned int bound;
int err;
@@ -839,9 +838,6 @@ int i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
return err;
}
- if (flags & PIN_GLOBAL)
- wakeref = intel_runtime_pm_get(&vma->vm->i915->runtime_pm);
-
err = __wait_for_unbind(vma, flags);
if (err)
goto err_rpm;
@@ -951,8 +947,6 @@ int i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
err_fence:
dma_fence_work_commit_imm(&work->base);
err_rpm:
- if (wakeref)
- intel_runtime_pm_put(&vma->vm->i915->runtime_pm, wakeref);
if (vma->obj)
i915_gem_object_unpin_pages(vma->obj);
return err;
--
2.20.1
More information about the Intel-gfx-trybot
mailing list