OSDN Git Service

drm/amdgpu: Fix a race of IB test
authorxinhui pan <xinhui.pan@amd.com>
Sat, 11 Sep 2021 01:41:29 +0000 (09:41 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 14 Sep 2021 19:59:58 +0000 (15:59 -0400)
Direct IB submission should be exclusive. So use write lock.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

index 97d88f3..074ffcf 100644 (file)
@@ -1358,7 +1358,7 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
        }
 
        /* Avoid accidently unparking the sched thread during GPU reset */
-       r = down_read_killable(&adev->reset_sem);
+       r = down_write_killable(&adev->reset_sem);
        if (r)
                return r;
 
@@ -1387,7 +1387,7 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
                kthread_unpark(ring->sched.thread);
        }
 
-       up_read(&adev->reset_sem);
+       up_write(&adev->reset_sem);
 
        pm_runtime_mark_last_busy(dev->dev);
        pm_runtime_put_autosuspend(dev->dev);