diff mbox series

drm/i915/gtt: Don't try to clear failed empty pd allocation

Message ID 20190719153322.10464-1-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/gtt: Don't try to clear failed empty pd allocation | expand

Commit Message

Michal Wajdeczko July 19, 2019, 3:33 p.m. UTC
When __gen8_ppgtt_alloc fails without allocating anything
we should not try to call __gen8_ppgtt_clear as there is
nothing to clear and underlying code will complain with:

[  157.861645] gen8_pd_range:881 GEM_BUG_ON(start >= end)

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chris Wilson July 19, 2019, 3:39 p.m. UTC | #1
Quoting Michal Wajdeczko (2019-07-19 16:33:22)
> When __gen8_ppgtt_alloc fails without allocating anything
> we should not try to call __gen8_ppgtt_clear as there is
> nothing to clear and underlying code will complain with:
> 
> [  157.861645] gen8_pd_range:881 GEM_BUG_ON(start >= end)
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 220aba5a94d2..5e753e075047 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1115,7 +1115,7 @@ static int gen8_ppgtt_alloc(struct i915_address_space *vm,
>  
>         err = __gen8_ppgtt_alloc(vm, i915_vm_to_ppgtt(vm)->pd,
>                                  &start, start + length, vm->top);
> -       if (unlikely(err))
> +       if (unlikely(err && from != start))
>                 __gen8_ppgtt_clear(vm, i915_vm_to_ppgtt(vm)->pd,
>                                    from, start, vm->top);

Ugh. Everyone's favourite error today.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 220aba5a94d2..5e753e075047 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1115,7 +1115,7 @@  static int gen8_ppgtt_alloc(struct i915_address_space *vm,
 
 	err = __gen8_ppgtt_alloc(vm, i915_vm_to_ppgtt(vm)->pd,
 				 &start, start + length, vm->top);
-	if (unlikely(err))
+	if (unlikely(err && from != start))
 		__gen8_ppgtt_clear(vm, i915_vm_to_ppgtt(vm)->pd,
 				   from, start, vm->top);