drm/amdgpu: recreate retired page's bo if vram get lost in gpu reset
Subsystems (2)
PATCH 1/3 drm/amdgpu: recreate retired page's bo if vram get lost in gpu reset
the info of retired page's bo may be lost if vram lost is encountered in gpu reset (gpu page table in vram may be lost), force to recreate all bos
v2: simplify NULL pointer check
add more comments
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 48 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + 3 files changed, 50 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -3675,6 +3675,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive,if (vram_lost) {DRM_INFO ("VRAM is lost due to GPU reset!\n" );amdgpu_inc_vram_lost (tmp_adev); +amdgpu_ras_recovery_reset (tmp_adev); } r = amdgpu_gtt_mgr_recover(
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +48 -0
54 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
@@ -479,6 +479,7 @@ static inline int amdgpu_ras_is_supported(struct amdgpu_device *adev, }int amdgpu_ras_recovery_init (struct amdgpu_device *adev); +void amdgpu_ras_recovery_reset (struct amdgpu_device *adev);int amdgpu_ras_request_reset_on_boot (struct amdgpu_device *adev,unsigned int block);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/3 drm/amdgpu: initialize ras bad page bo array to NULL
guarantee bo pointers in bad page bo array are NULL after allocation
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -1
@@ -1310,7 +1310,7 @@ static int amdgpu_ras_realloc_eh_data_space(struct amdgpu_device *adev,unsigned int align_space =ALIGN (new_space,512 );void *bps =kmalloc (align_space *sizeof (*data->bps),GFP_KERNEL );struct amdgpu_bo **bps_bo = -kmalloc (align_space *sizeof (*data->bps_bo),GFP_KERNEL ); +kzalloc (align_space *sizeof (*data->bps_bo),GFP_KERNEL );if (!bps || !bps_bo) {kfree (bps);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu: reuse code of ras bad page's bo create
In reply to a message not in the archiveimplement ras_create_bad_pages_bo to simplify ras code
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 72 +++++++++++-------------- 1 file changed, 31 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +31 -41
@@ -1430,41 +1430,53 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev)return ret; } -/* called in gpu recovery/init */ -int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev) +static void amdgpu_ras_create_bad_pages_bo (struct amdgpu_device *adev) { +/* Note: the caller should guarantee con and data are not NULL */ struct amdgpu_ras *con =amdgpu_ras_get_context (adev); -struct ras_err_handler_data *data; +struct ras_err_handler_data *data = con->eh_data;uint64_t bp; -struct amdgpu_bo *bo =NULL ; -int i, ret =0 ; - -if (!con || !con->eh_data) -return 0 ; +struct amdgpu_bo *bo; +int i; -mutex_lock (&con->recovery_lock); - data = con->eh_data; -if (!data) - goto out; -/* reserve vram at driver post stage. */ for (i = data->last_reserved; i < data->count; i++) { + bo =NULL ; bp = data->bps[i].retired_page; -/* There are two cases of reserve error should be ignored: +/* There are three cases of reserve error should be ignored: * 1) a ras bad page has been allocated (used by someone); * 2) a ras bad page has been reserved (duplicate error injection * for one page); +* 3) bo info isn't lost in gpu reset */ if (amdgpu_bo_create_kernel_at (adev, bp <<AMDGPU_GPU_PAGE_SHIFT ,AMDGPU_GPU_PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , &bo,NULL )) -DRM_WARN ("RAS WARN: reserve vram for retired page %llx fail\n" , bp); - - data->bps_bo[i] = bo; +DRM_NOTE ("RAS NOTE: reserve vram for retired page 0x%llx fail\n" , bp); +else + data->bps_bo[i] = bo; data->last_reserved = i +1 ; - bo =NULL ; } +} + +/* called in gpu recovery/init */ +int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev) +{ +struct amdgpu_ras *con =amdgpu_ras_get_context (adev); +struct ras_err_handler_data *data; +int ret =0 ; + +if (!con || !con->eh_data) +return 0 ; + +mutex_lock (&con->recovery_lock); + data = con->eh_data; +if (!data) + goto out; + +/* reserve vram at driver post stage. */ +amdgpu_ras_create_bad_pages_bo (adev);/* continue to save bad pages to eeprom even reesrve_vram fails */ ret =amdgpu_ras_save_bad_pages (adev);
@@ -1583,9 +1595,6 @@ void amdgpu_ras_recovery_reset(struct amdgpu_device *adev) {struct amdgpu_ras *con =amdgpu_ras_get_context (adev);struct ras_err_handler_data *data; -uint64_t bp; -struct amdgpu_bo *bo =NULL ; -int i;if (!con || !con->eh_data)return ;
@@ -1600,26 +1609,7 @@ void amdgpu_ras_recovery_reset(struct amdgpu_device *adev) data = con->eh_data;/* force to reserve all retired page again */ data->last_reserved =0 ; - -for (i = data->last_reserved; i < data->count; i++) { - bp = data->bps[i].retired_page; - -/* There are three cases of reserve error should be ignored: -* 1) a ras bad page has been allocated (used by someone); -* 2) a ras bad page has been reserved (duplicate error injection -* for one page); -* 3) bo info isn't lost in gpu reset -*/ -if (amdgpu_bo_create_kernel_at (adev, bp <<AMDGPU_GPU_PAGE_SHIFT , -AMDGPU_GPU_PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM , - &bo,NULL )) -DRM_NOTE ("RAS NOTE: recreate bo for retired page 0x%llx fail\n" , bp); -else - data->bps_bo[i] = bo; - data->last_reserved = i +1 ; - bo =NULL ; - } +amdgpu_ras_create_bad_pages_bo (adev); }/* recovery end */
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo create
Regards,
Guchun
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Monday, September 30, 2019 11:20 AM
To: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo create
implement ras_create_bad_pages_bo to simplify ras code
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 72 +++++++++++-------------- 1 file changed, 31 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +11 -17
@@ -1430,41 +1430,53 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev)return ret; } -/* called in gpu recovery/init */ -int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev) +static void amdgpu_ras_create_bad_pages_bo (struct amdgpu_device *adev) { +/* Note: the caller should guarantee con and data are not NULL */ struct amdgpu_ras *con =amdgpu_ras_get_context (adev); -struct ras_err_handler_data *data; +struct ras_err_handler_data *data = con->eh_data;uint64_t bp; -struct amdgpu_bo *bo =NULL ; -int i, ret =0 ; - -if (!con || !con->eh_data) -return 0 ; +struct amdgpu_bo *bo; +int i; -mutex_lock (&con->recovery_lock); - data = con->eh_data; -if (!data) - goto out; -/* reserve vram at driver post stage. */ for (i = data->last_reserved; i < data->count; i++) { + bo =NULL ; bp = data->bps[i].retired_page; -/* There are two cases of reserve error should be ignored: +/* There are three cases of reserve error should be ignored: * 1) a ras bad page has been allocated (used by someone); * 2) a ras bad page has been reserved (duplicate error injection * for one page); +* 3) bo info isn't lost in gpu reset */ if (amdgpu_bo_create_kernel_at (adev, bp <<AMDGPU_GPU_PAGE_SHIFT ,AMDGPU_GPU_PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , &bo,NULL )) -DRM_WARN ("RAS WARN: reserve vram for retired page %llx fail\n" , bp); - - data->bps_bo[i] = bo; +DRM_NOTE ("RAS NOTE: reserve vram for retired page 0x%llx fail\n" , bp); +else + data->bps_bo[i] = bo;
[Guchun]The "else" should not needed? Otherwise, if amdgpu_bo_create_kernel_at always succeeds, we don't catch a chance to update bps_bo. Is that true?
data->last_reserved = i + 1;
- bo = NULL;
}
+}
+
+/* called in gpu recovery/init */
+int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) {
+ struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+ struct ras_err_handler_data *data;
+ int ret = 0;
+
+ if (!con || !con->eh_data)
+ return 0;
+
+ mutex_lock(&con->recovery_lock);
+ data = con->eh_data;
+ if (!data)
+ goto out;
+
+ /* reserve vram at driver post stage. */
+ amdgpu_ras_create_bad_pages_bo(adev);
/* continue to save bad pages to eeprom even reesrve_vram fails */
ret = amdgpu_ras_save_bad_pages(adev); @@ -1583,9 +1595,6 @@ void amdgpu_ras_recovery_reset(struct amdgpu_device *adev) { struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
struct ras_err_handler_data *data;
- uint64_t bp;
- struct amdgpu_bo *bo = NULL;
- int i;
if (!con || !con->eh_data)
return;
@@ -1600,26 +1609,7 @@ void amdgpu_ras_recovery_reset(struct amdgpu_device *adev)
data = con->eh_data;
/* force to reserve all retired page again */ data->last_reserved = 0;
-
- for (i = data->last_reserved; i < data->count; i++) {
- bp = data->bps[i].retired_page;
-
- /* There are three cases of reserve error should be ignored:
- * 1) a ras bad page has been allocated (used by someone);
- * 2) a ras bad page has been reserved (duplicate error injection
- * for one page);
- * 3) bo info isn't lost in gpu reset
- */
- if (amdgpu_bo_create_kernel_at(adev, bp << AMDGPU_GPU_PAGE_SHIFT,
- AMDGPU_GPU_PAGE_SIZE, - AMDGPU_GEM_DOMAIN_VRAM, - &bo, NULL))
- DRM_NOTE("RAS NOTE: recreate bo for retired page 0x%llx fail\n", bp);
- else
- data->bps_bo[i] = bo;
- data->last_reserved = i + 1;
- bo = NULL;
- }
+ amdgpu_ras_create_bad_pages_bo(adev);
}
/* recovery end */
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BYAPR12MB280665193C9A39222B345279F1820-ZGDeBxoHBPk0CuAkIMgl3QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
RE: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo create
Quoted 88 lines
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: 2019年9月30日 11:26
To: Zhou1, Tao <[email protected]>; [email protected]; Grodzovsky, Andrey <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo createRegards,
Guchun-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Monday, September 30, 2019 11:20 AM
To: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo createimplement
ras_create_bad_pages_boto simplify ras codeSigned-off-by Tao Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 72 +++++++++++-------------- 1 file changed, 31 insertions(+), 41 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +7
-14@@ -1430,41 +1430,53 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev)return ret; } -/* called in gpu recovery/init */ -int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev) +static void amdgpu_ras_create_bad_pages_bo (struct amdgpu_device *adev) { +/* Note: the caller should guarantee con and data are not NULL */ struct amdgpu_ras *con =amdgpu_ras_get_context (adev); -struct ras_err_handler_data *data; +struct ras_err_handler_data *data = con->eh_data;uint64_t bp; -struct amdgpu_bo *bo =NULL ; -int i, ret =0 ; - -if (!con || !con->eh_data) -return 0 ; +struct amdgpu_bo *bo; +int i; -mutex_lock (&con->recovery_lock); - data = con->eh_data; -if (!data) - goto out; -/* reserve vram at driver post stage. */ for (i = data->last_reserved; i < data->count; i++) { + bo =NULL ; bp = data->bps[i].retired_page; -/* There are two cases of reserve error should be ignored: +/* There are three cases of reserve error should be ignored: * 1) a ras bad page has been allocated (used by someone); * 2) a ras bad page has been reserved (duplicate error injection
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-0* for one page); +* 3) bo info isn't lost in gpu reset */ if (amdgpu_bo_create_kernel_at(adev, bp <<
AMDGPU_GPU_PAGE_SHIFT,drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-1AMDGPU_GPU_PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , &bo, NULL)) - DRM_WARN("RAS WARN: reserve vram for retiredpage %llx fail\n", bp);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-2- - data->bps_bo[i] = bo; + DRM_NOTE("RAS NOTE: reserve vram for retiredpage 0x%llx fail\n", bp);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0+else + data->bps_bo[i] = bo;
Quoted 4 lines
[Guchun]The "else" should not needed? Otherwise, if
amdgpu_bo_create_kernel_atalways succeeds, we don't catch a chance to updatebps_bo.
Is that true?
[Tao] It's intentional. There is only a DRM_NOTE if amdgpu_bo_create_kernel_at fails (the parameter bo is NULL under this condition), and bps_bo contains previous value (or NULL). We update bps_bo only if amdgpu_bo_create_kernel_at succeeds.
Quoted 66 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +18
-1data->last_reserved = i +1 ; - bo =NULL ; } +} + +/* called in gpu recovery/init */ +int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev) { +struct amdgpu_ras *con =amdgpu_ras_get_context (adev); +struct ras_err_handler_data *data; +int ret =0 ; + +if (!con || !con->eh_data) +return 0 ; + +mutex_lock (&con->recovery_lock); + data = con->eh_data; +if (!data) + goto out; + +/* reserve vram at driver post stage. */ +amdgpu_ras_create_bad_pages_bo (adev);/* continue to save bad pages to eeprom even reesrve_vram fails */ ret = amdgpu_ras_save_bad_pages(adev); @@ -1583,9 +1595,6 @@void
amdgpu_ras_recovery_reset(struct amdgpu_device *adev){drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-10struct amdgpu_ras *con =amdgpu_ras_get_context (adev);struct ras_err_handler_data *data; -uint64_t bp; -struct amdgpu_bo *bo =NULL ; -int i;if (!con || !con->eh_data)return ;@@ -1600,26 +1609,7 @@ void amdgpu_ras_recovery_reset(struct amdgpu_device *adev) data = con->eh_data;/* force to reserve all retired page again */ data->last_reserved =0 ; - -for (i = data->last_reserved; i < data->count; i++) { - bp = data->bps[i].retired_page; - -/* There are three cases of reserve error should be ignored: -* 1) a ras bad page has been allocated (used by someone); -* 2) a ras bad page has been reserved (duplicate error injection
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-4-* for one page); -* 3) bo info isn't lost in gpu reset -*/ - if (amdgpu_bo_create_kernel_at(adev, bp <<
AMDGPU_GPU_PAGE_SHIFT,drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-4- AMDGPU_GPU_PAGE_SIZE, -AMDGPU_GEM_DOMAIN_VRAM , - &bo, NULL)) - DRM_NOTE("RAS NOTE: recreate bo for retired page0x%llx fail\n", bp);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-6-else - data->bps_bo[i] = bo; - data->last_reserved = i +1 ; - bo =NULL ; - } +amdgpu_ras_create_bad_pages_bo (adev); }/* recovery end */ --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB30545384C3B58F083CFEACA8B0820-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
RE: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo create
Series is: Reviewed-by: Guchun Chen <[email protected]>
Regards,
Guchun
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Monday, September 30, 2019 11:43 AM
To: Chen, Guchun <[email protected]>; [email protected]; Grodzovsky, Andrey <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo create
Quoted 87 lines
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: 2019年9月30日 11:26
To: Zhou1, Tao <[email protected]>; [email protected]; Grodzovsky, Andrey <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo createRegards,
Guchun-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Monday, September 30, 2019 11:20 AM
To: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: reuse code of ras bad page's bo createimplement
ras_create_bad_pages_boto simplify ras codeSigned-off-by Tao Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 72 +++++++++++-------------- 1 file changed, 31 insertions(+), 41 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12
-17@@ -1430,41 +1430,53 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev)return ret; } -/* called in gpu recovery/init */ -int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev) +static void amdgpu_ras_create_bad_pages_bo (struct amdgpu_device +*adev) { +/* Note: the caller should guarantee con and data are not NULL */ struct amdgpu_ras *con =amdgpu_ras_get_context (adev); -struct ras_err_handler_data *data; +struct ras_err_handler_data *data = con->eh_data;uint64_t bp; -struct amdgpu_bo *bo =NULL ; -int i, ret =0 ; - -if (!con || !con->eh_data) -return 0 ; +struct amdgpu_bo *bo; +int i; -mutex_lock (&con->recovery_lock); - data = con->eh_data; -if (!data) - goto out; -/* reserve vram at driver post stage. */ for (i = data->last_reserved; i < data->count; i++) { + bo =NULL ; bp = data->bps[i].retired_page; -/* There are two cases of reserve error should be ignored: +/* There are three cases of reserve error should be ignored: * 1) a ras bad page has been allocated (used by someone); * 2) a ras bad page has been reserved (duplicate error injection * for one page); +* 3) bo info isn't lost in gpu reset */ if (amdgpu_bo_create_kernel_at (adev, bp <<AMDGPU_GPU_PAGE_SHIFT ,AMDGPU_GPU_PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , &bo,NULL )) - DRM_WARN("RAS WARN: reserve vram for retired page %llx fail\n", bp); - - data->bps_bo[i] = bo; + DRM_NOTE("RAS NOTE: reserve vram for retired page 0x%llx fail\n", bp); + else + data->bps_bo[i] = bo;
Quoted 4 lines
[Guchun]The "else" should not needed? Otherwise, if
amdgpu_bo_create_kernel_atalways succeeds, we don't catch a chance to updatebps_bo.
Is that true?
[Tao] It's intentional. There is only a DRM_NOTE if amdgpu_bo_create_kernel_at fails (the parameter bo is NULL under this condition), and bps_bo contains previous value (or NULL). We update bps_bo only if amdgpu_bo_create_kernel_at succeeds.
Quoted 66 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +18
-1data->last_reserved = i +1 ; - bo =NULL ; } +} + +/* called in gpu recovery/init */ +int amdgpu_ras_reserve_bad_pages (struct amdgpu_device *adev) { +struct amdgpu_ras *con =amdgpu_ras_get_context (adev); +struct ras_err_handler_data *data; +int ret =0 ; + +if (!con || !con->eh_data) +return 0 ; + +mutex_lock (&con->recovery_lock); + data = con->eh_data; +if (!data) + goto out; + +/* reserve vram at driver post stage. */ +amdgpu_ras_create_bad_pages_bo (adev);/* continue to save bad pages to eeprom even reesrve_vram fails */ ret = amdgpu_ras_save_bad_pages(adev); @@ -1583,9 +1595,6 @@ void
amdgpu_ras_recovery_reset(struct amdgpu_device *adev){drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-10struct amdgpu_ras *con =amdgpu_ras_get_context (adev);struct ras_err_handler_data *data; -uint64_t bp; -struct amdgpu_bo *bo =NULL ; -int i;if (!con || !con->eh_data)return ;@@ -1600,26 +1609,7 @@ void amdgpu_ras_recovery_reset(struct amdgpu_device *adev) data = con->eh_data;/* force to reserve all retired page again */ data->last_reserved =0 ; - -for (i = data->last_reserved; i < data->count; i++) { - bp = data->bps[i].retired_page; - -/* There are three cases of reserve error should be ignored: -* 1) a ras bad page has been allocated (used by someone); -* 2) a ras bad page has been reserved (duplicate error injection
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-4-* for one page); -* 3) bo info isn't lost in gpu reset -*/ - if (amdgpu_bo_create_kernel_at(adev, bp <<
AMDGPU_GPU_PAGE_SHIFT,drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-4- AMDGPU_GPU_PAGE_SIZE, -AMDGPU_GEM_DOMAIN_VRAM , - &bo, NULL)) - DRM_NOTE("RAS NOTE: recreate bo for retired page0x%llx fail\n", bp);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-6-else - data->bps_bo[i] = bo; - data->last_reserved = i +1 ; - bo =NULL ; - } +amdgpu_ras_create_bad_pages_bo (adev); }/* recovery end */ --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 30.09.19 um 05:19 schrieb Zhou1, Tao:
Quoted 6 lines
the info of retired page's bo may be lost if vram lost is encountered in gpu reset (gpu page table in vram may be lost), force to recreate all bos
v2: simplify NULL pointer check
add more comments
Repeating on the v2 of the patch set, this is complete nonsense.
When VRAM is lost the BOs and their reservation still exits, only the content is lost because the MC is has been resetted.
Regards,
Christian.
Quoted 85 lines
Signed-off-by Tao Zhou <[email protected]>Suggested-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 48 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + 3 files changed, 50 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0@@ -3675,6 +3675,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive,if (vram_lost) {DRM_INFO ("VRAM is lost due to GPU reset!\n" );amdgpu_inc_vram_lost (tmp_adev); +amdgpu_ras_recovery_reset (tmp_adev); } r = amdgpu_gtt_mgr_recover(drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +48
-0@@ -1573,6 +1573,54 @@ static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)return 0 ; } + +/* +* the info of retired page's bo may be lost if vram lost is encountered +* in gpu reset (gpu page table in vram may be lost), force to recreate +* all bos +*/ +void amdgpu_ras_recovery_reset (struct amdgpu_device *adev) +{ +struct amdgpu_ras *con =amdgpu_ras_get_context (adev); +struct ras_err_handler_data *data; +uint64_t bp; +struct amdgpu_bo *bo =NULL ; +int i; + +if (!con || !con->eh_data) +return ; + +/* Note: It's called in gpu reset, recovery_lock may be acquired before +* gpu reset. The following code is out of protect of con->recovery_lock +* in case of deadlock and bps_bo should be recreated (if successfully) +* whether recovery_lock is locked or not. +* We assume there is no other ras recovery operation simultaneous during +* gpu reset. +*/ + data = con->eh_data; +/* force to reserve all retired page again */ + data->last_reserved =0 ; + +for (i = data->last_reserved; i < data->count; i++) { + bp = data->bps[i].retired_page; + +/* There are three cases of reserve error should be ignored: +* 1) a ras bad page has been allocated (used by someone); +* 2) a ras bad page has been reserved (duplicate error injection +* for one page); +* 3) bo info isn't lost in gpu reset +*/ +if (amdgpu_bo_create_kernel_at (adev, bp <<AMDGPU_GPU_PAGE_SHIFT , +AMDGPU_GPU_PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM , + &bo,NULL )) +DRM_NOTE ("RAS NOTE: recreate bo for retired page 0x%llx fail\n" , bp); +else + data->bps_bo[i] = bo; + data->last_reserved = i +1 ; + bo =NULL ; + } +}/* recovery end */ /* return 0 if ras will reset gpu and repost.*/ drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h static inline int amdgpu_ras_is_supported(struct amdgpu_device *adev, · line 485
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1
-0@@ -479,6 +479,7 @@ static inline int amdgpu_ras_is_supported(struct amdgpu_device *adev, }int amdgpu_ras_recovery_init (struct amdgpu_device *adev); +void amdgpu_ras_recovery_reset (struct amdgpu_device *adev);int amdgpu_ras_request_reset_on_boot (struct amdgpu_device *adev,unsigned int block);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 5baa91ba-73b9-6d49-4a03-51c4acb2505c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Hi Christian:
So the allocation information of a bo's vram page could be reserved after vram lost?
In fact, this series could be dropped if the result of amdgpu_bo_create_reserved is guaranteed to be failed after vram lost (protect bad pages from reallocating).
Hi Andrey:
A bad page's allocation information will not be lost in gpu reset according to Christian's comments. Do you have any other concern?
Regards,
Tao
Quoted 118 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: 2019年9月30日 16:35
To: Zhou1, Tao <[email protected]>; [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 1/3] drm/amdgpu: recreate retired page's bo if vram get lost in gpu resetAm 30.09.19 um 05:19 schrieb Zhou1, Tao:
Quoted 6 lines
the info of retired page's bo may be lost if vram lost is encountered in gpu reset (gpu page table in vram may be lost), force to recreate all bos
v2: simplify NULL pointer check
add more commentsRepeating on the v2 of the patch set, this is complete nonsense.
When VRAM is lost the BOs and their reservation still exits, only the content is lost because the MC is has been resetted.
Regards,
Christian.Quoted 6 lines
Signed-off-by Tao Zhou <[email protected]>Suggested-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 48++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_do_asic_reset(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + 3 files changed, 50 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3675,6 +3675,7 @@ static int amdgpu_do_asic_reset(struct
amdgpu_hive_info*hive,drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_do_asic_reset(struct · line 3676
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if (vram_lost) { DRM_INFO("VRAM is lost due to GPUreset!\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_do_asic_reset(struct · line 3678
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0amdgpu_inc_vram_lost (tmp_adev); +amdgpu_ras_recovery_reset(tmp_adev);Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0} r = amdgpu_gtt_mgr_recover(drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +9
-0@@ -1573,6 +1573,54 @@ static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)return 0 ; } + +/* +* the info of retired page's bo may be lost if vram lost is +encountered +* in gpu reset (gpu page table in vram may be lost), force to +recreate +* all bos +*/ +void amdgpu_ras_recovery_reset (struct amdgpu_device *adev) {drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct · line 1595
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +10
-0+struct amdgpu_ras *con =amdgpu_ras_get_context (adev); +struct ras_err_handler_data *data; +uint64_t bp; +struct amdgpu_bo *bo =NULL ; +int i; + +if (!con || !con->eh_data) +return ; + +/* Note: It's called in gpu reset, recovery_lock may be acquired before
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-0+* gpu reset. The following code is out of protect of con-
recovery_lockdrivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3
-0+* in case of deadlock and bps_bo should be recreated (if successfully) +* whether recovery_lock is locked or not. +* We assume there is no other ras recovery operation simultaneous during
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12
-0+* gpu reset. +*/ + data = con->eh_data; +/* force to reserve all retired page again */ + data->last_reserved =0 ; + +for (i = data->last_reserved; i < data->count; i++) { + bp = data->bps[i].retired_page; + +/* There are three cases of reserve error should be ignored: +* 1) a ras bad page has been allocated (used by someone); +* 2) a ras bad page has been reserved (duplicate error injection
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0+* for one page); +* 3) bo info isn't lost in gpu reset +*/ + if (amdgpu_bo_create_kernel_at(adev, bp <<
AMDGPU_GPU_PAGE_SHIFT,drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0+ AMDGPU_GPU_PAGE_SIZE, +AMDGPU_GEM_DOMAIN_VRAM , + &bo, NULL)) + DRM_NOTE("RAS NOTE: recreate bo for retired page0x%llx fail\n", bp);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +6
-0+else + data->bps_bo[i] = bo; + data->last_reserved = i +1 ; + bo =NULL ; + } +}/* recovery end */
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h static inline int amdgpu_ras_is_supported(struct
Quoted 7 lines
/* return 0 if ras will reset gpu and repost.*/ diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
indexf80fd3428c98..7a606d3be806100644drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0@@ -479,6 +479,7 @@ static inline int amdgpu_ras_is_supported(struct
amdgpu_device*adev,Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1
-0}int amdgpu_ras_recovery_init (struct amdgpu_device *adev); +void amdgpu_ras_recovery_reset (struct amdgpu_device *adev);int amdgpu_ras_request_reset_on_boot (struct amdgpu_device *adev,unsigned int block);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB305489541BCEF7B758412C6AB0820-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Am 30.09.19 um 11:06 schrieb Zhou1, Tao:
Quoted 3 lines
Hi Christian:
So the allocation information of a bo's vram page could be reserved after vram lost?
Yes, exactly. VRAM lost just means that we are returning an error code to userspace when they try to use a context created before VRAM was lost.
Quoted 1 line
In fact, this series could be dropped if the result of
amdgpu_bo_create_reservedis guaranteed to be failed after vram lost (protect bad pages from reallocating).
The BOs are not freed in any way, so I think Andrey meant something else.
Regards,
Christian.
Quoted 139 lines
Hi Andrey:
A bad page's allocation information will not be lost in gpu reset according to Christian's comments. Do you have any other concern?
Regards,
TaoQuoted 116 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: 2019年9月30日 16:35
To: Zhou1, Tao <[email protected]>; [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 1/3] drm/amdgpu: recreate retired page's bo if vram get lost in gpu resetAm 30.09.19 um 05:19 schrieb Zhou1, Tao:
Quoted 6 lines
the info of retired page's bo may be lost if vram lost is encountered in gpu reset (gpu page table in vram may be lost), force to recreate all bos
v2: simplify NULL pointer check
add more commentsRepeating on the v2 of the patch set, this is complete nonsense.
When VRAM is lost the BOs and their reservation still exits, only the content is lost because the MC is has been resetted.
Regards,
Christian.Quoted 5 lines
Signed-off-by Tao Zhou <[email protected]>Suggested-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 48++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_do_asic_reset(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + 3 files changed, 50 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3675,6 +3675,7 @@ static int amdgpu_do_asic_reset(struct
amdgpu_hive_info*hive,drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_do_asic_reset(struct · line 3676
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if (vram_lost) { DRM_INFO("VRAM is lost due to GPUreset!\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_do_asic_reset(struct · line 3678
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0amdgpu_inc_vram_lost (tmp_adev); +amdgpu_ras_recovery_reset(tmp_adev);Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0} r = amdgpu_gtt_mgr_recover(drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +9
-0@@ -1573,6 +1573,54 @@ static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)return 0 ; } + +/* +* the info of retired page's bo may be lost if vram lost is +encountered +* in gpu reset (gpu page table in vram may be lost), force to +recreate +* all bos +*/ +void amdgpu_ras_recovery_reset (struct amdgpu_device *adev) {drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct · line 1595
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +10
-0+struct amdgpu_ras *con =amdgpu_ras_get_context (adev); +struct ras_err_handler_data *data; +uint64_t bp; +struct amdgpu_bo *bo =NULL ; +int i; + +if (!con || !con->eh_data) +return ; + +/* Note: It's called in gpu reset, recovery_lock may be acquired before
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-0+* gpu reset. The following code is out of protect of con-
recovery_lockdrivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3
-0+* in case of deadlock and bps_bo should be recreated (if successfully) +* whether recovery_lock is locked or not. +* We assume there is no other ras recovery operation simultaneous during
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12
-0+* gpu reset. +*/ + data = con->eh_data; +/* force to reserve all retired page again */ + data->last_reserved =0 ; + +for (i = data->last_reserved; i < data->count; i++) { + bp = data->bps[i].retired_page; + +/* There are three cases of reserve error should be ignored: +* 1) a ras bad page has been allocated (used by someone); +* 2) a ras bad page has been reserved (duplicate error injection
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0+* for one page); +* 3) bo info isn't lost in gpu reset +*/ + if (amdgpu_bo_create_kernel_at(adev, bp <<
AMDGPU_GPU_PAGE_SHIFT,drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0+ AMDGPU_GPU_PAGE_SIZE, +AMDGPU_GEM_DOMAIN_VRAM , + &bo, NULL)) + DRM_NOTE("RAS NOTE: recreate bo for retired page0x%llx fail\n", bp);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +6
-0+else + data->bps_bo[i] = bo; + data->last_reserved = i +1 ; + bo =NULL ; + } +}/* recovery end */ Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h static inline int amdgpu_ras_is_supported(struct
Quoted 7 lines
/* return 0 if ras will reset gpu and repost.*/ diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.hb/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
indexf80fd3428c98..7a606d3be806100644drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0@@ -479,6 +479,7 @@ static inline int amdgpu_ras_is_supported(struct
amdgpu_device*adev,Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1
-0}int amdgpu_ras_recovery_init (struct amdgpu_device *adev); +void amdgpu_ras_recovery_reset (struct amdgpu_device *adev);int amdgpu_ras_request_reset_on_boot (struct amdgpu_device *adev,unsigned int block);
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx