diff mbox series

drm/i915/gtt: Relax assertion for pt_used

Message ID 20190821042044.7354-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/gtt: Relax assertion for pt_used | expand

Commit Message

Chris Wilson Aug. 21, 2019, 4:20 a.m. UTC
When inserting the final level PTE, we check that we are not overflowing
the page table (checking that pt_used does not exceed the size of the
table). However, we have to allow for every other PTE to be pinned by a
simultaneous removal thread (as on remove we bump the pt_used counter
before adjusting the table).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Mika Kuoppala Aug. 21, 2019, 6:22 a.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> When inserting the final level PTE, we check that we are not overflowing
> the page table (checking that pt_used does not exceed the size of the
> table). However, we have to allow for every other PTE to be pinned by a
> simultaneous removal thread (as on remove we bump the pt_used counter
> before adjusting the table).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 081c8b79c047..94712d3eb882 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1112,7 +1112,8 @@ static int __gen8_ppgtt_alloc(struct i915_address_space * const vm,
>  			    atomic_read(&pt->used));
>  
>  			atomic_add(count, &pt->used);
> -			GEM_BUG_ON(atomic_read(&pt->used) > I915_PDES);
> +			/* All other pdes may be simultaneously removed */
> +			GEM_BUG_ON(atomic_read(&pt->used) > 2 * I915_PDES);
>  			*start += count;
>  		}
>  	} while (idx++, --len);
> -- 
> 2.23.0.rc1
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 081c8b79c047..94712d3eb882 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1112,7 +1112,8 @@  static int __gen8_ppgtt_alloc(struct i915_address_space * const vm,
 			    atomic_read(&pt->used));
 
 			atomic_add(count, &pt->used);
-			GEM_BUG_ON(atomic_read(&pt->used) > I915_PDES);
+			/* All other pdes may be simultaneously removed */
+			GEM_BUG_ON(atomic_read(&pt->used) > 2 * I915_PDES);
 			*start += count;
 		}
 	} while (idx++, --len);