[PATCH 14/15] drm/i915: Remove i915_vma->active
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Tue Jul 27 10:07:08 UTC 2021
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
drivers/gpu/drm/i915/gt/intel_context.c | 43 ++-----------------------
drivers/gpu/drm/i915/i915_gpu_error.c | 9 +++---
drivers/gpu/drm/i915/i915_vma.c | 33 +------------------
drivers/gpu/drm/i915/i915_vma_types.h | 2 --
4 files changed, 8 insertions(+), 79 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
index f5263940d168..670bcf10a326 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -111,10 +111,6 @@ static int __context_pin_state(struct i915_vma *vma, struct i915_gem_ww_ctx *ww)
if (err)
return err;
- err = i915_active_acquire(&vma->active);
- if (err)
- goto err_unpin;
-
/*
* And mark it as a globally pinned object to let the shrinker know
* it cannot reclaim the object until we release it.
@@ -123,45 +119,14 @@ static int __context_pin_state(struct i915_vma *vma, struct i915_gem_ww_ctx *ww)
vma->obj->mm.dirty = true;
return 0;
-
-err_unpin:
- i915_vma_unpin(vma);
- return err;
}
static void __context_unpin_state(struct i915_vma *vma)
{
i915_vma_make_shrinkable(vma);
- i915_active_release(&vma->active);
__i915_vma_unpin(vma);
}
-static int __ring_active(struct intel_ring *ring,
- struct i915_gem_ww_ctx *ww)
-{
- int err;
-
- err = intel_ring_pin(ring, ww);
- if (err)
- return err;
-
- err = i915_active_acquire(&ring->vma->active);
- if (err)
- goto err_pin;
-
- return 0;
-
-err_pin:
- intel_ring_unpin(ring);
- return err;
-}
-
-static void __ring_retire(struct intel_ring *ring)
-{
- i915_active_release(&ring->vma->active);
- intel_ring_unpin(ring);
-}
-
static int intel_context_pre_pin(struct intel_context *ce,
struct i915_gem_ww_ctx *ww)
{
@@ -169,7 +134,7 @@ static int intel_context_pre_pin(struct intel_context *ce,
CE_TRACE(ce, "active\n");
- err = __ring_active(ce->ring, ww);
+ err = intel_ring_pin(ce->ring, ww);
if (err)
return err;
@@ -190,7 +155,7 @@ static int intel_context_pre_pin(struct intel_context *ce,
err_timeline:
intel_timeline_unpin(ce->timeline);
err_ring:
- __ring_retire(ce->ring);
+ intel_ring_unpin(ce->ring);
return err;
}
@@ -200,7 +165,7 @@ static void intel_context_post_unpin(struct intel_context *ce)
__context_unpin_state(ce->state);
intel_timeline_unpin(ce->timeline);
- __ring_retire(ce->ring);
+ intel_ring_unpin(ce->ring);
}
int __intel_context_do_pin_ww(struct intel_context *ce,
@@ -352,13 +317,11 @@ static int __intel_context_active(struct i915_active *active)
intel_context_get(ce);
/* everything should already be activated by intel_context_pre_pin() */
- GEM_WARN_ON(!i915_active_acquire_if_busy(&ce->ring->vma->active));
__intel_ring_pin(ce->ring);
__intel_timeline_pin(ce->timeline);
if (ce->state) {
- GEM_WARN_ON(!i915_active_acquire_if_busy(&ce->state->active));
__i915_vma_pin(ce->state);
i915_vma_make_unshrinkable(ce->state);
}
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index cd398bb93653..e17762dd080d 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1309,10 +1309,8 @@ capture_vma(struct intel_engine_capture_vma *next,
if (!c)
return next;
- if (!i915_active_acquire_if_busy(&vma->active)) {
- kfree(c);
- return next;
- }
+ __i915_vma_get(vma);
+ i915_vma_get(vma);
strcpy(c->name, name);
c->vma = vma; /* reference held while active */
@@ -1405,7 +1403,8 @@ intel_engine_coredump_add_vma(struct intel_engine_coredump *ee,
vma, this->name,
compress));
- i915_active_release(&vma->active);
+ __i915_vma_put(vma);
+ i915_vma_put(vma);
capture = this->next;
kfree(this);
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index c2a3b8252b45..fbb55ee479d7 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -84,21 +84,6 @@ static void vma_print_allocator(struct i915_vma *vma, const char *reason)
#endif
-static inline struct i915_vma *active_to_vma(struct i915_active *ref)
-{
- return container_of(ref, typeof(struct i915_vma), active);
-}
-
-static int __i915_vma_active(struct i915_active *ref)
-{
- return i915_vma_tryget(active_to_vma(ref)) ? 0 : -ENOENT;
-}
-
-static void __i915_vma_retire(struct i915_active *ref)
-{
- i915_vma_put(active_to_vma(ref));
-}
-
static struct i915_vma *
vma_create(struct drm_i915_gem_object *obj,
struct i915_address_space *vm,
@@ -122,15 +107,6 @@ vma_create(struct drm_i915_gem_object *obj,
vma->size = obj->base.size;
vma->display_alignment = I915_GTT_MIN_ALIGNMENT;
- i915_active_init(&vma->active, __i915_vma_active, __i915_vma_retire, 0);
-
- /* Declare ourselves safe for use inside shrinkers */
- if (IS_ENABLED(CONFIG_LOCKDEP)) {
- fs_reclaim_acquire(GFP_KERNEL);
- might_lock(&vma->active.mutex);
- fs_reclaim_release(GFP_KERNEL);
- }
-
INIT_LIST_HEAD(&vma->closed_link);
if (view && view->type != I915_GGTT_VIEW_NORMAL) {
@@ -1266,14 +1242,10 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
goto err_unlock;
}
- err = i915_active_acquire(&vma->active);
- if (err)
- goto err_unlock;
-
if (!(bound & I915_VMA_BIND_MASK)) {
err = i915_vma_insert(vma, size, alignment, flags);
if (err)
- goto err_active;
+ goto err_unlock;
if (i915_is_ggtt(vma->vm))
__i915_vma_set_map_and_fenceable(vma);
@@ -1301,8 +1273,6 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
i915_vma_detach(vma);
drm_mm_remove_node(&vma->node);
}
-err_active:
- i915_active_release(&vma->active);
err_unlock:
mutex_unlock(&vma->vm->mutex);
err_fence:
@@ -1434,7 +1404,6 @@ void i915_vma_release(struct kref *ref)
__i915_vma_remove_closed(vma);
i915_vm_put(vma->vm);
- i915_active_fini(&vma->active);
i915_vma_free(vma);
}
diff --git a/drivers/gpu/drm/i915/i915_vma_types.h b/drivers/gpu/drm/i915/i915_vma_types.h
index a129ab9b6405..a9a23e38a622 100644
--- a/drivers/gpu/drm/i915/i915_vma_types.h
+++ b/drivers/gpu/drm/i915/i915_vma_types.h
@@ -255,8 +255,6 @@ struct i915_vma {
#define I915_VMA_SCANOUT_BIT 18
#define I915_VMA_SCANOUT ((int)BIT(I915_VMA_SCANOUT_BIT))
- struct i915_active active;
-
#define I915_VMA_PAGES_BIAS 24
#define I915_VMA_PAGES_ACTIVE (BIT(24) | 1)
atomic_t pages_count; /* number of active binds to the pages */
--
2.31.0
More information about the Intel-gfx-trybot
mailing list