Re: [PATCH 4/4] drm/scheduler: do not keep a copy of sched list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 10.12.19 um 14:00 schrieb Christian König:
Am 10.12.19 um 13:53 schrieb Nirmoy Das:
entity should not keep copy and maintain sched list for
itself.

Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxx>
---
  drivers/gpu/drm/scheduler/sched_entity.c | 10 +---------
  1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index f9b6ce29c58f..a5f729f421f8 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -67,17 +67,10 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
      entity->guilty = guilty;
      entity->num_sched_list = num_sched_list;
      entity->priority = priority;
-    entity->sched_list =  kcalloc(num_sched_list,
-                      sizeof(struct drm_gpu_scheduler *), GFP_KERNEL);
+    entity->sched_list =  sched_list;

Maybe make this "num_sched_list > 1 ? sched_list : NULL" to avoid accidentally dereferencing a stale pointer to the stack.

  -    if(!entity->sched_list)
-        return -ENOMEM;
        init_completion(&entity->entity_idle);
-
-    for (i = 0; i < num_sched_list; i++)
-        entity->sched_list[i] = sched_list[i];
-
      if (num_sched_list)

That check can actually be dropped as well. We return -EINVAL when the num_sched_list is zero.

Regards,
Christian.

          entity->rq = &entity->sched_list[0]->sched_rq[entity->priority];

Forgot to note that this should then probably use "sched_list[0]->sched_rq[entity->priority]" directly when we change the assignment above.

Christian.

  @@ -312,7 +305,6 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity)
        dma_fence_put(entity->last_scheduled);
      entity->last_scheduled = NULL;
-    kfree(entity->sched_list);
  }
  EXPORT_SYMBOL(drm_sched_entity_fini);

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux