Re: [PATCH 06/15] drm/i915: align 64K objects to 2M

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 31, 2017 at 07:52:01PM +0100, Matthew Auld wrote:
> We can't mix 64K and 4K pte's in the same page-table, so for now we
> align 64K objects to 2M to avoid any potential mixing. This is
> potentially wasteful but in reality shouldn't be too bad since this only
> applies to the virtual address space of a 48b PPGTT.
> 
> Suggested-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
> Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_vma.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index c355ccb01872..af950d92fa13 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -479,6 +479,15 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
>  			goto err_unpin;
>  		}
>  
> +		/* A current limitation in our implementation is that 64K
> +		 * objects must be aligned to 2M, and given that we can't
> +		 * enforce this for soft pinning, we need to fallback to normal
> +		 * pages if don't meet this restriction.
> +		 */
> +		if (obj->mm.page_sizes.sg == I915_GTT_PAGE_SIZE_64K &&

page_sizes.sg > I915_GTT_PAGE_SIZE_4K.

> +		    !IS_ALIGNED(offset | size, I915_GTT_PAGE_SIZE_2M))

Abusing the semantics of PAGE_SIZE_2M. It just happens to be the value
you want, but it doesn't mean what you say.

> +			obj->mm.page_sizes.sg = I915_GTT_PAGE_SIZE;
> +
>  		ret = i915_gem_gtt_reserve(vma->vm, &vma->node,
>  					   size, offset, obj->cache_level,
>  					   flags);
> @@ -493,6 +502,15 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
>  			if (!is_power_of_2(page_alignment))
>  				page_alignment = BIT(fls64(page_alignment)-1);
>  
> +			/* We can't mix 64K and 4K pte's in the same page-table (2M
> +			 * block), and so to avoid the ugliness and complexity of
> +			 * coloring we opt for just aligning 64K objects to 2M.
> +			 */
> +			if (obj->mm.page_sizes.sg == I915_GTT_PAGE_SIZE_64K) {

page_sizes.sg & SIZE_64K or page_sizes.sg > SIZE_4K

Also refer to earlier discussion that this should be vma->page_sizes
here not obj.

> +				page_alignment = I915_GTT_PAGE_SIZE_2M;
> +				size = roundup(size, page_alignment);

round_up.

> +			}
> +
>  			alignment = max_t(typeof(alignment), alignment,
>  					  page_alignment);
>  		}
> -- 
> 2.9.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux