[Intel-xe] [PATCH] fixup! drm/xe: Memory allocations are tile-based, not GT-based

Matt Roper matthew.d.roper at intel.com
Tue Nov 28 18:35:48 UTC 2023


On Tue, Nov 28, 2023 at 09:55:59AM -0800, Brian Welty wrote:
> Fix a missed conversion of GT to tile in vma_is_valid().
> Best is to update the function to take a tile argument.
> 
> This bug causes page faults to not complete successfully from media
> engines and when the PTE had been invalidated prior.
> (Caught by igt at xe_exec_fault_mode and INVALIDATE tests.)
> 
> Signed-off-by: Brian Welty <brian.welty at intel.com>

Reviewed-by: Matt Roper <matthew.d.roper at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_gt_pagefault.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> index 03c1ab0ab0ca..1e083dda0679 100644
> --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> @@ -64,10 +64,10 @@ static bool access_is_atomic(enum access_type access_type)
>  	return access_type == ACCESS_TYPE_ATOMIC;
>  }
>  
> -static bool vma_is_valid(struct xe_gt *gt, struct xe_vma *vma)
> +static bool vma_is_valid(struct xe_tile *tile, struct xe_vma *vma)
>  {
> -	return BIT(gt_to_tile(gt)->id) & vma->tile_present &&
> -		!(BIT(gt->info.id) & vma->usm.tile_invalidated);
> +	return BIT(tile->id) & vma->tile_present &&
> +		!(BIT(tile->id) & vma->usm.tile_invalidated);
>  }
>  
>  static bool vma_matches(struct xe_vma *vma, u64 page_addr)
> @@ -169,7 +169,7 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
>  	atomic = access_is_atomic(pf->access_type);
>  
>  	/* Check if VMA is valid */
> -	if (vma_is_valid(gt, vma) && !atomic)
> +	if (vma_is_valid(tile, vma) && !atomic)
>  		goto unlock_vm;
>  
>  	/* TODO: Validate fault */
> @@ -215,7 +215,7 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
>  
>  	if (xe_vma_is_userptr(vma))
>  		ret = xe_vma_userptr_check_repin(vma);
> -	vma->usm.tile_invalidated &= ~BIT(gt_to_tile(gt)->id);
> +	vma->usm.tile_invalidated &= ~BIT(tile->id);
>  
>  unlock_dma_resv:
>  	drm_exec_fini(&exec);
> -- 
> 2.38.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list