[PATCH] drm/xe/sa: Drop hardcoded 4K guard in sub-allocator

Matthew Brost matthew.brost at intel.com
Tue Dec 17 22:39:44 UTC 2024


On Tue, Dec 17, 2024 at 11:22:46PM +0100, Michal Wajdeczko wrote:
> Any required prefetch guards are added during batch buffer
> allocations anyway.
> 

This should work but I think we actually want to do the opposite of
this - drop the prefetch pad in BB allocation. This would enable a more
optimial usage of each suballocation. I think that would work unless we
have an odd caching issue - if caching is a problem then maybe the BB is
a cacheline.

I haven't had time to try to out yet but I think we explore the above
option first. If I'm missing something and the above does not work, then
agree with this patch.

Matt

> Suggested-by: Matthew Brost <matthew.brost at intel.com>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_sa.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
> index e055bed7ae55..2f69277b1a50 100644
> --- a/drivers/gpu/drm/xe/xe_sa.c
> +++ b/drivers/gpu/drm/xe/xe_sa.c
> @@ -34,7 +34,6 @@ static void xe_sa_bo_manager_fini(struct drm_device *drm, void *arg)
>  struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32 align)
>  {
>  	struct xe_device *xe = tile_to_xe(tile);
> -	u32 managed_size = size - SZ_4K;
>  	struct xe_bo *bo;
>  	int ret;
>  
> @@ -58,11 +57,11 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
>  	sa_manager->bo = bo;
>  	sa_manager->is_iomem = bo->vmap.is_iomem;
>  
> -	drm_suballoc_manager_init(&sa_manager->base, managed_size, align);
> +	drm_suballoc_manager_init(&sa_manager->base, size, align);
>  	sa_manager->gpu_addr = xe_bo_ggtt_addr(bo);
>  
>  	if (bo->vmap.is_iomem) {
> -		sa_manager->cpu_ptr = kvzalloc(managed_size, GFP_KERNEL);
> +		sa_manager->cpu_ptr = kvzalloc(size, GFP_KERNEL);
>  		if (!sa_manager->cpu_ptr) {
>  			sa_manager->bo = NULL;
>  			return ERR_PTR(-ENOMEM);
> -- 
> 2.47.1
> 


More information about the Intel-xe mailing list