diff mbox

drm/i915/gtt: Fix unwind length passed to gen6_ppgtt_clear_range

Message ID 20180608173221.10455-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson June 8, 2018, 5:32 p.m. UTC
When we want to unwind an error when allocating the PD for gen6, we call
gen6_ppgtt_clear_range() telling to clear upto the PD we've previously
cleared. However, we passed it the incorrect length, passing it the
endpoint instead. Fortunately, as the start was always 0, this has no
impact today, but tomorrow we want to start using non-zero origins.

Reported-by: Matthew Auld <matthew.william.auld@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthew Auld June 8, 2018, 5:54 p.m. UTC | #1
On 8 June 2018 at 18:32, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> When we want to unwind an error when allocating the PD for gen6, we call
> gen6_ppgtt_clear_range() telling to clear upto the PD we've previously
> cleared. However, we passed it the incorrect length, passing it the
> endpoint instead. Fortunately, as the start was always 0, this has no
> impact today, but tomorrow we want to start using non-zero origins.
>
> Reported-by: Matthew Auld <matthew.william.auld@gmail.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
Chris Wilson June 8, 2018, 6:31 p.m. UTC | #2
Quoting Matthew Auld (2018-06-08 18:54:15)
> On 8 June 2018 at 18:32, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > When we want to unwind an error when allocating the PD for gen6, we call
> > gen6_ppgtt_clear_range() telling to clear upto the PD we've previously
> > cleared. However, we passed it the incorrect length, passing it the
> > endpoint instead. Fortunately, as the start was always 0, this has no
> > impact today, but tomorrow we want to start using non-zero origins.
> >
> > Reported-by: Matthew Auld <matthew.william.auld@gmail.com>
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>

It was a good catch. Pushed with thanks,
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 6ac6520b6e9c..ddd8a16d0246 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1931,7 +1931,7 @@  static int gen6_alloc_va_range(struct i915_address_space *vm,
 	return 0;
 
 unwind_out:
-	gen6_ppgtt_clear_range(vm, from, start);
+	gen6_ppgtt_clear_range(vm, from, start - from);
 	return -ENOMEM;
 }