[PATCH] drm/amdkfd: Insert missing TLB flush on GFX10 and later

Lang Yu Lang.Yu at amd.com
Tue Sep 12 02:52:37 UTC 2023


On 09/11/ , Harish Kasiviswanathan wrote:
> Heavy-weight TLB flush is required after unmap on all GPUs for
> correctness and security.
> 
> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index b315311dfe2a..b9950074aee0 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -1466,8 +1466,7 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type);
>  
>  static inline bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev)
>  {
> -	return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) ||
> -	       KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
> +	return KFD_GC_VERSION(dev) > IP_VERSION(9, 4, 2) ||
>  	       (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) && dev->sdma_fw_version >= 18) ||
>  	       KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0);
>  }

1, If TLB_FLUSH_HEAVYWEIGHT is required after unmap on all GPUs
as described in commmit message, why we have this whitelist
instead of a blacklist?

2, kfd_flush_tlb(pdd, TLB_FLUSH_HEAVYWEIGHT) is also called
in svm_range_unmap_from_gpus(). Why not add this whitelist there?

Regards,
Lang

> -- 
> 2.34.1
> 


More information about the amd-gfx mailing list