Skip to contentSkip to conversation

drm/amdkfd: fix partition query when setting up recommended sdma engines

PATCH In review Jonathan Kim 2 participants 2 messages Aug 8, 2024 – Aug 9, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: fix partition query when setting up recommended sdma engines

When users dynamically set the partition mode through sysfs writes, this can lead to a double lock situation where the KFD is trying to take the partition lock when updating the recommended SDMA engines. Have the KFD reference its saved socket device number count instead. Also ensure we have enough SDMA xGMI engines report the recommended engines in the first place.

v2: fixups in description

Fixes a0f548d7871e ("drm/amdkfd: allow users to target recommended SDMA engines")
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +2 -3
index 40771f8752cb..27d452e50ca9 100644
@@ -1286,9 +1286,8 @@ static void kfd_set_recommended_sdma_engines(struct kfd_topology_device *to_dev,
 	struct amdgpu_device *adev = gpu->adev;
 	int num_xgmi_nodes = adev->gmc.xgmi.num_physical_nodes;
 	bool support_rec_eng = !amdgpu_sriov_vf(adev) && to_dev->gpu &&
-		adev->aid_mask && num_xgmi_nodes &&
-		(amdgpu_xcp_query_partition_mode(adev->xcp_mgr, AMDGPU_XCP_FL_NONE) ==
-		      AMDGPU_SPX_PARTITION_MODE) &&
+		adev->aid_mask && num_xgmi_nodes && gpu->kfd->num_nodes == 1 &&
+		kfd_get_num_xgmi_sdma_engines(gpu) >= 14 &&
 		(!(adev->flags & AMD_IS_APU) && num_xgmi_nodes == 8);
 
 	if (support_rec_eng) {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

[Public]

Thanks,
Lijo
-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Thursday, August 8, 2024 9:39 PM
To: [email protected]
Cc: Lazar, Lijo <[email protected]>; Kuehling, Felix <[email protected]>; Kim, Jonathan <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH] drm/amdkfd: fix partition query when setting up recommended sdma engines

When users dynamically set the partition mode through sysfs writes, this can lead to a double lock situation where the KFD is trying to take the partition lock when updating the recommended SDMA engines. Have the KFD reference its saved socket device number count instead.
Also ensure we have enough SDMA xGMI engines report the recommended engines in the first place.

v2: fixups in description

Fixes a0f548d7871e ("drm/amdkfd: allow users to target recommended SDMA engines")
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +2 -3
index 40771f8752cb..27d452e50ca9 100644
@@ -1286,9 +1286,8 @@ static void kfd_set_recommended_sdma_engines(struct kfd_topology_device *to_dev,
        struct amdgpu_device *adev = gpu->adev;
        int num_xgmi_nodes = adev->gmc.xgmi.num_physical_nodes;
        bool support_rec_eng = !amdgpu_sriov_vf(adev) && to_dev->gpu &&
-               adev->aid_mask && num_xgmi_nodes &&
-               (amdgpu_xcp_query_partition_mode(adev->xcp_mgr, AMDGPU_XCP_FL_NONE) ==
-                     AMDGPU_SPX_PARTITION_MODE) &&
+               adev->aid_mask && num_xgmi_nodes && gpu->kfd->num_nodes == 1 &&
+               kfd_get_num_xgmi_sdma_engines(gpu) >= 14 &&
                (!(adev->flags & AMD_IS_APU) && num_xgmi_nodes == 8);
 
        if (support_rec_eng) {

--
2.34.1