[PATCH] drm/xe/vram: fix lpfn check

Matthew Brost matthew.brost at intel.com
Tue Nov 19 14:34:02 UTC 2024


On Tue, Nov 19, 2024 at 10:19:27AM +0000, Matthew Auld wrote:
> Technically we should check the lfpn value and not the place->lpfn, for
> the case where the allocation itself could be as large as the entire
> region and not be range based, which might result in incorrectly doing a
> power-of-two roundup. The allocator itself will already ensure it's
> contiguous underneath for such an allocation. This shouldn't fix any
> current usecase, but never the less came up from some internal testing.
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Piotr Piórkowski <piotr.piorkowski at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> index 1d39a8c53b3a..c95728c45ea4 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> @@ -109,7 +109,7 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man,
>  		goto error_unlock;
>  	}
>  
> -	if (place->fpfn + (size >> PAGE_SHIFT) != place->lpfn &&
> +	if (place->fpfn + (size >> PAGE_SHIFT) != lpfn &&
>  	    place->flags & TTM_PL_FLAG_CONTIGUOUS) {
>  		size = roundup_pow_of_two(size);
>  		min_page_size = size;
> -- 
> 2.47.0
> 


More information about the Intel-xe mailing list