2022-07-19 10:50:17

by Andrey Strachuk

[permalink] [raw]
Subject: [PATCH] drm/amdgpu: remove useless condition in amdgpu_job_stop_all_jobs_on_sched()

Local variable 'rq' is initialized by an address
of field of drm_sched_job, so it does not make
sense to compare 'rq' with NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Strachuk <[email protected]>
Fixes: 7c6e68c777f1 ("drm/amdgpu: Avoid HW GPU reset for RAS.")
---
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index 67f66f2f1809..600401f2a98f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -285,10 +285,6 @@ void amdgpu_job_stop_all_jobs_on_sched(struct drm_gpu_scheduler *sched)
/* Signal all jobs not yet scheduled */
for (i = DRM_SCHED_PRIORITY_COUNT - 1; i >= DRM_SCHED_PRIORITY_MIN; i--) {
struct drm_sched_rq *rq = &sched->sched_rq[i];
-
- if (!rq)
- continue;
-
spin_lock(&rq->lock);
list_for_each_entry(s_entity, &rq->entities, list) {
while ((s_job = to_drm_sched_job(spsc_queue_pop(&s_entity->job_queue)))) {
--
2.25.1


2022-07-25 16:58:38

by Andrey Grodzovsky

[permalink] [raw]
Subject: Re: [PATCH] drm/amdgpu: remove useless condition in amdgpu_job_stop_all_jobs_on_sched()

Reviewed-by: Andrey Grodzovsky <[email protected]>

Andrey

On 2022-07-19 06:39, Andrey Strachuk wrote:
> Local variable 'rq' is initialized by an address
> of field of drm_sched_job, so it does not make
> sense to compare 'rq' with NULL.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Andrey Strachuk <[email protected]>
> Fixes: 7c6e68c777f1 ("drm/amdgpu: Avoid HW GPU reset for RAS.")
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 67f66f2f1809..600401f2a98f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -285,10 +285,6 @@ void amdgpu_job_stop_all_jobs_on_sched(struct drm_gpu_scheduler *sched)
> /* Signal all jobs not yet scheduled */
> for (i = DRM_SCHED_PRIORITY_COUNT - 1; i >= DRM_SCHED_PRIORITY_MIN; i--) {
> struct drm_sched_rq *rq = &sched->sched_rq[i];
> -
> - if (!rq)
> - continue;
> -
> spin_lock(&rq->lock);
> list_for_each_entry(s_entity, &rq->entities, list) {
> while ((s_job = to_drm_sched_job(spsc_queue_pop(&s_entity->job_queue)))) {

2022-08-12 11:19:40

by Christian König

[permalink] [raw]
Subject: Re: [PATCH] drm/amdgpu: remove useless condition in amdgpu_job_stop_all_jobs_on_sched()

@Alex was that one already picked up?

Am 25.07.22 um 18:40 schrieb Andrey Grodzovsky:
> Reviewed-by: Andrey Grodzovsky <[email protected]>
>
> Andrey
>
> On 2022-07-19 06:39, Andrey Strachuk wrote:
>> Local variable 'rq' is initialized by an address
>> of field of drm_sched_job, so it does not make
>> sense to compare 'rq' with NULL.
>>
>> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>>
>> Signed-off-by: Andrey Strachuk <[email protected]>
>> Fixes: 7c6e68c777f1 ("drm/amdgpu: Avoid HW GPU reset for RAS.")
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 4 ----
>>   1 file changed, 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> index 67f66f2f1809..600401f2a98f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> @@ -285,10 +285,6 @@ void amdgpu_job_stop_all_jobs_on_sched(struct
>> drm_gpu_scheduler *sched)
>>       /* Signal all jobs not yet scheduled */
>>       for (i = DRM_SCHED_PRIORITY_COUNT - 1; i >=
>> DRM_SCHED_PRIORITY_MIN; i--) {
>>           struct drm_sched_rq *rq = &sched->sched_rq[i];
>> -
>> -        if (!rq)
>> -            continue;
>> -
>>           spin_lock(&rq->lock);
>>           list_for_each_entry(s_entity, &rq->entities, list) {
>>               while ((s_job =
>> to_drm_sched_job(spsc_queue_pop(&s_entity->job_queue)))) {

2022-08-16 00:51:16

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drm/amdgpu: remove useless condition in amdgpu_job_stop_all_jobs_on_sched()

Applied. Thanks!

On Fri, Aug 12, 2022 at 7:13 AM Christian König
<[email protected]> wrote:
>
> @Alex was that one already picked up?
>
> Am 25.07.22 um 18:40 schrieb Andrey Grodzovsky:
> > Reviewed-by: Andrey Grodzovsky <[email protected]>
> >
> > Andrey
> >
> > On 2022-07-19 06:39, Andrey Strachuk wrote:
> >> Local variable 'rq' is initialized by an address
> >> of field of drm_sched_job, so it does not make
> >> sense to compare 'rq' with NULL.
> >>
> >> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> >>
> >> Signed-off-by: Andrey Strachuk <[email protected]>
> >> Fixes: 7c6e68c777f1 ("drm/amdgpu: Avoid HW GPU reset for RAS.")
> >> ---
> >> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 4 ----
> >> 1 file changed, 4 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> >> index 67f66f2f1809..600401f2a98f 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> >> @@ -285,10 +285,6 @@ void amdgpu_job_stop_all_jobs_on_sched(struct
> >> drm_gpu_scheduler *sched)
> >> /* Signal all jobs not yet scheduled */
> >> for (i = DRM_SCHED_PRIORITY_COUNT - 1; i >=
> >> DRM_SCHED_PRIORITY_MIN; i--) {
> >> struct drm_sched_rq *rq = &sched->sched_rq[i];
> >> -
> >> - if (!rq)
> >> - continue;
> >> -
> >> spin_lock(&rq->lock);
> >> list_for_each_entry(s_entity, &rq->entities, list) {
> >> while ((s_job =
> >> to_drm_sched_job(spsc_queue_pop(&s_entity->job_queue)))) {
>