]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: change to save bad pages in UMC error interrupt callback
authorDennis Li <Dennis.Li@amd.com>
Mon, 19 Oct 2020 06:19:57 +0000 (14:19 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Oct 2020 04:57:17 +0000 (00:57 -0400)
Instead of saving bad pages in amdgpu_ras_reset_gpu, it will reduce
the unnecessary calling of amdgpu_ras_save_bad_pages.

Signed-off-by: Dennis Li <Dennis.Li@amd.com>
Reviewed-by: Hawking Zhang <hawking.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c

index 4e36551ab50ba736e251bf6ba7c991f1b94ce726..95d6b34027ca9630040a4ed071174af857d98de9 100644 (file)
@@ -1668,7 +1668,7 @@ out:
  * write error record array to eeprom, the function should be
  * protected by recovery_lock
  */
-static int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev)
+int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev)
 {
        struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
        struct ras_err_handler_data *data;
@@ -1841,9 +1841,6 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev)
                data->last_reserved = i + 1;
                bo = NULL;
        }
-
-       /* continue to save bad pages to eeprom even reesrve_vram fails */
-       ret = amdgpu_ras_save_bad_pages(adev);
 out:
        mutex_unlock(&con->recovery_lock);
        return ret;
index 6b8d7bb83bb3c30c33962a5bbf19145c760e81f8..0926c0770d7ab7e921075df178ed09e9fd7e62df 100644 (file)
@@ -506,6 +506,7 @@ bool amdgpu_ras_check_err_threshold(struct amdgpu_device *adev);
 int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev,
                struct eeprom_table_record *bps, int pages);
 
+int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev);
 int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev);
 
 static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)
index 262baf0f61ea0a70c2c8e5b7e2913b3de9468f86..a2975c8092a919d96db119c4dae0365141e4f6b0 100644 (file)
@@ -126,10 +126,11 @@ int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev,
                                err_data->ue_count);
 
                if ((amdgpu_bad_page_threshold != 0) &&
-                       err_data->err_addr_cnt &&
+                       err_data->err_addr_cnt) {
                        amdgpu_ras_add_bad_pages(adev, err_data->err_addr,
-                                               err_data->err_addr_cnt))
-                       dev_warn(adev->dev, "Failed to add ras bad page!\n");
+                                               err_data->err_addr_cnt);
+                       amdgpu_ras_save_bad_pages(adev);
+               }
 
                amdgpu_ras_reset_gpu(adev);
        }