drm/amdgpu: add poison consumption flag for RAS IH
Subsystems (2)
PATCH 1/3 drm/amdgpu: add poison consumption flag for RAS IH
So we can distinguish RAS poison consumption interrupt from UE interrupt.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +7 -0
@@ -314,6 +314,11 @@ enum amdgpu_ras_ret { AMDGPU_RAS_PT, }; +enum amdgpu_ras_ih_flag { +AMDGPU_RAS_IH_POISON_CONSUMPTION =0 , +AMDGPU_RAS_IH_LAST , +}; +struct ras_common_if {enum amdgpu_ras_block block;enum amdgpu_ras_error_type type;
@@ -419,6 +424,8 @@ struct ras_ih_data {unsigned int aligned_element_size;unsigned int rptr;unsigned int wptr; +/* interrupt type flag */ +unsigned int flag; };struct ras_manager {
Signature · 1 line
2.35.1
PATCH 2/3 drm/amdgpu: implement RAS interrupt handler for non-poison type
Prepare for the implementation of poison interrupt handler.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 62 ++++++++++++++----------- 1 file changed, 35 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +35 -27
@@ -1515,12 +1515,44 @@ static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)/* ras fs end */ /* ih begin */ +static void ras_interrupt_handler_non_poison (struct ras_manager *obj, +struct amdgpu_iv_entry *entry) +{ +struct ras_ih_data *data = &obj->ih_data; +struct ras_err_data err_data = {0 ,0 ,0 ,NULL }; +int ret; + +if (!data->cb) +return ; + +if (amdgpu_ras_is_poison_mode_supported (obj->adev) && + obj->head.block ==AMDGPU_RAS_BLOCK__UMC ) +dev_info (obj->adev->dev, +"Poison is created, no user action is needed.\n" ); +else { +/* Let IP handle its data, maybe we need get the output +* from the callback to udpate the error type/count, etc +*/ + ret = data->cb (obj->adev, &err_data, entry); +/* ue will trigger an interrupt, and in that case +* we need do a reset to recovery the whole system. +* But leave IP do that recovery, here we just dispatch +* the error. +*/ +if (ret ==AMDGPU_RAS_SUCCESS ) { +/* these counts could be left as 0 if +* some blocks do not count error number +*/ + obj->err_data.ue_count += err_data.ue_count; + obj->err_data.ce_count += err_data.ce_count; + } + } +} +static void amdgpu_ras_interrupt_handler (struct ras_manager *obj) {struct ras_ih_data *data = &obj->ih_data;struct amdgpu_iv_entry entry; -int ret; -struct ras_err_data err_data = {0 ,0 ,0 ,NULL };while (data->rptr != data->wptr) {rmb ();
@@ -1531,31 +1563,7 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj) data->rptr = (data->aligned_element_size + data->rptr) % data->ring_size; -if (data->cb) { -if (amdgpu_ras_is_poison_mode_supported (obj->adev) && - obj->head.block ==AMDGPU_RAS_BLOCK__UMC ) -dev_info (obj->adev->dev, -"Poison is created, no user action is needed.\n" ); -else { -/* Let IP handle its data, maybe we need get the output -* from the callback to udpate the error type/count, etc -*/ -memset (&err_data,0 ,sizeof (err_data)); - ret = data->cb (obj->adev, &err_data, &entry); -/* ue will trigger an interrupt, and in that case -* we need do a reset to recovery the whole system. -* But leave IP do that recovery, here we just dispatch -* the error. -*/ -if (ret ==AMDGPU_RAS_SUCCESS ) { -/* these counts could be left as 0 if -* some blocks do not count error number -*/ - obj->err_data.ue_count += err_data.ue_count; - obj->err_data.ce_count += err_data.ce_count; - } - } - } +ras_interrupt_handler_non_poison (obj, &entry); } }
Signature · 1 line
2.35.1
PATCH 3/3 drm/amdgpu: add RAS poison consumption handler
In reply to Tao ZhouAdd support for common RAS posion consumption handler.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 39 ++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + 2 files changed, 39 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +38 -1
@@ -1515,6 +1515,38 @@ static int amdgpu_ras_fs_fini(struct amdgpu_device *adev)/* ras fs end */ /* ih begin */ +/* poison consumption handler */ +static void ras_interrupt_handler_poison (struct ras_manager *obj, +struct amdgpu_iv_entry *entry) +{ +bool poison_stat = true, need_reset = true; +struct amdgpu_device *adev = obj->adev; +struct ras_err_data err_data = {0 ,0 ,0 ,NULL }; +struct amdgpu_ras_block_object *block_obj = +amdgpu_ras_get_ras_block (adev, obj->head.block,0 ); + +if (!adev->gmc.xgmi.connected_to_cpu) +amdgpu_umc_poison_handler (adev, &err_data, false); + +if (block_obj && block_obj->hw_ops) { +if (block_obj->hw_ops->query_poison_status) { + poison_stat = block_obj->hw_ops->query_poison_status (adev); +if (!poison_stat) +dev_info (adev->dev,"No RAS poison status in %s poison IH.\n" , + block_obj->ras_comm.name); + } + +if (poison_stat && block_obj->hw_ops->handle_poison_consumption) { + poison_stat = block_obj->hw_ops->handle_poison_consumption (adev); + need_reset = poison_stat; + } + } + +/* gpu reset is fallback for all failed cases */ +if (need_reset) +amdgpu_ras_reset_gpu (adev); +} +static void ras_interrupt_handler_non_poison (struct ras_manager *obj,struct amdgpu_iv_entry *entry) {
@@ -1563,8 +1595,13 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj) data->rptr = (data->aligned_element_size + data->rptr) % data->ring_size; -ras_interrupt_handler_non_poison (obj, &entry); +if (data->flag & (1 <<AMDGPU_RAS_IH_POISON_CONSUMPTION )) +ras_interrupt_handler_poison (obj, &entry); +else +ras_interrupt_handler_non_poison (obj, &entry); } + + data->flag &= ~(1 <<AMDGPU_RAS_IH_POISON_CONSUMPTION ); }static void amdgpu_ras_interrupt_process_handler (struct work_struct *work)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
@@ -516,6 +516,7 @@ struct amdgpu_ras_block_hw_ops {void (*reset_ras_error_count)(struct amdgpu_device *adev);void (*reset_ras_error_status)(struct amdgpu_device *adev);bool (*query_poison_status)(struct amdgpu_device *adev); +bool (*handle_poison_consumption)(struct amdgpu_device *adev); };/* work flow
Signature · 1 line
2.35.1
[AMD Official Use Only]
Hi Tao,
According to the series patches, I have one question, is the ras_ih_flag set according to poison mode configuration, if yes, driver will handle poison once get ecc_irq interrupt, but at this moment there may no app to consumes it, this seems conflict the poison consumption definition.
Regards,
Stanley
Quoted 45 lines
-----邮件原件-----
发件人: Zhou1, Tao <[email protected]>
发送时间: Monday, April 11, 2022 7:08 PM
收件人: [email protected]; Lazar, Lijo <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Zhang, Hawking <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>
抄送: Zhou1, Tao <[email protected]>
主题: [PATCH 1/3] drm/amdgpu: add poison consumption flag for RAS IHSo we can distinguish RAS poison consumption interrupt from UE interrupt.
Signed-off-by Tao Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +7
-1@@ -314,6 +314,11 @@ enum amdgpu_ras_ret { AMDGPU_RAS_PT, }; +enum amdgpu_ras_ih_flag { +AMDGPU_RAS_IH_POISON_CONSUMPTION =0 , +AMDGPU_RAS_IH_LAST , +}; +struct ras_common_if {enum amdgpu_ras_block block;enum amdgpu_ras_error_type type;@@ -419,6 +424,8 @@ struct ras_ih_data {unsigned int aligned_element_size;unsigned int rptr;unsigned int wptr; +/* interrupt type flag */ +unsigned int flag; };struct ras_manager { --2.35.1
[AMD Official Use Only]
Hi Stanley,
The flag is set by RAS block poison irq handler, such as vcn/jpeg poison irq handler. It's not configured in RAS init.
Regards,
Tao
Quoted 67 lines
-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Monday, April 11, 2022 10:12 PM
To: Zhou1, Tao <[email protected]>; [email protected]; Lazar, Lijo <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Zhang, Hawking <[email protected]>; Chai, Thomas <[email protected]>
Subject: 回复: [PATCH 1/3] drm/amdgpu: add poison consumption flag for RAS IH[AMD Official Use Only]
Hi Tao,
According to the series patches, I have one question, is the
ras_ih_flagset according to poison mode configuration, if yes, driver will handle poison once getecc_irqinterrupt, but at this moment there may no app to consumes it, this seems conflict the poison consumption definition.Regards,
StanleyQuoted 45 lines
-----邮件原件-----
发件人: Zhou1, Tao <[email protected]>
发送时间: Monday, April 11, 2022 7:08 PM
收件人: [email protected]; Lazar, Lijo <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Zhang, Hawking <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>
抄送: Zhou1, Tao <[email protected]>
主题: [PATCH 1/3] drm/amdgpu: add poison consumption flag for RAS IHSo we can distinguish RAS poison consumption interrupt from UE interrupt.
Signed-off-by Tao Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +5
-0@@ -314,6 +314,11 @@ enum amdgpu_ras_ret { AMDGPU_RAS_PT, }; +enum amdgpu_ras_ih_flag { +AMDGPU_RAS_IH_POISON_CONSUMPTION =0 , +AMDGPU_RAS_IH_LAST , +}; +struct ras_common_if {enum amdgpu_ras_block block; enum amdgpu_ras_error_type type; @@ -419,6 +424,8 @@ structras_ih_data { unsigned int aligned_element_size; unsigned int rptr; unsigned int wptr;drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-1+/* interrupt type flag */ +unsigned int flag; };struct ras_manager { --2.35.1
The series is Reviewed-by: Stanley.Yang <[email protected]>
Regards,
Stanley
Quoted 91 lines
-----邮件原件-----
发件人: Zhou1, Tao <[email protected]>
发送时间: Tuesday, April 12, 2022 11:06 AM
收件人: Yang, Stanley <[email protected]>; amd- [email protected]; Lazar, Lijo <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Zhang, Hawking <[email protected]>; Chai, Thomas <[email protected]> 主题: RE: [PATCH 1/3] drm/amdgpu: add poison consumption flag for RAS IH[AMD Official Use Only]
Hi Stanley,
The flag is set by RAS block poison irq handler, such as vcn/jpeg poison irq handler. It's not configured in RAS init.
Regards,
TaoQuoted 6 lines
-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Monday, April 11, 2022 10:12 PM
To: Zhou1, Tao <[email protected]>; [email protected]; Lazar, Lijo <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Zhang, HawkingQuoted 4 lines
Chai, Thomas <[email protected]>
Subject: 回复: [PATCH 1/3] drm/amdgpu: add poison consumption flag for RAS IHQuoted 8 lines
[AMD Official Use Only]
Hi Tao,
According to the series patches, I have one question, is the
ras_ih_flagset according to poison mode configuration, if yes, driver will handle poison once getecc_irqinterrupt, but at this moment there may no app to consumes it, this seems conflict the poisonconsumption definition.
Quoted 10 lines
Regards,
StanleyQuoted 7 lines
-----邮件原件-----
发件人: Zhou1, Tao <[email protected]>
发送时间: Monday, April 11, 2022 7:08 PM
收件人: [email protected]; Lazar, Lijo <[email protected]>; Ziya, Mohammad zafar <[email protected]>; Zhang, Hawking <[email protected]>; Yang, Stanley <[email protected]>;Chai,
Quoted 5 lines
Quoted 5 lines
Thomas <[email protected]>
抄送: Zhou1, Tao <[email protected]>
主题: [PATCH 1/3] drm/amdgpu: add poison consumption flag for RAS IHSo we can distinguish RAS poison consumption interrupt from UE
interrupt.
Quoted 35 lines
Quoted 34 lines
Signed-off-by Tao Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +5
-0@@ -314,6 +314,11 @@ enum amdgpu_ras_ret { AMDGPU_RAS_PT, }; +enum amdgpu_ras_ih_flag { +AMDGPU_RAS_IH_POISON_CONSUMPTION =0 , +AMDGPU_RAS_IH_LAST , +}; +struct ras_common_if {enum amdgpu_ras_block block; enum amdgpu_ras_error_type type; @@ -419,6 +424,8 @@ structras_ih_data { unsigned int aligned_element_size; unsigned int rptr; unsigned int wptr;drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-1+/* interrupt type flag */ +unsigned int flag; };struct ras_manager { --2.35.1