]> git.itanic.dy.fi Git - linux-stable/commitdiff
drm/amdkfd: reduce stack size in kfd_topology_add_device()
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 21 Sep 2023 14:32:09 +0000 (10:32 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Oct 2023 19:40:50 +0000 (15:40 -0400)
kfd_topology.c:2082:1: warning: the frame size of 1440 bytes is larger than 1024 bytes

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2866
Cc: Arnd Bergmann <arnd@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_topology.c

index c8c75ff7cea80d3ba77dd23d16e1cea9213cc8df..3f9f882d3f5cc557e446768856a947fd4857d76c 100644 (file)
@@ -1918,7 +1918,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
 {
        uint32_t gpu_id;
        struct kfd_topology_device *dev;
-       struct kfd_cu_info cu_info;
+       struct kfd_cu_info *cu_info;
        int res = 0;
        int i;
        const char *asic_name = amdgpu_asic_name[gpu->adev->asic_type];
@@ -1959,8 +1959,11 @@ int kfd_topology_add_device(struct kfd_node *gpu)
        /* Fill-in additional information that is not available in CRAT but
         * needed for the topology
         */
+       cu_info = kzalloc(sizeof(struct kfd_cu_info), GFP_KERNEL);
+       if (!cu_info)
+               return -ENOMEM;
 
-       amdgpu_amdkfd_get_cu_info(dev->gpu->adev, &cu_info);
+       amdgpu_amdkfd_get_cu_info(dev->gpu->adev, cu_info);
 
        for (i = 0; i < KFD_TOPOLOGY_PUBLIC_NAME_SIZE-1; i++) {
                dev->node_props.name[i] = __tolower(asic_name[i]);
@@ -1970,7 +1973,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
        dev->node_props.name[i] = '\0';
 
        dev->node_props.simd_arrays_per_engine =
-               cu_info.num_shader_arrays_per_engine;
+               cu_info->num_shader_arrays_per_engine;
 
        dev->node_props.gfx_target_version =
                                gpu->kfd->device_info.gfx_target_version;
@@ -2051,7 +2054,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
         */
        if (dev->gpu->adev->asic_type == CHIP_CARRIZO) {
                dev->node_props.simd_count =
-                       cu_info.simd_per_cu * cu_info.cu_active_number;
+                       cu_info->simd_per_cu * cu_info->cu_active_number;
                dev->node_props.max_waves_per_simd = 10;
        }
 
@@ -2078,6 +2081,8 @@ int kfd_topology_add_device(struct kfd_node *gpu)
 
        kfd_notify_gpu_change(gpu_id, 1);
 
+       kfree(cu_info);
+
        return 0;
 }