Commit 1f23475c authored by Matthew Auld's avatar Matthew Auld Committed by Chris Wilson

drm/i915: don't do allocate_va_range again on PIN_UPDATE

If a vma is already bound to a ppgtt, we incorrectly call
allocate_va_range again when doing a PIN_UPDATE, which will result in
over accounting within our paging structures, such that when we do
unbind something we don't actually destroy the structures and end up
inadvertently recycling them. In reality this probably isn't too bad,
but once we start touching PDEs and PDPEs for 64K/2M/1G pages this
apparent recycling will manifest into lots of really, really subtle
bugs.

v2: Fix the testing of vma->flags for aliasing_ppgtt_bind_vma

Fixes: ff685975 ("drm/i915: Move allocate_va_range to GTT")
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170512091423.26085-1-chris@chris-wilson.co.uk
parent 0d402a24
...@@ -193,9 +193,12 @@ static int ppgtt_bind_vma(struct i915_vma *vma, ...@@ -193,9 +193,12 @@ static int ppgtt_bind_vma(struct i915_vma *vma,
u32 pte_flags; u32 pte_flags;
int ret; int ret;
ret = vma->vm->allocate_va_range(vma->vm, vma->node.start, vma->size); if (!(vma->flags & I915_VMA_LOCAL_BIND)) {
if (ret) ret = vma->vm->allocate_va_range(vma->vm, vma->node.start,
return ret; vma->size);
if (ret)
return ret;
}
vma->pages = vma->obj->mm.pages; vma->pages = vma->obj->mm.pages;
...@@ -2304,7 +2307,8 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma, ...@@ -2304,7 +2307,8 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma,
if (flags & I915_VMA_LOCAL_BIND) { if (flags & I915_VMA_LOCAL_BIND) {
struct i915_hw_ppgtt *appgtt = i915->mm.aliasing_ppgtt; struct i915_hw_ppgtt *appgtt = i915->mm.aliasing_ppgtt;
if (appgtt->base.allocate_va_range) { if (!(vma->flags & I915_VMA_LOCAL_BIND) &&
appgtt->base.allocate_va_range) {
ret = appgtt->base.allocate_va_range(&appgtt->base, ret = appgtt->base.allocate_va_range(&appgtt->base,
vma->node.start, vma->node.start,
vma->node.size); vma->node.size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment