drm/amdgpu: Fix mutex lock from atomic context.
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix mutex lock from atomic context.
Problem:amdgpu_ras_reserve_bad_pages was moved to amdgpu_ras_reset_gpu because writing to EEPROM during ASIC reset was unstable. But for ERREVENT_ATHUB_INTERRUPT amdgpu_ras_reset_gpu is called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.
Fix:
Avoid calling amdgpu_ras_reserve_bad_pages if not in task context.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3 -1
@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev,/* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev); +if (in_task ()) +amdgpu_ras_reserve_bad_pages (adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);return 0 ;
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): 1568144487-27802-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
Zhou1, Tao
Reviewed-by Tao Zhouamdgpu_ras_reserve_bad_pages is only used by umc block, so another approach is to move it into amdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:
Quoted 42 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable.
But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev, /* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev ); + if (in_task()) + amdgpu_ras_reserve_bad_pages(adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);
Quoted 3 lines
return 0;
--
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): MN2PR12MB3054A0B4D399377417213B76B0B10-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
I like this much more, I will relocate to amdgpu_umc_process_ras_data_cb an push.
Andrey
Quoted 42 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 37 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable.
But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev,/* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev );
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-0+if (in_task ()) +amdgpu_ras_reserve_bad_pages (adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);return 0;
--
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): d35cc3f6-ff46-175e-3a92-5f7948f97bef-5C7GfCeVMHo@public.gmane.org
On second though this will break what about reserving bad pages when resetting GPU for non RAS error reason such as manual reset ,S3 or ring timeout, (amdgpu_ras_resume->amdgpu_ras_reset_gpu) so i will keep the code as is.
Another possible issue in existing code - looks like no reservation will take place in those case even now as amdgpu_ras_reserve_bad_pages data->last_reserved will be equal to data->count , no ? Looks like for this case you need to add flag to FORCE reservation for all pages from 0 to data->counnt.
Andrey
Quoted 51 lines · Andrey Grodzovsky
I like this much more, I will relocate to
amdgpu_umc_process_ras_data_cban push.Andrey
Quoted 45 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 39 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable. But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for
this partilcular interrupt as this is generic RAS interrupt and not memory
errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev, /* save bad page to eeprom before gpu reset,* i2c may be unstable in gpu reset */ - amdgpu_ras_reserve_bad_pages(adev);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-0+ if (in_task()) + amdgpu_ras_reserve_bad_pages(adev); + if (atomic_cmpxchg(&ras->in_recovery, 0, 1) == 0) schedule_work(&ras->recovery_work);return 0;
Signature · 1 line
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): 603add77-1476-ebc8-69f9-2cf88a788a6b-5C7GfCeVMHo@public.gmane.org
Comment inline.
Regards,
Guchun
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: Wednesday, September 11, 2019 10:41 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Chen, Guchun <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.
On second though this will break what about reserving bad pages when resetting GPU for non RAS error reason such as manual reset ,S3 or ring timeout, (amdgpu_ras_resume->amdgpu_ras_reset_gpu) so i will keep the code as is.
Another possible issue in existing code - looks like no reservation will take place in those case even now as amdgpu_ras_reserve_bad_pages data->last_reserved will be equal to data->count , no ? Looks like for
this case you need to add flag to FORCE reservation for all pages from
0 to data->counnt.
[Guchun]Yes, last_reserved is not updated any more, unless we unload our driver. So it maybe always equal to data->count, then no new bad page will be reserved. I see we have one eeprom reset by user, can we put this last_reserved clean operation to user in the same stack as well?
Andrey
Quoted 48 lines · Andrey Grodzovsky
I like this much more, I will relocate to
amdgpu_umc_process_ras_data_cban push.Andrey
Quoted 42 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 36 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable. But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev, /* save bad page to eeprom before gpu reset,* i2c may be unstable in gpu reset */ - amdgpu_ras_reserve_bad_pages(adev);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-0+ if (in_task()) + amdgpu_ras_reserve_bad_pages(adev); + if (atomic_cmpxchg(&ras->in_recovery, 0, 1) == 0) schedule_work(&ras->recovery_work);return 0;
--
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): SN6PR12MB2813F0DFFE8EC027AAF6D6DAF1B00-kxOKjb6HO/[email protected]
That not what I meant. Let's say you handled one bad page interrupt and as a result have one bad page reserved. Now unrelated gfx ring timeout happens which triggers GPU reset and VRAM loss. When you come back from reset amdgpu_ras_reserve_bad_pages will be called but since last_reserved == data_count the bad page will not be reserved again, maybe we should just set data->last_reserved to 0 again if VRAM was lost during ASIC reset...
Andrey
________________________________________
From: Chen, Guchun <[email protected]>
Sent: 11 September 2019 21:53:03
To: Grodzovsky, Andrey; Zhou1, Tao; [email protected]
Cc: Deucher, Alexander
Subject: RE: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.
Comment inline.
Regards,
Guchun
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: Wednesday, September 11, 2019 10:41 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Chen, Guchun <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.
On second though this will break what about reserving bad pages when resetting GPU for non RAS error reason such as manual reset ,S3 or ring timeout, (amdgpu_ras_resume->amdgpu_ras_reset_gpu) so i will keep the code as is.
Another possible issue in existing code - looks like no reservation will take place in those case even now as amdgpu_ras_reserve_bad_pages data->last_reserved will be equal to data->count , no ? Looks like for
this case you need to add flag to FORCE reservation for all pages from
0 to data->counnt.
[Guchun]Yes, last_reserved is not updated any more, unless we unload our driver. So it maybe always equal to data->count, then no new bad page will be reserved. I see we have one eeprom reset by user, can we put this last_reserved clean operation to user in the same stack as well?
Andrey
Quoted 48 lines · Andrey Grodzovsky
I like this much more, I will relocate to
amdgpu_umc_process_ras_data_cban push.Andrey
Quoted 42 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 36 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable. But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev,/* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev );
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-0+if (in_task ()) +amdgpu_ras_reserve_bad_pages (adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);return 0;--
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): MWHPR12MB14533B06E13B86E54520E991EAB00-Gy0DoCVfaSWZBIDmKHdw+wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Hi Andrey:
Are you sure of the VRAM content loss after gpu reset? I'm not very familiar with the detail of gpu reset and I'll do experiment to confirm the case you mentioned.
Regards,
Tao
Quoted 105 lines
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: 2019年9月12日 10:32
To: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.That not what I meant. Let's say you handled one bad page interrupt and as a result have one bad page reserved. Now unrelated gfx ring timeout happens which triggers GPU reset and VRAM loss. When you come back from reset
amdgpu_ras_reserve_bad_pageswill be called but sincelast_reserved==data_countthe bad page will not be reserved again, maybe we should just setdata->last_reservedto 0 again if VRAM was lost during ASIC reset...Andrey
________________________________________
From: Chen, Guchun <[email protected]>
Sent: 11 September 2019 21:53:03
To: Grodzovsky, Andrey; Zhou1, Tao; [email protected]
Cc: Deucher, Alexander
Subject: RE: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Comment inline.
Regards,
Guchun-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: Wednesday, September 11, 2019 10:41 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Chen, Guchun <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.On second though this will break what about reserving bad pages when resetting GPU for non RAS error reason such as manual reset ,S3 or ring timeout, (
amdgpu_ras_resume->amdgpu_ras_reset_gpu) so i will keep the code as is.Another possible issue in existing code - looks like no reservation will take place in those case even now as
amdgpu_ras_reserve_bad_pagesdata->last_reservedwill be equal todata->count, no ? Looks like for this case you need to add flag to FORCE reservation for all pages from 0 todata->counnt.
[Guchun]Yes,last_reservedis not updated any more, unless we unload our driver. So it maybe always equal todata->count, then no new bad page will be reserved.
I see we have one eeprom reset by user, can we put thislast_reservedclean operation to user in the same stack as well?Andrey
Quoted 18 lines · Andrey Grodzovsky
I like this much more, I will relocate to
amdgpu_umc_process_ras_data_cban push.Andrey
Quoted 12 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 6 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, AlexanderQuoted 30 lines
Quoted 30 lines
Quoted 30 lines
Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable. But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev,/* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev );
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-0+if (in_task ()) +amdgpu_ras_reserve_bad_pages (adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);return 0;--
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): MN2PR12MB3054CE8F6F6097847B188457B0B00-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
I am not sure VRAM loss happens every time, but when it does I would assume you would have to reserve them again as the page tables content was lost. On the other hand I do remember we keep shadow system memory copies of all page tables so maybe that not an issue, so yes, just try to allocate the bad page after reset and if it's still reserved you will fail.
Andrey
Quoted 112 lines · Tao
Hi Andrey:
Are you sure of the VRAM content loss after gpu reset? I'm not very familiar with the detail of gpu reset and I'll do experiment to confirm the case you mentioned.
Regards,
TaoQuoted 105 lines
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: 2019年9月12日 10:32
To: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.That not what I meant. Let's say you handled one bad page interrupt and as a result have one bad page reserved. Now unrelated gfx ring timeout happens which triggers GPU reset and VRAM loss. When you come back from reset
amdgpu_ras_reserve_bad_pageswill be called but sincelast_reserved==data_countthe bad page will not be reserved again, maybe we should just setdata->last_reservedto 0 again if VRAM was lost during ASIC reset...Andrey
________________________________________
From: Chen, Guchun <[email protected]>
Sent: 11 September 2019 21:53:03
To: Grodzovsky, Andrey; Zhou1, Tao; [email protected]
Cc: Deucher, Alexander
Subject: RE: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Comment inline.
Regards,
Guchun-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: Wednesday, September 11, 2019 10:41 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Chen, Guchun <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.On second though this will break what about reserving bad pages when resetting GPU for non RAS error reason such as manual reset ,S3 or ring timeout, (
amdgpu_ras_resume->amdgpu_ras_reset_gpu) so i will keep the code as is.Another possible issue in existing code - looks like no reservation will take place in those case even now as
amdgpu_ras_reserve_bad_pagesdata->last_reservedwill be equal todata->count, no ? Looks like for this case you need to add flag to FORCE reservation for all pages from 0 todata->counnt.
[Guchun]Yes,last_reservedis not updated any more, unless we unload our driver. So it maybe always equal todata->count, then no new bad page will be reserved.
I see we have one eeprom reset by user, can we put thislast_reservedclean operation to user in the same stack as well?Andrey
Quoted 18 lines · Andrey Grodzovsky
I like this much more, I will relocate to
amdgpu_umc_process_ras_data_cban push.Andrey
Quoted 12 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 6 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, AlexanderQuoted 30 lines
Quoted 30 lines
Quoted 30 lines
Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable. But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev,/* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev );
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-0+if (in_task ()) +amdgpu_ras_reserve_bad_pages (adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);return 0;--
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): 1caeca1e-40e7-9b59-37f9-47704903655f-5C7GfCeVMHo@public.gmane.org
Well I still hope to avoid VRAM lost in most of the cases, but that is really not guaranteed.
What is the bad page and why do you need to reserve it?
Christian.
Am 12.09.19 um 16:09 schrieb Grodzovsky, Andrey:
Quoted 126 lines
I am not sure VRAM loss happens every time, but when it does I would assume you would have to reserve them again as the page tables content was lost. On the other hand I do remember we keep shadow system memory copies of all page tables so maybe that not an issue, so yes, just try to allocate the bad page after reset and if it's still reserved you will fail.
Andrey
Quoted 116 lines · Tao
Hi Andrey:
Are you sure of the VRAM content loss after gpu reset? I'm not very familiar with the detail of gpu reset and I'll do experiment to confirm the case you mentioned.
Regards,
TaoQuoted 109 lines
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: 2019年9月12日 10:32
To: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.That not what I meant. Let's say you handled one bad page interrupt and as a result have one bad page reserved. Now unrelated gfx ring timeout happens which triggers GPU reset and VRAM loss. When you come back from reset
amdgpu_ras_reserve_bad_pageswill be called but sincelast_reserved==data_countthe bad page will not be reserved again, maybe we should just setdata->last_reservedto 0 again if VRAM was lost during ASIC reset...Andrey
________________________________________
From: Chen, Guchun <[email protected]>
Sent: 11 September 2019 21:53:03
To: Grodzovsky, Andrey; Zhou1, Tao; [email protected]
Cc: Deucher, Alexander
Subject: RE: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Comment inline.
Regards,
Guchun-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: Wednesday, September 11, 2019 10:41 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Chen, Guchun <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.On second though this will break what about reserving bad pages when resetting GPU for non RAS error reason such as manual reset ,S3 or ring timeout, (
amdgpu_ras_resume->amdgpu_ras_reset_gpu) so i will keep the code as is.Another possible issue in existing code - looks like no reservation will take place in those case even now as
amdgpu_ras_reserve_bad_pagesdata->last_reservedwill be equal todata->count, no ? Looks like for this case you need to add flag to FORCE reservation for all pages from 0 todata->counnt.
[Guchun]Yes,last_reservedis not updated any more, unless we unload our driver. So it maybe always equal todata->count, then no new bad page will be reserved.
I see we have one eeprom reset by user, can we put thislast_reservedclean operation to user in the same stack as well?Andrey
Quoted 18 lines · Andrey Grodzovsky
I like this much more, I will relocate to
amdgpu_umc_process_ras_data_cban push.Andrey
Quoted 12 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 6 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, AlexanderQuoted 34 lines
Quoted 34 lines
Quoted 34 lines
Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable. But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev, /* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev ); + if (in_task()) + amdgpu_ras_reserve_bad_pages(adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-0schedule_work (&ras->recovery_work);return 0;--
2.7.4_______________________________________________
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): 91382817-97b0-9ca5-24c6-e7880c4bdb55-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
RAS error will be triggered if the HW identified a faulty physical page, the error comes through an interrupt where the data payload will have information that can be translated into the bad page address, we then as a recovery measure reset the ASIC, reserve this bad page so it cannot be used by anyone else and store it's address to EEPROM for future reservation after boot.
Andrey
Quoted 155 lines · Christian König
Well I still hope to avoid VRAM lost in most of the cases, but that is really not guaranteed.
What is the bad page and why do you need to reserve it?
Christian.
Am 12.09.19 um 16:09 schrieb Grodzovsky, Andrey:
Quoted 146 lines
I am not sure VRAM loss happens every time, but when it does I would assume you would have to reserve them again as the page tables content was lost. On the other hand I do remember we keep shadow system memory copies of all page tables so maybe that not an issue, so yes, just try to allocate the bad page after reset and if it's still reserved you will fail.
Andrey
Quoted 124 lines · Tao
Hi Andrey:
Are you sure of the VRAM content loss after gpu reset? I'm not very familiar with the detail of gpu reset and I'll do experiment to confirm the case you mentioned.
Regards,
TaoQuoted 115 lines
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: 2019年9月12日 10:32
To: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.That not what I meant. Let's say you handled one bad page interrupt and as
a result have one bad page reserved. Now unrelated gfx ring timeout happens which triggers GPU reset and VRAM loss. When you come back from
resetamdgpu_ras_reserve_bad_pageswill be called but sincelast_reserved
==data_countthe bad page will not be reserved again, maybe we should just
setdata->last_reservedto 0 again if VRAM was lost during ASIC reset...Andrey
________________________________________
From: Chen, Guchun <[email protected]>
Sent: 11 September 2019 21:53:03
To: Grodzovsky, Andrey; Zhou1, Tao; [email protected]
Cc: Deucher, Alexander
Subject: RE: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Comment inline.
Regards,
Guchun-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: Wednesday, September 11, 2019 10:41 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Chen, Guchun <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.On second though this will break what about reserving bad pages when resetting GPU for non RAS error reason such as manual reset ,S3 or ring
timeout, (amdgpu_ras_resume->amdgpu_ras_reset_gpu) so i will keep the code as is.Another possible issue in existing code - looks like no reservation will take
place in those case even now asamdgpu_ras_reserve_bad_pagesdata->last_reservedwill be equal todata->count, no ? Looks like for this case you need to add flag to FORCE reservation for all pages from 0 todata->counnt.
[Guchun]Yes,last_reservedis not updated any more, unless we unload our
driver. So it maybe always equal todata->count, then no new bad page will
be reserved.
I see we have one eeprom reset by user, can we put thislast_reservedclean
operation to user in the same stack as well?Andrey
Quoted 18 lines · Andrey Grodzovsky
I like this much more, I will relocate to
amdgpu_umc_process_ras_data_cban push.Andrey
Quoted 12 lines · Tao
amdgpu_ras_reserve_bad_pagesis only used by umc block, so another approach is to move it intoamdgpu_umc_process_ras_data_cb. Anyway, either way is OK and the patch is:Reviewed-by Tao Zhou <[email protected]>Quoted 6 lines
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: 2019年9月11日 3:41
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, AlexanderQuoted 30 lines
Quoted 30 lines
Quoted 30 lines
Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.Problem:
amdgpu_ras_reserve_bad_pageswas moved toamdgpu_ras_reset_gpubecause writing to EEPROM during ASIC reset was unstable. But forERREVENT_ATHUB_INTERRUPTamdgpu_ras_reset_gpuis called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific.Fix:
Avoid callingamdgpu_ras_reserve_bad_pagesif not in task context.Signed-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +0
-1@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev, /* save bad page to eeprom before gpu reset,* i2c may be unstable in gpu reset */ - amdgpu_ras_reserve_bad_pages(adev);Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3
-0+ if (in_task()) + amdgpu_ras_reserve_bad_pages(adev); + if (atomic_cmpxchg(&ras->in_recovery, 0, 1) == 0) schedule_work(&ras->recovery_work);return 0;
Signature · 1 line
2.7.4_______________________________________________
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
Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific. [Guchun]One typo, it should be "particular", not " partilcular". With that fixed, the patch is: Reviewed-by: Guchun Chen <[email protected]>
-----Original Message-----
From: Andrey Grodzovsky <[email protected]>
Sent: Wednesday, September 11, 2019 3:41 AM
To: [email protected]
Cc: Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix mutex lock from atomic context.
Problem:amdgpu_ras_reserve_bad_pages was moved to amdgpu_ras_reset_gpu because writing to EEPROM during ASIC reset was unstable.
But for ERREVENT_ATHUB_INTERRUPT amdgpu_ras_reset_gpu is called directly from ISR context and so locking is not allowed. Also it's irrelevant for this partilcular interrupt as this is generic RAS interrupt and not memory errors specific. [Guchun]One typo, it should be "particular", not " partilcular". With that fixed, the patch is: Reviewed-by: Guchun Chen <[email protected]>
Fix:
Avoid calling amdgpu_ras_reserve_bad_pages if not in task context.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3 -1
@@ -504,7 +504,9 @@ static inline int amdgpu_ras_reset_gpu(struct amdgpu_device *adev,/* save bad page to eeprom before gpu reset, * i2c may be unstable in gpu reset */ -amdgpu_ras_reserve_bad_pages (adev); +if (in_task ()) +amdgpu_ras_reserve_bad_pages (adev); +if (atomic_cmpxchg (&ras->in_recovery,0 ,1 ) ==0 )schedule_work (&ras->recovery_work);return 0 ;
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx