drm/amdgpu/ras: Extract amdgpu_ras_save_bad_pages from amdgpu_ras_reserve_bad_pages
Subsystems (2)
PATCH 1/2 drm/amdgpu/ras: Extract amdgpu_ras_save_bad_pages from amdgpu_ras_reserve_bad_pages
We want to be be able to call them independently from one another so that before GPU reset just amdgpu_ras_save_bad_pages is called.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 14 ++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 2 files changed, 7 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -10
@@ -1421,7 +1421,7 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev,* 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;
@@ -1520,7 +1520,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev)struct ras_err_handler_data *data;uint64_t bp;struct amdgpu_bo *bo =NULL ; -int i, ret =0 ; +int i;if (!con || !con->eh_data)return 0 ;
@@ -1548,12 +1548,9 @@ 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; +return 0 ; }/* called when driver unload */
@@ -1615,14 +1612,11 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) ret =amdgpu_ras_load_bad_pages (adev);if (ret) goto free; - ret =amdgpu_ras_reserve_bad_pages (adev); -if (ret) - goto release; +amdgpu_ras_reserve_bad_pages (adev); }return 0 ; -release:amdgpu_ras_release_bad_pages (adev); free:kfree ((*data)->bps);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3 -1
@@ -492,6 +492,8 @@ unsigned long amdgpu_ras_query_error_count(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,
@@ -503,7 +505,7 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev,* i2c may be unstable in gpu reset */ if (in_task ()) -amdgpu_ras_reserve_bad_pages (adev); +amdgpu_ras_save_bad_pages (adev);if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1573685125-2335-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: Reserve bad pages after ASIC was reset.
Problem:
There is no point to reserve bad pages before GPU reset as it was done untill now since we need to do it after ASIC was reset as we lose all reservation during ASIC reset.
Fix:
Call amdgpu_ras_reserve_bad_pages after ASIC is reset and not before.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -3804,6 +3804,10 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive,break ; } } + +/* Mark vram pages with errors as bad after ASIC was reset */ +list_for_each_entry (tmp_adev, device_list_handle, gmc.xgmi.head) +amdgpu_ras_reserve_bad_pages (tmp_adev); } }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Two questions:
1. "we lose all reservation during ASIC reset"
Are you sure of it? I remember the content of vram may be lost after reset but the allocated status could be reserved.
2. You change the bad page handle flow from:
detect bad page -> reserve vram for bad page -> save bad page info to eeprom -> gpu reset
to:
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time)
Is that right? Saving bad page (this time) info to eeprom is delayed to the next time that bad page is detected? But the time of detecting bad page is random. I think the bad page info would be lost without saving to eeprom if power off occurs.
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time) -> poweroff/system reset (and bad page info (this time) is lost)
Tao
Quoted 105 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年11月14日 6:45
To: [email protected]
Cc: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/ras: Extractamdgpu_ras_save_bad_pagesfromamdgpu_ras_reserve_bad_pagesWe want to be be able to call them independently from one another so that before GPU reset just
amdgpu_ras_save_bad_pagesis called.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 14 ++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 2 files changed, 7 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1421,7 +1421,7 @@ int amdgpu_ras_add_bad_pages(structamdgpu_device *adev, * 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);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1struct ras_err_handler_data *data;@@ -1520,7 +1520,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev)struct ras_err_handler_data *data;uint64_t bp;struct amdgpu_bo *bo =NULL ; -int i, ret =0 ; +int i;if (!con || !con->eh_data)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-4return 0 ;@@ -1548,12 +1548,9 @@ 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; +return 0 ; }/* called when driver unload */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-4@@ -1615,14 +1612,11 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) ret =amdgpu_ras_load_bad_pages (adev);if (ret) goto free; - ret =amdgpu_ras_reserve_bad_pages (adev); -if (ret) - goto release; +amdgpu_ras_reserve_bad_pages (adev); }return 0 ; -release:amdgpu_ras_release_bad_pages (adev); free:drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0kfree ((*data)->bps);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0@@ -492,6 +492,8 @@ unsigned longamdgpu_ras_query_error_count(struct
amdgpu_device*adev, int amdgpu_ras_add_bad_pages(structamdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-0struct 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, @@ -503,7 +505,7 @@ static inline int amdgpu_ras_reset_gpu(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1
-2* i2c may be unstable in gpu reset */ if (in_task ()) -amdgpu_ras_reserve_bad_pages (adev); +amdgpu_ras_save_bad_pages (adev);if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work); --2.7.4
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
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3054761DA7F4EDEC9975F8AAB0710-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 4 lines · Tao
Two questions:
1. "we lose all reservation during ASIC reset"
Are you sure of it? I remember the content of vram may be lost after reset but the allocated status could be reserved.
Yea, now that I am thinking of it I think i might have confused it with BO content recovery in amdgpu_device_recover_vram for shadow buffers which are page tables only but just for VRAM reservation status this might be irrelevant... Christian - can you confirm Tao is correct on this ?
Quoted 8 lines
2. You change the bad page handle flow from:
detect bad page -> reserve vram for bad page -> save bad page info to eeprom -> gpu reset
to:
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time)
Even though if I am wrong on the first point this is irrelevant but still - Why saving bad page is from last time ? See https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c?h=amd-staging-drm-next#n1436 - the save count is the latest so as the content of data->bps[control->num_recs] up to data->bps[control->num_recs + save_count] as those are updated in amdgpu_umc_process_ras_data_cb->amdgpu_ras_add_bad_pages which is called right BEFORE amdgpu_ras_reset_gpu->amdgpu_ras_save_bad_pages in the interrupt sequence
Andrey
Quoted 113 lines
Is that right? Saving bad page (this time) info to eeprom is delayed to the next time that bad page is detected? But the time of detecting bad page is random. I think the bad page info would be lost without saving to eeprom if power off occurs.
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time) -> poweroff/system reset (and bad page info (this time) is lost)
Tao
Quoted 105 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年11月14日 6:45
To: [email protected]
Cc: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/ras: Extractamdgpu_ras_save_bad_pagesfromamdgpu_ras_reserve_bad_pagesWe want to be be able to call them independently from one another so that before GPU reset just
amdgpu_ras_save_bad_pagesis called.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 14 ++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 2 files changed, 7 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1421,7 +1421,7 @@ int amdgpu_ras_add_bad_pages(structamdgpu_device *adev, * 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;drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1520,7 +1520,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev)struct ras_err_handler_data *data;uint64_t bp;struct amdgpu_bo *bo =NULL ; -int i, ret =0 ; +int i;if (!con || !con->eh_data)return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-4@@ -1548,12 +1548,9 @@ 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; +return 0 ; }/* called when driver unload */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-4@@ -1615,14 +1612,11 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) ret =amdgpu_ras_load_bad_pages (adev);if (ret) goto free; - ret =amdgpu_ras_reserve_bad_pages (adev); -if (ret) - goto release; +amdgpu_ras_reserve_bad_pages (adev); }return 0 ; -release:amdgpu_ras_release_bad_pages (adev); free:kfree((*data)->bps);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0@@ -492,6 +492,8 @@ unsigned longamdgpu_ras_query_error_count(struct
amdgpu_device*adev, int amdgpu_ras_add_bad_pages(structamdgpu_device*adev,
structeeprom_table_record*bps, int pages);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-0+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, @@ -503,7 +505,7 @@ static inline int amdgpu_ras_reset_gpu(struct
amdgpu_device*adev,
* i2c may be unstable in gpu reset
*/
if (in_task())drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1
-2-amdgpu_ras_reserve_bad_pages (adev); +amdgpu_ras_save_bad_pages (adev);if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work); --2.7.4
Quoted 4 lines
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
A message that is not in the archive (sent off-list or not yet received): 63578cfb-83c2-6887-b7da-7715ef6ed3a9-5C7GfCeVMHo@public.gmane.org
Sorry, I confused reserve_bad_pages with add_bad_pages, you're right.
If vram allocated info could be reserved after gpu reset, it seems your patch is unnecessary.
If there is a risk that the info is lost, I think [data->0, data->count) pages instead of only [data->last_reserved, data->count) pages should be reserved.
Tao
Quoted 168 lines
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: 2019年11月15日 0:42
To: Zhou1, Tao <[email protected]>; [email protected]; Koenig, Christian <[email protected]>
Cc: [email protected]; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu/ras: Extractamdgpu_ras_save_bad_pagesfromamdgpu_ras_reserve_bad_pagesQuoted 4 lines · Tao
Two questions:
1. "we lose all reservation during ASIC reset"
Are you sure of it? I remember the content of vram may be lost after resetbut the allocated status could be reserved.
Yea, now that I am thinking of it I think i might have confused it with BO content recovery in
amdgpu_device_recover_vramfor shadow buffers which are page tables only but just for VRAM reservation status this might be irrelevant... Christian - can you confirm Tao is correct on this ?Quoted 10 lines
2. You change the bad page handle flow from:
detect bad page -> reserve vram for bad page -> save bad page info to eeprom -> gpu reset
to:
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time)
Even though if I am wrong on the first point this is irrelevant but still - Why saving bad page is from last time ? See
https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/amd/amdg
pu/amdgpu_ras.c?h=amd-staging-drm-next#n1436
- the save count is the latest so as the content of data->bps[control->num_recs] up to data->bps[control->num_recs +save_count] as those are updated inamdgpu_umc_process_ras_data_cb->amdgpu_ras_add_bad_pageswhich is called right BEFOREamdgpu_ras_reset_gpu->amdgpu_ras_save_bad_pagesin the interrupt sequenceAndrey
Quoted 2 lines
Is that right? Saving bad page (this time) info to eeprom is delayed to the
next time that bad page is detected? But the time of detecting bad page is random.
Quoted 1 line
I think the bad page info would be lost without saving to eeprom if power
off occurs.
Quoted 14 lines
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time) -> poweroff/system reset (and bad page info (this time) is lost)
Tao
Quoted 7 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年11月14日 6:45
To: [email protected]
Cc: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, GuchunQuoted 99 lines
Quoted 99 lines
Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/ras: Extractamdgpu_ras_save_bad_pagesfromamdgpu_ras_reserve_bad_pagesWe want to be be able to call them independently from one another so that before GPU reset just
amdgpu_ras_save_bad_pagesis called.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 14 ++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 2 files changed, 7 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1421,7 +1421,7 @@ int amdgpu_ras_add_bad_pages(structamdgpu_device *adev, * 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; @@ -1520,7 +1520,7 @@ int
amdgpu_ras_reserve_bad_pages(structamdgpu_device*adev)
structras_err_handler_data*data;
uint64_tbp;
structamdgpu_bo*bo = NULL;drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-5-int i, ret =0 ; +int i;if (!con || !con->eh_data)return 0 ;@@ -1548,12 +1548,9 @@ 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; +return 0 ; }/* called when driver unload */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-4@@ -1615,14 +1612,11 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) ret =amdgpu_ras_load_bad_pages (adev);if (ret) goto free; - ret =amdgpu_ras_reserve_bad_pages (adev); -if (ret) - goto release; +amdgpu_ras_reserve_bad_pages (adev); }return 0 ; -release:amdgpu_ras_release_bad_pages (adev); free:kfree((*data)->bps);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0@@ -492,6 +492,8 @@ unsigned longamdgpu_ras_query_error_count(struct
amdgpu_device*adev, int amdgpu_ras_add_bad_pages(structamdgpu_device*adev,
structeeprom_table_record*bps, int pages);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-0+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,@@ -
503,7 +505,7 @@ static inline int amdgpu_ras_reset_gpu(structamdgpu_device*adev,
* i2c may be unstable in gpu reset
*/
if (in_task())drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1
-2-amdgpu_ras_reserve_bad_pages (adev); +amdgpu_ras_save_bad_pages (adev);if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work); --2.7.4
Quoted 4 lines
Quoted 4 lines
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
Christian - ping.
Andrey
Quoted 139 lines · Andrey Grodzovsky
Quoted 4 lines · Tao
Two questions:
1. "we lose all reservation during ASIC reset"
Are you sure of it? I remember the content of vram may be lost after reset but the allocated status could be reserved.Yea, now that I am thinking of it I think i might have confused it with BO content recovery in
amdgpu_device_recover_vramfor shadow buffers which are page tables only but just for VRAM reservation status this might be irrelevant... Christian - can you confirm Tao is correct on this ?Quoted 8 lines
2. You change the bad page handle flow from:
detect bad page -> reserve vram for bad page -> save bad page info to eeprom -> gpu reset
to:
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time)
Even though if I am wrong on the first point this is irrelevant but still - Why saving bad page is from last time ? See https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c?h=amd-staging-drm-next#n1436
- the save count is the latest so as the content of
data->bps[control->num_recs] up to data->bps[control->num_recs +save_count] as those are updated inamdgpu_umc_process_ras_data_cb->amdgpu_ras_add_bad_pageswhich is called right BEFOREamdgpu_ras_reset_gpu->amdgpu_ras_save_bad_pagesin the interrupt sequenceAndrey
Quoted 114 lines
Is that right? Saving bad page (this time) info to eeprom is delayed to the next time that bad page is detected? But the time of detecting bad page is random. I think the bad page info would be lost without saving to eeprom if power off occurs.
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time) -> poweroff/system reset (and bad page info (this time) is lost)
Tao
Quoted 106 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年11月14日 6:45
To: [email protected]
Cc: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/ras: Extractamdgpu_ras_save_bad_pagesfromamdgpu_ras_reserve_bad_pagesWe want to be be able to call them independently from one another so that before GPU reset just
amdgpu_ras_save_bad_pagesis called.Signed-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c| 14 ++++----------drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h| 4 +++-2 files changed, 7 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1421,7 +1421,7 @@ int amdgpu_ras_add_bad_pages(structamdgpu_device *adev, * 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;drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1520,7 +1520,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) struct ras_err_handler_data *data; uint64_t bp; struct amdgpu_bo *bo = NULL; - int i, ret = 0; + int i; if (!con || !con->eh_data)return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-3@@ -1548,12 +1548,9 @@ 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;
+ return 0;
}/* called when driver unload */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-4@@ -1615,14 +1612,11 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) ret = amdgpu_ras_load_bad_pages(adev); if (ret) goto free; - ret = amdgpu_ras_reserve_bad_pages(adev); - if (ret) - goto release; + amdgpu_ras_reserve_bad_pages(adev); } return 0; -release: amdgpu_ras_release_bad_pages(adev);free:
kfree((*data)->bps);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0@@ -492,6 +492,8 @@ unsigned longamdgpu_ras_query_error_count(struct
amdgpu_device*adev, intamdgpu_ras_add_bad_pages(struct amdgpu_device *adev, struct eeprom_table_record *bps, int pages);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-0+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, @@ -
503,7 +505,7 @@ static inline int amdgpu_ras_reset_gpu(structamdgpu_device*adev,
* i2c may be unstable in gpu reset
*/
if (in_task())
-amdgpu_ras_reserve_bad_pages(adev);
+amdgpu_ras_save_bad_pages(adev);if (
atomic_cmpxchg(&ras->in_recovery, 0, 1)== 0)schedule_work(&ras->recovery_work);Signature · 1 line
2.7.4
Quoted 8 lines
Quoted 4 lines
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
_______________________________________________
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): 9ac78bf3-664b-ba1a-8579-bb802e3860e4-5C7GfCeVMHo@public.gmane.org
Am 18.11.19 um 15:05 schrieb Andrey Grodzovsky:
Quoted 13 lines
Christian - ping.
Andrey
Quoted 8 lines · Andrey Grodzovsky
Quoted 4 lines · Tao
Two questions:
1. "we lose all reservation during ASIC reset"
Are you sure of it? I remember the content of vram may be lost after reset but the allocated status could be reserved.Yea, now that I am thinking of it I think i might have confused it with BO content recovery in
amdgpu_device_recover_vramfor shadow buffers which are page tables only but just for VRAM reservation status this might be irrelevant... Christian - can you confirm Tao is correct on this ?
Yeah, that is correct. The BO structure stays, just the content is lost.
You guys should maybe consider moving all that stuff into amdgpu_vram_mgr.c. It is far easier to handle there because you don't need to care about memory which is currently allocated.
Regards,
Christian.
Quoted 131 lines
Quoted 131 lines
Quoted 9 lines
2. You change the bad page handle flow from:
detect bad page -> reserve vram for bad page -> save bad page info to eeprom -> gpu reset
to:
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time)
Even though if I am wrong on the first point this is irrelevant but still - Why saving bad page is from last time ? See https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c?h=amd-staging-drm-next#n1436
- the save count is the latest so as the content of
data->bps[control->num_recs] up to data->bps[control->num_recs +save_count] as those are updated inamdgpu_umc_process_ras_data_cb->amdgpu_ras_add_bad_pageswhich is called right BEFOREamdgpu_ras_reset_gpu->amdgpu_ras_save_bad_pagesin the interrupt sequenceAndrey
Quoted 114 lines
Is that right? Saving bad page (this time) info to eeprom is delayed to the next time that bad page is detected? But the time of detecting bad page is random. I think the bad page info would be lost without saving to eeprom if power off occurs.
detect bad page (this time) -> save bad page (last time) info to eeprom -> gpu reset -> reserve vram for bad page (this time) -> poweroff/system reset (and bad page info (this time) is lost)
Tao
Quoted 106 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年11月14日 6:45
To: [email protected]
Cc: [email protected]; Grodzovsky, Andrey <[email protected]>; Chen, Guchun <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/ras: Extractamdgpu_ras_save_bad_pagesfromamdgpu_ras_reserve_bad_pagesWe want to be be able to call them independently from one another so that before GPU reset just
amdgpu_ras_save_bad_pagesis called.Signed-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c| 14 ++++----------drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h| 4 +++-2 files changed, 7 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1421,7 +1421,7 @@ int amdgpu_ras_add_bad_pages(structamdgpu_device *adev, * 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;drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -1520,7 +1520,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) struct ras_err_handler_data *data; uint64_t bp; struct amdgpu_bo *bo = NULL; - int i, ret = 0; + int i; if (!con || !con->eh_data)return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-2@@ -1548,12 +1548,9 @@ 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_vramfails */
- ret =amdgpu_ras_save_bad_pages(adev);
out:
mutex_unlock(&con->recovery_lock);
- return ret;
+ return 0;
}/* called when driver unload */
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-4@@ -1615,14 +1612,11 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) ret = amdgpu_ras_load_bad_pages(adev); if (ret) goto free; - ret = amdgpu_ras_reserve_bad_pages(adev); - if (ret) - goto release; + amdgpu_ras_reserve_bad_pages(adev); } return 0; -release: amdgpu_ras_release_bad_pages(adev);free:
kfree((*data)->bps);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0@@ -492,6 +492,8 @@ unsigned longamdgpu_ras_query_error_count(struct
amdgpu_device*adev, intamdgpu_ras_add_bad_pages(struct amdgpu_device *adev, struct eeprom_table_record *bps, int pages);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-0+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, @@ - 503,7 +505,7 @@ static inline int amdgpu_ras_reset_gpu(structamdgpu_device*adev,
* i2c may be unstable in gpu reset
*/
if (in_task())
-amdgpu_ras_reserve_bad_pages(adev);
+amdgpu_ras_save_bad_pages(adev);if (
atomic_cmpxchg(&ras->in_recovery, 0, 1)== 0)schedule_work(&ras->recovery_work);Signature · 1 line
2.7.4
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx