[PATCH] drm/amdgpu: Fix kernel panic while gpu recovery

xinhui pan xinhui.pan at amd.com
Mon Apr 20 04:17:15 UTC 2020


Ras error occurs while gpu recovery. We can not add its list head
to two lists at same time.

Signed-off-by: xinhui pan <xinhui.pan at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 68b82f7b0b80..d753c38c3b1d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1449,20 +1449,16 @@ static void amdgpu_ras_do_recovery(struct work_struct *work)
 		container_of(work, struct amdgpu_ras, recovery_work);
 	struct amdgpu_device *remote_adev = NULL;
 	struct amdgpu_device *adev = ras->adev;
-	struct list_head device_list, *device_list_handle =  NULL;
 	struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev, false);
 
 	/* Build list of devices to query RAS related errors */
-	if  (hive && adev->gmc.xgmi.num_physical_nodes > 1)
-		device_list_handle = &hive->device_list;
-	else {
-		INIT_LIST_HEAD(&device_list);
-		list_add_tail(&adev->gmc.xgmi.head, &device_list);
-		device_list_handle = &device_list;
-	}
-
-	list_for_each_entry(remote_adev, device_list_handle, gmc.xgmi.head) {
-		amdgpu_ras_log_on_err_counter(remote_adev);
+	if  (hive && adev->gmc.xgmi.num_physical_nodes > 1) {
+		list_for_each_entry(remote_adev, &hive->device_list,
+				gmc.xgmi.head) {
+			amdgpu_ras_log_on_err_counter(remote_adev);
+		}
+	} else {
+		amdgpu_ras_log_on_err_counter(adev);
 	}
 
 	if (amdgpu_device_should_recover_gpu(ras->adev))
-- 
2.17.1



More information about the amd-gfx mailing list