Skip to content

Commit 798f21e

Browse files
alexdeuchergregkh
authored andcommitted
drm/amdkfd: reduce stack size in kfd_topology_add_device()
[ Upstream commit 4ff91f2 ] 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 <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Christian König <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Stable-dep-of: 438b39a ("drm/amdkfd: pause autosuspend when creating pdd") Signed-off-by: Sasha Levin <[email protected]>
1 parent 8406848 commit 798f21e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_topology.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
19221922
{
19231923
uint32_t gpu_id;
19241924
struct kfd_topology_device *dev;
1925-
struct kfd_cu_info cu_info;
1925+
struct kfd_cu_info *cu_info;
19261926
int res = 0;
19271927
int i;
19281928
const char *asic_name = amdgpu_asic_name[gpu->adev->asic_type];
@@ -1963,8 +1963,11 @@ int kfd_topology_add_device(struct kfd_node *gpu)
19631963
/* Fill-in additional information that is not available in CRAT but
19641964
* needed for the topology
19651965
*/
1966+
cu_info = kzalloc(sizeof(struct kfd_cu_info), GFP_KERNEL);
1967+
if (!cu_info)
1968+
return -ENOMEM;
19661969

1967-
amdgpu_amdkfd_get_cu_info(dev->gpu->adev, &cu_info);
1970+
amdgpu_amdkfd_get_cu_info(dev->gpu->adev, cu_info);
19681971

19691972
for (i = 0; i < KFD_TOPOLOGY_PUBLIC_NAME_SIZE-1; i++) {
19701973
dev->node_props.name[i] = __tolower(asic_name[i]);
@@ -1974,7 +1977,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
19741977
dev->node_props.name[i] = '\0';
19751978

19761979
dev->node_props.simd_arrays_per_engine =
1977-
cu_info.num_shader_arrays_per_engine;
1980+
cu_info->num_shader_arrays_per_engine;
19781981

19791982
dev->node_props.gfx_target_version =
19801983
gpu->kfd->device_info.gfx_target_version;
@@ -2055,7 +2058,7 @@ int kfd_topology_add_device(struct kfd_node *gpu)
20552058
*/
20562059
if (dev->gpu->adev->asic_type == CHIP_CARRIZO) {
20572060
dev->node_props.simd_count =
2058-
cu_info.simd_per_cu * cu_info.cu_active_number;
2061+
cu_info->simd_per_cu * cu_info->cu_active_number;
20592062
dev->node_props.max_waves_per_simd = 10;
20602063
}
20612064

@@ -2082,6 +2085,8 @@ int kfd_topology_add_device(struct kfd_node *gpu)
20822085

20832086
kfd_notify_gpu_change(gpu_id, 1);
20842087

2088+
kfree(cu_info);
2089+
20852090
return 0;
20862091
}
20872092

0 commit comments

Comments
 (0)