[PATCH v4] drm/amdkfd: Fix the warning of array-index-out-of-bounds

Felix Kuehling felix.kuehling at amd.com
Tue Nov 1 19:38:48 UTC 2022


On 2022-11-01 04:52, Ma Jun wrote:
> For some GPUs with more CUs, the original sibling_map[32]
>
> in struct crat_subtype_cache is not enough
>
> to save the cache information when create the VCRAT table,
>
> so skip filling the struct crat_subtype_cache info instead
>
> fill struct kfd_cache_properties directly to fix this problem.
>
> v4:
> - Fix the bug when get cache info
> v3:
> - Drop processor id calc function
> v2:
> - Remove unnecessary sys interface "cache_ext"
>
> Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>

One more small comment inline. With that fixed, the patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_crat.c     | 312 +++-------------------
>   drivers/gpu/drm/amd/amdkfd/kfd_crat.h     |  12 +
>   drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 245 ++++++++++++++++-
>   drivers/gpu/drm/amd/amdkfd/kfd_topology.h |   5 +-
>   4 files changed, 282 insertions(+), 292 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> index 3c7f0d49da59..f4a9d0e49072 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
[snip]
>   
> -/* kfd_fill_gpu_cache_info - Fill GPU cache info using kfd_gpu_cache_info
> - * tables
> - *
> - *	@kdev - [IN] GPU device
> - *	@gpu_processor_id - [IN] GPU processor ID to which these caches
> - *			    associate
> - *	@available_size - [IN] Amount of memory available in pcache
> - *	@cu_info - [IN] Compute Unit info obtained from KGD
> - *	@pcache - [OUT] memory into which cache data is to be filled in.
> - *	@size_filled - [OUT] amount of data used up in pcache.
> - *	@num_of_entries - [OUT] number of caches added
> - */
> -static int kfd_fill_gpu_cache_info(struct kfd_dev *kdev,
> -			int gpu_processor_id,
> -			int available_size,
> -			struct kfd_cu_info *cu_info,
> -			struct crat_subtype_cache *pcache,
> -			int *size_filled,
> -			int *num_of_entries)
> +int get_gpu_cache_info(struct kfd_dev *kdev, struct kfd_gpu_cache_info **pcache_info)

This function name should have a kfd_ prefix.

Regards,
   Felix




More information about the amd-gfx mailing list