提交 ed9724dd 编写于 作者: M Matthew Auld 提交者: Chris Wilson

drm/i915: add i915_address_space_fini

We already have an i915_address_space_init, so for symmetry we should
also have a _fini, plus we already open code it twice. This then also
fixes a bug where we leak the timeline for the ggtt vm.

v2: don't forget about the struct_mutex for the ggtt path.

Fixes: 80b204bc ("drm/i915: Enable multiple timelines")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NMatthew Auld <matthew.auld@intel.com>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20161117210411.14044-1-chris@chris-wilson.co.uk
上级 6288c79e
...@@ -2196,6 +2196,13 @@ static void i915_address_space_init(struct i915_address_space *vm, ...@@ -2196,6 +2196,13 @@ static void i915_address_space_init(struct i915_address_space *vm,
list_add_tail(&vm->global_link, &dev_priv->vm_list); list_add_tail(&vm->global_link, &dev_priv->vm_list);
} }
static void i915_address_space_fini(struct i915_address_space *vm)
{
i915_gem_timeline_fini(&vm->timeline);
drm_mm_takedown(&vm->mm);
list_del(&vm->global_link);
}
static void gtt_write_workarounds(struct drm_i915_private *dev_priv) static void gtt_write_workarounds(struct drm_i915_private *dev_priv)
{ {
/* This function is for gtt related workarounds. This function is /* This function is for gtt related workarounds. This function is
...@@ -2278,7 +2285,7 @@ i915_ppgtt_create(struct drm_i915_private *dev_priv, ...@@ -2278,7 +2285,7 @@ i915_ppgtt_create(struct drm_i915_private *dev_priv,
return ppgtt; return ppgtt;
} }
void i915_ppgtt_release(struct kref *kref) void i915_ppgtt_release(struct kref *kref)
{ {
struct i915_hw_ppgtt *ppgtt = struct i915_hw_ppgtt *ppgtt =
container_of(kref, struct i915_hw_ppgtt, ref); container_of(kref, struct i915_hw_ppgtt, ref);
...@@ -2290,9 +2297,7 @@ void i915_ppgtt_release(struct kref *kref) ...@@ -2290,9 +2297,7 @@ void i915_ppgtt_release(struct kref *kref)
WARN_ON(!list_empty(&ppgtt->base.inactive_list)); WARN_ON(!list_empty(&ppgtt->base.inactive_list));
WARN_ON(!list_empty(&ppgtt->base.unbound_list)); WARN_ON(!list_empty(&ppgtt->base.unbound_list));
i915_gem_timeline_fini(&ppgtt->base.timeline); i915_address_space_fini(&ppgtt->base);
list_del(&ppgtt->base.global_link);
drm_mm_takedown(&ppgtt->base.mm);
ppgtt->base.cleanup(&ppgtt->base); ppgtt->base.cleanup(&ppgtt->base);
kfree(ppgtt); kfree(ppgtt);
...@@ -2833,8 +2838,9 @@ void i915_ggtt_cleanup_hw(struct drm_i915_private *dev_priv) ...@@ -2833,8 +2838,9 @@ void i915_ggtt_cleanup_hw(struct drm_i915_private *dev_priv)
if (drm_mm_initialized(&ggtt->base.mm)) { if (drm_mm_initialized(&ggtt->base.mm)) {
intel_vgt_deballoon(dev_priv); intel_vgt_deballoon(dev_priv);
drm_mm_takedown(&ggtt->base.mm); mutex_lock(&dev_priv->drm.struct_mutex);
list_del(&ggtt->base.global_link); i915_address_space_fini(&ggtt->base);
mutex_unlock(&dev_priv->drm.struct_mutex);
} }
ggtt->base.cleanup(&ggtt->base); ggtt->base.cleanup(&ggtt->base);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册