From: "Liu, Leo" <Leo.Liu@amd.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>,
"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Cc: "amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: fix structurally dead code vcn_v2_5_hw_init
Date: Tue, 1 Oct 2019 21:46:26 +0000 [thread overview]
Message-ID: <dc76a52b-09a2-7ab9-b53e-52500f4f8669@amd.com> (raw)
In-Reply-To: <823b10a3-fe0e-2e8c-02c3-534944dbe6d2@embeddedor.com>
On 2019-10-01 5:43 p.m., Gustavo A. R. Silva wrote:
> Hi,
>
> On 10/1/19 16:29, Liu, Leo wrote:
>> On 2019-10-01 1:16 p.m., Gustavo A. R. Silva wrote:
>>> 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")
>>> Fixes: 28c17d72072b ("drm/amdgpu: add VCN2.5 basic supports")
>>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>>> ---
>>>
>>> Any feedback is greatly appreciated.
>>>
>>> drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 5 +++--
>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
>>> index 395c2259f979..47b0dcd59e13 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
>>> @@ -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()
>>
> I see... so in the following commit 1b61de45dfaf ("drm/amdgpu: add initial VCN2.0 support (v2)")
> that line is also redundant?
Yes.
>>> 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;
>> 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?
That could be better.
Thanks,
Leo
>
> Thanks
> --
> Gustavo
>
>>> 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;
next prev parent reply other threads:[~2019-10-01 21:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 17:16 Gustavo A. R. Silva
2019-10-01 21:29 ` Liu, Leo
2019-10-01 21:43 ` Gustavo A. R. Silva
2019-10-01 21:46 ` Liu, Leo [this message]
2019-10-01 21:57 ` Gustavo A. R. Silva
2019-10-01 22:21 ` Liu, Leo
2019-10-02 13:32 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc76a52b-09a2-7ab9-b53e-52500f4f8669@amd.com \
--to=leo.liu@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=David1.Zhou@amd.com \
--cc=airlied@linux.ie \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®