]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/amdgpu: move drain_workqueue before shutdown is set
authorVictor Zhao <Victor.Zhao@amd.com>
Sun, 25 Aug 2024 16:14:26 +0000 (00:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 29 Aug 2024 17:39:07 +0000 (13:39 -0400)
[background] when unloading amdgpu driver right after running a
workload, drain_workqueue is causing "Fence fallback timer
expired on ring sdma0.0". Under sriov, this issue will cause sriov
full access timeout and a reset happening.

move drain_workqueue before shutdown is set to allow ih process and
before enter full access under sriov to avoid full access time cost.

Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 45edf99ae7ec856294a6d3a369512f6a89d29e41..f4628412dac44b4dcf8ff3a29ae2b6fe01dd1548 100644 (file)
@@ -4531,6 +4531,9 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
 {
        dev_info(adev->dev, "amdgpu: finishing device.\n");
        flush_delayed_work(&adev->delayed_init_work);
+
+       if (adev->mman.initialized)
+               drain_workqueue(adev->mman.bdev.wq);
        adev->shutdown = true;
 
        /* make sure IB test finished before entering exclusive mode
@@ -4551,9 +4554,6 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
        }
        amdgpu_fence_driver_hw_fini(adev);
 
-       if (adev->mman.initialized)
-               drain_workqueue(adev->mman.bdev.wq);
-
        if (adev->pm.sysfs_initialized)
                amdgpu_pm_sysfs_fini(adev);
        if (adev->ucode_sysfs_en)