drm/amdgpu: fix structurally dead code vcn_v2_5_hw_init
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix structurally dead code vcn_v2_5_hw_init
Notice that there is a *continue* statement in the middle of the for loop and that prevents the code below from ever being reached:
r = amdgpu_ring_test_ring(ring);
if (r) {
ring->sched.ready = false;
goto done;
}Fix this by removing the continue statement and updating ring->sched.ready to true before calling amdgpu_ring_test_ring(ring).
Notice that this fix is based on
commit 1b61de45dfaf ("drm/amdgpu: add initial VCN2.0 support (v2)")
Addresses-Coverity-ID 1485608 ("Structurally dead code")
---
Any feedback is greatly appreciated.
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +3 -2
@@ -258,6 +258,7 @@ static int vcn_v2_5_hw_init(void *handle) adev->nbio_funcs->vcn_doorbell_range (adev, ring->use_doorbell, ring->doorbell_index, j); + ring->sched.ready = true; r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;
@@ -266,8 +267,7 @@ static int vcn_v2_5_hw_init(void *handle)for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.inst[j].ring_enc[i]; - ring->sched.ready = false; -continue ; + ring->sched.ready = true; r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;
@@ -276,6 +276,7 @@ static int vcn_v2_5_hw_init(void *handle) } ring = &adev->vcn.inst[j].ring_jpeg; + ring->sched.ready = true; r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;
Signature · 1 line
2.23.0
Quoted 30 lines · Gustavo A. R. Silva
Notice that there is a *continue* statement in the middle of the for loop and that prevents the code below from ever being reached:
r = amdgpu_ring_test_ring(ring); if (r) { ring->sched.ready = false; goto done; }Fix this by removing the continue statement and updating
ring->sched.readyto true before callingamdgpu_ring_test_ring(ring).Notice that this fix is based on
commit1b61de45dfaf("drm/amdgpu: add initial VCN2.0 support (v2)")Addresses-Coverity-ID 1485608 ("Structurally dead code")
Fixes 28c17d72072b ("drm/amdgpu: add VCN2.5 basic supports")Signed-off-by Gustavo A. R. Silva <[email protected]>---
Any feedback is greatly appreciated.
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0
-0
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 261
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-0@@ -258,6 +258,7 @@ static int vcn_v2_5_hw_init(void *handle) adev->nbio_funcs->vcn_doorbell_range (adev, ring->use_doorbell, ring->doorbell_index, j); + ring->sched.ready = true;
This is redundant. all the sched->ready is initialized as true, please refer to drm_sched_init()
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 270
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-2r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;@@ -266,8 +267,7 @@ static int vcn_v2_5_hw_init(void *handle)for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.inst[j].ring_enc[i]; - ring->sched.ready = false; -continue ; + ring->sched.ready = true;
Because the VCN 2.5 FW still has issue for encode, so we have it disabled here.
Regards,
Leo
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 282
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-0r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;@@ -276,6 +276,7 @@ static int vcn_v2_5_hw_init(void *handle) } ring = &adev->vcn.inst[j].ring_jpeg; + ring->sched.ready = true; r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi,
Quoted 35 lines · Leo
Quoted 33 lines · Gustavo A. R. Silva
Notice that there is a *continue* statement in the middle of the for loop and that prevents the code below from ever being reached:
r = amdgpu_ring_test_ring(ring); if (r) { ring->sched.ready = false; goto done; }Fix this by removing the continue statement and updating
ring->sched.readyto true before callingamdgpu_ring_test_ring(ring).Notice that this fix is based on
commit1b61de45dfaf("drm/amdgpu: add initial VCN2.0 support (v2)")Addresses-Coverity-ID 1485608 ("Structurally dead code")
Fixes 28c17d72072b ("drm/amdgpu: add VCN2.5 basic supports")Signed-off-by Gustavo A. R. Silva <[email protected]>---
Any feedback is greatly appreciated.
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0
-0@@ -258,6 +258,7 @@ static int vcn_v2_5_hw_init(void *handle) adev->nbio_funcs->vcn_doorbell_range (adev, ring->use_doorbell, ring->doorbell_index, j);
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 261
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-0+ ring->sched.ready = true;This is redundant. all the
sched->readyis initialized as true, please refer todrm_sched_init()
I see... so in the following commit 1b61de45dfaf ("drm/amdgpu: add initial VCN2.0 support (v2)") that line is also redundant?
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0
-0r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;@@ -266,8 +267,7 @@ static int vcn_v2_5_hw_init(void *handle)
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 270
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-2for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.inst[j].ring_enc[i]; - ring->sched.ready = false; -continue ; + ring->sched.ready = true;Because the VCN 2.5 FW still has issue for encode, so we have it disabled here.
OK. So, maybe we can add a comment pointing that out?
Thanks
--
Gustavo
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-0r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;@@ -276,6 +276,7 @@ static int vcn_v2_5_hw_init(void *handle) } ring = &adev->vcn.inst[j].ring_jpeg; + ring->sched.ready = true; r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;
Quoted 37 lines · Gustavo A. R. Silva
Hi,
Quoted 34 lines · Leo
Quoted 33 lines · Gustavo A. R. Silva
Notice that there is a *continue* statement in the middle of the for loop and that prevents the code below from ever being reached:
r = amdgpu_ring_test_ring(ring); if (r) { ring->sched.ready = false; goto done; }Fix this by removing the continue statement and updating
ring->sched.readyto true before callingamdgpu_ring_test_ring(ring).Notice that this fix is based on
commit1b61de45dfaf("drm/amdgpu: add initial VCN2.0 support (v2)")Addresses-Coverity-ID 1485608 ("Structurally dead code")
Fixes 28c17d72072b ("drm/amdgpu: add VCN2.5 basic supports")Signed-off-by Gustavo A. R. Silva <[email protected]>---
Any feedback is greatly appreciated.
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0
-0@@ -258,6 +258,7 @@ static int vcn_v2_5_hw_init(void *handle) adev->nbio_funcs->vcn_doorbell_range (adev, ring->use_doorbell, ring->doorbell_index, j);
Quoted 6 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 261
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-0+ ring->sched.ready = true;This is redundant. all the
sched->readyis initialized as true, please refer todrm_sched_init()I see... so in the following commit
1b61de45dfaf("drm/amdgpu: add initial VCN2.0 support (v2)") that line is also redundant?
Yes.
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0
-0r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;@@ -266,8 +267,7 @@ static int vcn_v2_5_hw_init(void *handle)Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 270
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-2for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.inst[j].ring_enc[i]; - ring->sched.ready = false; -continue ; + ring->sched.ready = true;Because the VCN 2.5 FW still has issue for encode, so we have it disabled here.
Quoted 1 line
OK. So, maybe we can add a comment pointing that out?
That could be better.
Thanks,
Leo
Quoted 11 lines
Thanks
--
GustavoQuoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0
-0r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;@@ -276,6 +276,7 @@ static int vcn_v2_5_hw_init(void *handle) }
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 282
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-0ring = &adev->vcn.inst[j].ring_jpeg; + ring->sched.ready = true; r =amdgpu_ring_test_ring (ring);if (r) { ring->sched.ready = false;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 9 lines · Leo
Quoted 6 lines
Quoted 4 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ ring->sched.ready = true;This is redundant. all the
sched->readyis initialized as true, please refer todrm_sched_init()I see... so in the following commit
1b61de45dfaf("drm/amdgpu: add initial VCN2.0 support (v2)") that line is also redundant?Yes.
OK.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 270
Quoted 11 lines
r = amdgpu_ring_test_ring(ring); if (r) { ring->sched.ready = false;drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-2@@ -266,8 +267,7 @@ static int vcn_v2_5_hw_init(void *handle)for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.inst[j].ring_enc[i]; - ring->sched.ready = false; -continue ; + ring->sched.ready = true;Because the VCN 2.5 FW still has issue for encode, so we have it disabled here.
Quoted 4 lines
Quoted 1 line
OK. So, maybe we can add a comment pointing that out?
That could be better.
Great. I'm glad it's not a bug. I'll write a patch for that so other people don't waste time taking a look.
I appreciate your feedback.
Thanks
--
Gustavo
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 26 lines · Gustavo A. R. Silva
Quoted 8 lines · Leo
Quoted 6 lines
Quoted 4 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ ring->sched.ready = true;This is redundant. all the
sched->readyis initialized as true, please refer todrm_sched_init()I see... so in the following commit
1b61de45dfaf("drm/amdgpu: add initial VCN2.0 support (v2)") that line is also redundant?Yes.
OK.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c static int vcn_v2_5_hw_init(void *handle) · line 270
Quoted 10 lines
r = amdgpu_ring_test_ring(ring); if (r) { ring->sched.ready = false;drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1
-2@@ -266,8 +267,7 @@ static int vcn_v2_5_hw_init(void *handle)for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.inst[j].ring_enc[i]; - ring->sched.ready = false; -continue ; + ring->sched.ready = true;Because the VCN 2.5 FW still has issue for encode, so we have it disabled here.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
OK. So, maybe we can add a comment pointing that out?
That could be better.
Great. I'm glad it's not a bug. I'll write a patch for that so other people don't waste time taking a look.
Thanks, just sent two patches to add comment, and long with the patch to make VCN ring ready properly.
Leo
Quoted 5 lines
I appreciate your feedback.
Thanks
--
Gustavo
Quoted 9 lines · Leo
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
OK. So, maybe we can add a comment pointing that out?
That could be better.
Great. I'm glad it's not a bug. I'll write a patch for that so other people don't waste time taking a look.
Thanks, just sent two patches to add comment, and long with the patch to make VCN ring ready properly.
Awesome. Thank you. I would just add a commit log to this patch:
[PATCH 2/2] drm/amdgpu: add a comment to VCN 2.5 encode ring
I'd update the subject to: drm/amdgpu: add code comment in vcn_v2_5_hw_init and add this as a commit log: Add a comment to VCN 2.5 encode ring
Also, I think it's important to follow the process and CC all the people and lists below:
$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c Alex Deucher <[email protected]> (supporter:RADEON and AMDGPU DRM DRIVERS) "Christian König" <[email protected]> (supporter:RADEON and AMDGPU DRM DRIVERS) "David (ChunMing) Zhou" <[email protected]> (supporter:RADEON and AMDGPU DRM DRIVERS) David Airlie <[email protected]> (maintainer:DRM DRIVERS) Daniel Vetter <[email protected]> (maintainer:DRM DRIVERS) [email protected] (open list:RADEON and AMDGPU DRM DRIVERS) [email protected] (open list:DRM DRIVERS) [email protected] (open list)
Thanks
--
Gustavo