drm/amdgpu: Fix null ptr when calling query_ras_error_count
Subsystems (2)
PATCH 1/2 drm/amdgpu: Fix null ptr when calling query_ras_error_count
ras_err_data.err_addr was never allocated
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +17 -0
@@ -1011,6 +1011,21 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj)int ret;struct ras_err_data err_data = {0 ,0 ,0 ,NULL }; +/* Allocate enough to serve max number of requests*/ +int err_addr_size = data->ring_size / data->aligned_element_size * + obj->adev->umc.umc_inst_num * + obj->adev->umc.channel_inst_num; + + err_data.err_addr =kcalloc (err_addr_size, +sizeof (*err_data.err_addr), +GFP_KERNEL ); + +if (!err_data.err_addr) { +DRM_ERROR ("Not enough memory!" ); +return ; + } + +while (data->rptr != data->wptr) {rmb (); memcpy(&entry, &data->ring[data->rptr],
@@ -1039,6 +1054,8 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj) } } } + +kfree (err_data.err_addr); }static void amdgpu_ras_interrupt_process_handler (struct work_struct *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): 1565718642-18107-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: Start using amdgpu_ras_add_bad_pages.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +22 -1
@@ -243,15 +243,36 @@ static int gmc_v9_0_process_ras_data_cb(struct amdgpu_device *adev,struct ras_err_data *err_data, struct amdgpu_iv_entry *entry) { + unsigned long new_err_addr_cnt, old_err_addr_cnt = err_data->err_addr_cnt; +kgd2kfd_set_sram_ecc_flag (adev->kfd.dev);if (adev->umc.funcs->query_ras_error_count) adev->umc.funcs->query_ras_error_count (adev, err_data);/* umc query_ras_error_address is also responsible for clearing * error status */ -if (adev->umc.funcs->query_ras_error_address) +if (adev->umc.funcs->query_ras_error_address) { +unsigned long *bps; +int i; + adev->umc.funcs->query_ras_error_address (adev, err_data); + new_err_addr_cnt = err_data->err_addr_cnt - old_err_addr_cnt; + +if (new_err_addr_cnt) { + bps =kcalloc (new_err_addr_cnt,sizeof (*bps),GFP_KERNEL ); +if (!bps) +return -ENOMEM ; + +for (i =0 ; i < new_err_addr_cnt; i++) + bps[i] = err_data->err_addr[old_err_addr_cnt + i] >>PAGE_SHIFT ; + +amdgpu_ras_add_bad_pages (adev, bps, new_err_addr_cnt); + +kfree (bps); + } + } +/* only uncorrectable error needs gpu reset */ if (err_data->ue_count)amdgpu_ras_reset_gpu (adev,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): 1565718642-18107-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
PATCH v2 1/1 drm/amdgpu: Start using amdgpu_ras_add_bad_pages
v2: Trigger GPU reset in case of new bad address errors.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +25 -2
@@ -243,17 +243,40 @@ static int gmc_v9_0_process_ras_data_cb(struct amdgpu_device *adev,struct ras_err_data *err_data, struct amdgpu_iv_entry *entry) { + unsigned long new_err_addr_cnt, old_err_addr_cnt; + new_err_addr_cnt =0 ; + old_err_addr_cnt = err_data->err_addr_cnt; +kgd2kfd_set_sram_ecc_flag (adev->kfd.dev);if (adev->umc.funcs->query_ras_error_count) adev->umc.funcs->query_ras_error_count (adev, err_data);/* umc query_ras_error_address is also responsible for clearing * error status */ -if (adev->umc.funcs->query_ras_error_address) +if (adev->umc.funcs->query_ras_error_address) { +unsigned long *bps; +int i; + adev->umc.funcs->query_ras_error_address (adev, err_data); + new_err_addr_cnt = err_data->err_addr_cnt - old_err_addr_cnt; + +if (new_err_addr_cnt) { + bps =kcalloc (new_err_addr_cnt,sizeof (*bps),GFP_KERNEL ); +if (!bps) +return -ENOMEM ; + +for (i =0 ; i < new_err_addr_cnt; i++) + bps[i] = err_data->err_addr[old_err_addr_cnt + i] >>PAGE_SHIFT ; + +amdgpu_ras_add_bad_pages (adev, bps, new_err_addr_cnt); + +kfree (bps); + } + } +/* only uncorrectable error needs gpu reset */ -if (err_data->ue_count) +if (err_data->ue_count || new_err_addr_cnt)amdgpu_ras_reset_gpu (adev,0 );return AMDGPU_RAS_SUCCESS ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi Andrey:
I'm also working on ras error address saving based on your eeprom patches, and the implementation is different from you. I'll send out my patches this week and we can discuss it.
Regards,
Tao
Quoted 60 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年8月14日 1:51
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Pan, Xinhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Fix null ptr when callingquery_ras_error_countras_err_data.err_addr was never allocated
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +15
-0@@ -1011,6 +1011,21 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj)int ret;struct ras_err_data err_data = {0 ,0 ,0 ,NULL }; +/* Allocate enough to serve max number of requests*/ +int err_addr_size = data->ring_size / data->aligned_element_size * + obj->adev->umc.umc_inst_num * + obj->adev->umc.channel_inst_num; + + err_data.err_addr =kcalloc (err_addr_size, +sizeof (*err_data.err_addr), +GFP_KERNEL ); + +if (!err_data.err_addr) { +DRM_ERROR ("Not enough memory!" ); +return ; + } + +while (data->rptr != data->wptr) {rmb ();memcpy(&entry, &data->ring[data->rptr], @@ -1039,6
+1054,8 @@ static voidamdgpu_ras_interrupt_handler(struct ras_manager *obj)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0} } } + +kfree (err_data.err_addr); } static void amdgpu_ras_interrupt_process_handler(struct work_struct*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): MN2PR12MB30542C37DA293DFADD11EE3EB0AD0-rweVpJHSKTqnT25eLM+iUQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Are you referring to this patch which fixes a crash or to the second patch in the serries ?
Andrey
________________________________________
From: Zhou1, Tao <[email protected]>
Sent: 13 August 2019 22:24:00
To: Grodzovsky, Andrey; [email protected]
Cc: Deucher, Alexander; Grodzovsky, Andrey; Pan, Xinhui; Zhang, Hawking
Subject: RE: [PATCH 1/2] drm/amdgpu: Fix null ptr when calling query_ras_error_count
Hi Andrey:
I'm also working on ras error address saving based on your eeprom patches, and the implementation is different from you. I'll send out my patches this week and we can discuss it.
Regards,
Tao
Quoted 60 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年8月14日 1:51
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Pan, Xinhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Fix null ptr when callingquery_ras_error_countras_err_data.err_addr was never allocated
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +15
-0@@ -1011,6 +1011,21 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj)int ret;struct ras_err_data err_data = {0 ,0 ,0 ,NULL }; +/* Allocate enough to serve max number of requests*/ +int err_addr_size = data->ring_size / data->aligned_element_size * + obj->adev->umc.umc_inst_num * + obj->adev->umc.channel_inst_num; + + err_data.err_addr =kcalloc (err_addr_size, +sizeof (*err_data.err_addr), +GFP_KERNEL ); + +if (!err_data.err_addr) { +DRM_ERROR ("Not enough memory!" ); +return ; + } + +while (data->rptr != data->wptr) {rmb ();memcpy(&entry, &data->ring[data->rptr], @@ -1039,6 +1054,8 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj) } } }drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0+ +kfree (err_data.err_addr); } static void amdgpu_ras_interrupt_process_handler(struct work_struct*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): MWHPR12MB1453F67B997561E00180AE67EAAD0-Gy0DoCVfaSWZBIDmKHdw+wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Referring to the series, patch #1 and #2.
Regards,
Tao
Quoted 74 lines
-----Original Message-----
From: Grodzovsky, Andrey <[email protected]>
Sent: 2019年8月14日 10:42
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Pan, Xinhui <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: Fix null ptr when callingquery_ras_error_countAre you referring to this patch which fixes a crash or to the second patch in the serries ?
Andrey
________________________________________
From: Zhou1, Tao <[email protected]>
Sent: 13 August 2019 22:24:00
To: Grodzovsky, Andrey; [email protected]
Cc: Deucher, Alexander; Grodzovsky, Andrey; Pan, Xinhui; Zhang, Hawking
Subject: RE: [PATCH 1/2] drm/amdgpu: Fix null ptr when callingquery_ras_error_countHi Andrey:
I'm also working on ras error address saving based on your eeprom patches, and the implementation is different from you.
I'll send out my patches this week and we can discuss it.Regards,
TaoQuoted 6 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: 2019年8月14日 1:51
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky,Andrey
Quoted 1 line
<[email protected]>; Pan, Xinhui <[email protected]>;
Zhang,
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static void
Quoted 17 lines
Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Fix null ptr when callingquery_ras_error_countras_err_data.err_addr was never allocated
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0@@ -1011,6 +1011,21 @@ static voidamdgpu_ras_interrupt_handler(struct
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12
-0ras_manager *obj)int ret;struct ras_err_data err_data = {0 ,0 ,0 ,NULL }; +/* Allocate enough to serve max number of requests*/ +int err_addr_size = data->ring_size / data->aligned_element_size * + obj->adev->umc.umc_inst_num * + obj->adev->umc.channel_inst_num; + + err_data.err_addr =kcalloc (err_addr_size, +sizeof (*err_data.err_addr), +GFP_KERNEL ); + +if (!err_data.err_addr) { +DRM_ERROR ("Not enough memory!" ); +return ;
Quoted 25 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3
-0+ } + +while (data->rptr != data->wptr) {rmb ();memcpy(&entry, &data->ring[data->rptr], @@ -1039,6+1054,8 @@ static void amdgpu_ras_interrupt_handler(struct
ras_managerQuoted 17 lines
*obj)
} } }drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0+ +kfree (err_data.err_addr); } static void amdgpu_ras_interrupt_process_handler(struct work_struct*work)
--
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