Skip to contentSkip to conversation

drm/amdgpu: enable fence interrupts before KFD init

PATCH In review William WOJCIECHOWSKI 2 participants 2 messages Nov 6 – Nov 11

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

PATCH 1/1 drm/amdgpu: enable fence interrupts before KFD init

On Navi 1x, GART TLB flushes go through SDMA once the buffer funcs are enabled, and amdgpu_gmc_flush_gpu_tlb() waits for the job to finish. KFD init does two GART allocations, so it waits twice, but the fence interrupts are only enabled after amdgpu_device_ip_init() returns. Both waits end on the fallback timer:

amdgpu 0000:0c:00.0: Fence fallback timer expired on ring sdma0

That's about 1 s lost on every boot.

Enable the fence interrupts right after the buffer funcs, before KFD init, like amdgpu_device_ip_resume() already does.

---

Notes:
Tested on an RX 5700 XT (Navi 10) with Debian's 7.2.12 and 7.2.15
kernels: both messages are gone and the probe is about 1 s faster.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -2
index 4b0e282b2..ce979a1bb 100644
@@ -2545,6 +2545,11 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
 	if (amdgpu_ip_member_of_hwini(adev, AMD_IP_BLOCK_TYPE_SDMA))
 		amdgpu_ttm_enable_buffer_funcs(adev);
 
+	/* KFD init flushes the GART TLB through SDMA on Navi 1x and waits
+	 * for it, so the fence interrupts must already be enabled.
+	 */
+	amdgpu_fence_driver_hw_init(adev);
+
 	/* Don't init kfd if whole hive need to be reset during init */
 	if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) {
 		amdgpu_amdkfd_device_init(adev);
@@ -4135,8 +4140,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		goto release_ras_con;
 	}
 
-	amdgpu_fence_driver_hw_init(adev);
-
 	dev_info(adev->dev,
 		"SE %d, SH per SE %d, CU per SH %d, active_cu_number %d\n",
 			adev->gfx.config.max_shader_engines,
Signature · 1 line
2.55.0
#1 lore raw

Reviewed and applied. Thanks!

Alex

Quoted 51 lines · William WOJCIECHOWSKI

On Navi 1x, GART TLB flushes go through SDMA once the buffer funcs are enabled, and amdgpu_gmc_flush_gpu_tlb() waits for the job to finish. KFD init does two GART allocations, so it waits twice, but the fence interrupts are only enabled after amdgpu_device_ip_init() returns. Both waits end on the fallback timer:

amdgpu 0000:0c:00.0: Fence fallback timer expired on ring sdma0

That's about 1 s lost on every boot.

Enable the fence interrupts right after the buffer funcs, before KFD init, like amdgpu_device_ip_resume() already does.

---

Notes:
Tested on an RX 5700 XT (Navi 10) with Debian's 7.2.12 and 7.2.15
kernels: both messages are gone and the probe is about 1 s faster.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -3
index 4b0e282b2..ce979a1bb 100644
@@ -2545,6 +2545,11 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
        if (amdgpu_ip_member_of_hwini(adev, AMD_IP_BLOCK_TYPE_SDMA))
                amdgpu_ttm_enable_buffer_funcs(adev);
 
+       /* KFD init flushes the GART TLB through SDMA on Navi 1x and waits
+        * for it, so the fence interrupts must already be enabled.
+        */
+       amdgpu_fence_driver_hw_init(adev);
+
        /* Don't init kfd if whole hive need to be reset during init */
        if (adev->init_lvl->level != AMDGPU_INIT_LEVEL_MINIMAL_XGMI) {
                amdgpu_amdkfd_device_init(adev);
@@ -4135,8 +4140,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                goto release_ras_con;
        }
 
-       amdgpu_fence_driver_hw_init(adev);
-
        dev_info(adev->dev,
                "SE %d, SH per SE %d, CU per SH %d, active_cu_number %d\n",
                        adev->gfx.config.max_shader_engines,
--

2.55.0