drm/amdgpu: Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function
Subsystems (2)
PATCH 1/2 drm/amdgpu: Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function
Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function.
--- 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
@@ -2754,7 +2754,7 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)int amdgpu_ras_register_ras_block (struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { -if (!adev || !ras_block_obj) +if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ;INIT_LIST_HEAD (&ras_block_obj->node);
Signature · 1 line
2.25.1
PATCH 2/2 drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
No longer insert ras blocks into ras_list if it already exists in ras_list.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +8 -0
@@ -2754,9 +2754,17 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)int amdgpu_ras_register_ras_block (struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { +struct amdgpu_ras_block_object *obj, *tmp;if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ; +/* If the ras object had been in ras_list, doesn't add it to ras_list again */ +list_for_each_entry_safe (obj, tmp, &adev->ras_list, node) { +if (obj == ras_block_obj) { +return 0 ; + } + } +INIT_LIST_HEAD (&ras_block_obj->node);list_add_tail (&ras_block_obj->node, &adev->ras_list);
Signature · 1 line
2.25.1
RE: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
[AMD Official Use Only]
Quoted 23 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Wednesday, January 12, 2022 3:48 PM
To: [email protected]
Cc: Chai, Thomas <[email protected]>; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks intoras_listif it already exists inras_listNo longer insert ras blocks into
ras_listif it already exists inras_list.Signed-off-by yipechai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_reset_gpu(struct amdgpu_device · line 2760
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0@@ -2754,9 +2754,17 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { +struct amdgpu_ras_block_object *obj, *tmp;if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ; +/* If the ras object had been in ras_list, doesn't add it to ras_list again */
[Tao] How about "If the ras object is in ras_list, don't add it again"
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) · line 2766
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5
-0+list_for_each_entry_safe (obj, tmp, &adev->ras_list, node) { +if (obj == ras_block_obj) { +return 0 ; + } + }
[Tao] The patch is OK for me currently, but I think the root cause is we initialize adev->gmc.xgmi.ras in gmc_ras_late_init, the initialization should be called only in modprobe stage and we can create a general gmc_early_init for it.
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1+INIT_LIST_HEAD (&ras_block_obj->node);list_add_tail (&ras_block_obj->node, &adev->ras_list); --2.25.1
RE: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Wednesday, January 12, 2022 4:37 PM
To: Chai, Thomas <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Clements, John <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
[AMD Official Use Only]
Quoted 31 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Wednesday, January 12, 2022 3:48 PM
To: [email protected]
Cc: Chai, Thomas <[email protected]>; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks intoras_listif it already exists inras_listNo longer insert ras blocks into
ras_listif it already exists inras_list.Signed-off-by yipechai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3
-0@@ -2754,9 +2754,17 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { +struct amdgpu_ras_block_object *obj, *tmp;if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ; +/* If the ras object had been in ras_list, doesn't add it to +ras_list again */
Quoted 1 line
[Tao] How about "If the ras object is in
ras_list, don't add it again"
[Thomas] OK
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5
-0+list_for_each_entry_safe (obj, tmp, &adev->ras_list, node) { +if (obj == ras_block_obj) { +return 0 ; + } + }[Tao] The patch is OK for me currently, but I think the root cause is we initialize
adev->gmc.xgmi.rasingmc_ras_late_init, the initialization should be called only in modprobe stage and we can create a generalgmc_early_initfor it.
[Thomas] This can create a new task to do it.
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1+INIT_LIST_HEAD (&ras_block_obj->node);list_add_tail (&ras_block_obj->node, &adev->ras_list); --2.25.1
Re: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
In reply to Zhou1, TaoQuoted 37 lines · Tao
[AMD Official Use Only]
Quoted 23 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Wednesday, January 12, 2022 3:48 PM
To: [email protected]
Cc: Chai, Thomas <[email protected]>; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks intoras_listif it already exists inras_listNo longer insert ras blocks into
ras_listif it already exists inras_list.Signed-off-by yipechai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_reset_gpu(struct amdgpu_device · line 2760
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-0@@ -2754,9 +2754,17 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { +struct amdgpu_ras_block_object *obj, *tmp;if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ; +/* If the ras object had been in ras_list, doesn't add it to ras_list again */ [Tao] How about "If the ras object is in
ras_list, don't add it again"
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) · line 2766
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5
-0+list_for_each_entry_safe (obj, tmp, &adev->ras_list, node) { +if (obj == ras_block_obj) { +return 0 ; + } + }[Tao] The patch is OK for me currently, but I think the root cause is we initialize
adev->gmc.xgmi.rasingmc_ras_late_init, the initialization should be called only in modprobe stage and we can create a generalgmc_early_initfor it.
Yes, please fix the root cause. We should only be adding the blocks once. This is just papering over the actual problem.
Alex
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1+INIT_LIST_HEAD (&ras_block_obj->node);list_add_tail (&ras_block_obj->node, &adev->ras_list); --2.25.1
Re: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
In reply to yipechaiAm 2022-01-12 um 2:48 a.m. schrieb yipechai:
Quoted 12 lines
No longer insert ras blocks into
ras_listif it already exists inras_list.Signed-off-by yipechai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) · line 2763
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0@@ -2754,9 +2754,17 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)int amdgpu_ras_register_ras_block (struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { +struct amdgpu_ras_block_object *obj, *tmp;if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ; +/* If the ras object had been in ras_list, doesn't add it to ras_list again */ +list_for_each_entry_safe (obj, tmp, &adev->ras_list, node) { +if (obj == ras_block_obj) {
Instead of a loop, can't this be done more efficiently with "if (!list_empty(&ras_block_obj->node))"?
Of course this would require that you move the INIT_LIST_HEAD to some earlier stage so that list_empty is reliable.
Regards,
Felix
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0+return 0 ; + } + } +INIT_LIST_HEAD (&ras_block_obj->node);list_add_tail (&ras_block_obj->node, &adev->ras_list);
RE: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
Hi Felix:
amdgpu_ras_register_ras_block was called by all IP ras blocks, and every ip also has different ras versions. We do common work together, which can reduce the chance of the ras function going wrong.
-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Thursday, January 13, 2022 12:39 AM
To: Chai, Thomas <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>; Zhang, Hawking <[email protected]>; Clements, John <[email protected]>; Chai, Thomas <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: No longer insert ras blocks into ras_list if it already exists in ras_list
Am 2022-01-12 um 2:48 a.m. schrieb yipechai:
Quoted 13 lines
No longer insert ras blocks into
ras_listif it already exists inras_list.Signed-off-by yipechai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_reset_gpu(struct amdgpu_device · line 2762
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0@@ -2754,9 +2754,17 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { +struct amdgpu_ras_block_object *obj, *tmp;if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ; +/* If the ras object had been in ras_list, doesn't add it to ras_list again */ +list_for_each_entry_safe (obj, tmp, &adev->ras_list, node) { +if (obj == ras_block_obj) {
Instead of a loop, can't this be done more efficiently with "if (!list_empty(&ras_block_obj->node))"?
Of course this would require that you move the INIT_LIST_HEAD to some earlier stage so that list_empty is reliable.
Regards,
Felix
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4
-0+return 0 ; + } + } +INIT_LIST_HEAD (&ras_block_obj->node);list_add_tail (&ras_block_obj->node, &adev->ras_list);
[AMD Official Use Only]
Quoted 9 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Wednesday, January 12, 2022 3:48 PM
To: [email protected]
Cc: Chai, Thomas <[email protected]>; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function
[Tao] The subject is too long, I think "add ras supported check for register_ras_block" is enough.
Quoted 15 lines
Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function.
Signed-off-by yipechai <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c int amdgpu_ras_reset_gpu(struct amdgpu_device · line 2757
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1@@ -2754,7 +2754,7 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { -if (!adev || !ras_block_obj) +if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ;
[Tao] Can we return 0 if !amdgpu_ras_asic_supported(adev)? It's not an error.
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-1INIT_LIST_HEAD (&ras_block_obj->node); --2.25.1
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Wednesday, January 12, 2022 4:28 PM
To: Chai, Thomas <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Clements, John <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function
[AMD Official Use Only]
Quoted 11 lines
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Wednesday, January 12, 2022 3:48 PM
To: [email protected]
Cc: Chai, Thomas <[email protected]>; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function
Quoted 1 line
[Tao] The subject is too long, I think "add ras supported check for
register_ras_block" is enough.
[Thomas] Ok.
Quoted 21 lines
Add a filter condition to restrict the SW ras function to be registered only by asics whose hardware supports the ras function.
Signed-off-by yipechai <[email protected]>--- 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@@ -2754,7 +2754,7 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev) int amdgpu_ras_register_ras_block(struct amdgpu_device *adev,struct amdgpu_ras_block_object * ras_block_obj) { -if (!adev || !ras_block_obj) +if (!adev || !amdgpu_ras_asic_supported (adev) || !ras_block_obj)return -EINVAL ;
Quoted 1 line
[Tao] Can we return 0 if !amdgpu_ras_asic_supported(adev)? It's not an error.
[Thomas] OK.
Quoted 4 lines
INIT_LIST_HEAD(&ras_block_obj->node);
--
2.25.1