drm/scheduler: modify API to avoid redundancy
Subsystems (6)
PATCH 1/2 drm/scheduler: modify API to avoid redundancy
entity has a scheduler field and we don't need the sched argument in any of the functions where entity is provided.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 ++-- drivers/gpu/drm/scheduler/gpu_scheduler.c | 20 +++++++++++--------- drivers/gpu/drm/v3d/v3d_drv.c | 4 +--- drivers/gpu/drm/v3d/v3d_gem.c | 2 -- include/drm/gpu_scheduler.h | 10 +++------- 13 files changed, 30 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -1232,7 +1232,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, job = p->job; p->job =NULL ; - r =drm_sched_job_init (&job->base, &ring->sched, entity, p->filp); + r =drm_sched_job_init (&job->base, entity, p->filp);if (r) {amdgpu_job_free (job);amdgpu_mn_unlock (p->mn);
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +5 -8
@@ -104,8 +104,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, failed:for (j =0 ; j < i; j++) -drm_sched_entity_destroy (&adev->rings[j]->sched, - &ctx->rings[j].entity); +drm_sched_entity_destroy (&ctx->rings[j].entity);kfree (ctx->fences); ctx->fences =NULL ;return r;
@@ -178,8 +177,7 @@ static void amdgpu_ctx_do_release(struct kref *ref)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; -drm_sched_entity_destroy (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_destroy (&ctx->rings[i].entity); }amdgpu_ctx_fini (ref);
@@ -466,8 +464,8 @@ void amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; - max_wait =drm_sched_entity_flush (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity, max_wait); + max_wait =drm_sched_entity_flush (&ctx->rings[i].entity, + max_wait); } }mutex_unlock (&mgr->lock);
@@ -492,8 +490,7 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ;if (kref_read (&ctx->refcount) ==1 ) -drm_sched_entity_fini (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_fini (&ctx->rings[i].entity);else DRM_ERROR ("ctx %p is still alive\n" , ctx); }
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -1
@@ -133,7 +133,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,if (!f)return -EINVAL ; - r =drm_sched_job_init (&job->base, entity->sched, entity, owner); + r =drm_sched_job_init (&job->base, entity, owner);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
@@ -1925,8 +1925,7 @@ void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable)return ; } }else { -drm_sched_entity_destroy (adev->mman.entity.sched, - &adev->mman.entity); +drm_sched_entity_destroy (&adev->mman.entity); }/* this just adjusts TTM size idea, which sets lpfn to the correct value */
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -2
@@ -305,8 +305,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) {int i, j; -drm_sched_entity_destroy (&adev->uvd.inst->ring.sched, - &adev->uvd.entity); +drm_sched_entity_destroy (&adev->uvd.entity);for (j =0 ; j < adev->uvd.num_uvd_inst; ++j) {kfree (adev->uvd.inst[j].saved_bo);
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
@@ -221,7 +221,7 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)if (adev->vce.vcpu_bo ==NULL )return 0 ; -drm_sched_entity_destroy (&adev->vce.ring[0 ].sched, &adev->vce.entity); +drm_sched_entity_destroy (&adev->vce.entity);amdgpu_bo_free_kernel (&adev->vce.vcpu_bo, &adev->vce.gpu_addr, (void **)&adev->vce.cpu_addr);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
@@ -2642,7 +2642,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, vm->root.base.bo =NULL ; error_free_sched_entity: -drm_sched_entity_destroy (&ring->sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);return r; }
@@ -2779,7 +2779,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)spin_unlock_irqrestore (&adev->vm_manager.pasid_lock, flags); } -drm_sched_entity_destroy (vm->entity.sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);if (!RB_EMPTY_ROOT (&vm->va.rb_root)) {dev_err (adev->dev,"still active bo inside vm\n" );
drivers/gpu/drm/etnaviv/etnaviv_drv.c +1 -2
@@ -78,8 +78,7 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file) gpu->lastctx =NULL ;mutex_unlock (&gpu->lock); -drm_sched_entity_destroy (&gpu->sched, - &ctx->sched_entity[i]); +drm_sched_entity_destroy (&ctx->sched_entity[i]); } }
drivers/gpu/drm/etnaviv/etnaviv_sched.c +2 -2
@@ -118,8 +118,8 @@ int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity, {int ret; - ret =drm_sched_job_init (&submit->sched_job, &submit->gpu->sched, - sched_entity, submit->cmdbuf.ctx); + ret =drm_sched_job_init (&submit->sched_job, sched_entity, + submit->cmdbuf.ctx);if (ret)return ret;
drivers/gpu/drm/scheduler/gpu_scheduler.c +11 -9
@@ -273,11 +273,12 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,* * Returns the remaining time in jiffies left from the input timeout */ -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout) +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout) { +struct drm_gpu_scheduler *sched;long ret = timeout; + sched = entity->sched;if (!drm_sched_entity_is_initialized (sched, entity))return ret;/**
@@ -312,10 +313,11 @@ EXPORT_SYMBOL(drm_sched_entity_flush);* entity and signals all jobs with an error code if the process was killed. * */ -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_fini (struct drm_sched_entity *entity) { +struct drm_gpu_scheduler *sched; + sched = entity->sched;drm_sched_entity_set_rq (entity,NULL );/* Consumption of existing IBs wasn't completed. Forcefully
@@ -373,11 +375,10 @@ EXPORT_SYMBOL(drm_sched_entity_fini);* * Calls drm_sched_entity_do_release() and drm_sched_entity_cleanup() */ -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_destroy (struct drm_sched_entity *entity) { -drm_sched_entity_flush (sched, entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); -drm_sched_entity_fini (sched, entity); +drm_sched_entity_flush (entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); +drm_sched_entity_fini (entity); }EXPORT_SYMBOL (drm_sched_entity_destroy);
@@ -740,10 +741,11 @@ EXPORT_SYMBOL(drm_sched_job_recovery);* Returns 0 for success, negative error code otherwise. */ int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner) { +struct drm_gpu_scheduler *sched = entity->sched; + job->sched = sched; job->entity = entity; job->s_priority = entity->rq - sched->sched_rq;
drivers/gpu/drm/v3d/v3d_drv.c +1 -3
@@ -145,13 +145,11 @@ v3d_open(struct drm_device *dev, struct drm_file *file)static void v3d_postclose (struct drm_device *dev,struct drm_file *file) { -struct v3d_dev *v3d =to_v3d_dev (dev);struct v3d_file_priv *v3d_priv = file->driver_priv;enum v3d_queue q;for (q =0 ; q <V3D_MAX_QUEUES ; q++) { -drm_sched_entity_destroy (&v3d->queue[q].sched, - &v3d_priv->sched_entity[q]); +drm_sched_entity_destroy (&v3d_priv->sched_entity[q]); }kfree (v3d_priv);
drivers/gpu/drm/v3d/v3d_gem.c +0 -2
@@ -552,7 +552,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,if (exec->bin.start != exec->bin.end) { ret =drm_sched_job_init (&exec->bin.base, - &v3d->queue[V3D_BIN ].sched, &v3d_priv->sched_entity[V3D_BIN ], v3d_priv);if (ret)
@@ -567,7 +566,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, } ret =drm_sched_job_init (&exec->render.base, - &v3d->queue[V3D_RENDER ].sched, &v3d_priv->sched_entity[V3D_RENDER ], v3d_priv);if (ret)
include/drm/gpu_scheduler.h +3 -7
@@ -286,12 +286,9 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,struct drm_sched_rq **rq_list, unsigned int num_rq_list, atomic_t *guilty); -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout); -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout); +void drm_sched_entity_fini (struct drm_sched_entity *entity); +void drm_sched_entity_destroy (struct drm_sched_entity *entity);void drm_sched_entity_push_job (struct drm_sched_job *sched_job,struct drm_sched_entity *entity); void drm_sched_entity_set_rq(struct drm_sched_entity *entity,
@@ -302,7 +299,6 @@ struct drm_sched_fence *drm_sched_fence_create(void drm_sched_fence_scheduled (struct drm_sched_fence *fence);void drm_sched_fence_finished (struct drm_sched_fence *fence);int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner); void drm_sched_hw_job_reset(struct drm_gpu_scheduler *sched,
Signature · 6 lines
2.14.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 drm/scheduler: remove sched field from the entity
In reply to a message not in the archiveThe scheduler of the entity is decided by the run queue on which it is queued. This patch avoids us the effort required to maintain a sync between rq and sched field when we start shifting entites among different rqs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++--- drivers/gpu/drm/scheduler/gpu_scheduler.c | 19 +++++++++---------- drivers/gpu/drm/scheduler/sched_fence.c | 2 +- include/drm/gpu_scheduler.h | 2 -- 6 files changed, 16 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -1262,7 +1262,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, priority = job->base.s_priority;drm_sched_entity_push_job (&job->base, entity); - ring =to_amdgpu_ring (entity->sched); + ring =to_amdgpu_ring (entity->rq->sched);amdgpu_ring_priority_get (ring, priority);ttm_eu_fence_buffer_objects (&p->ticket, &p->validated, p->fence);
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +2 -2
@@ -143,7 +143,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity, priority = job->base.s_priority;drm_sched_entity_push_job (&job->base, entity); - ring =to_amdgpu_ring (entity->sched); + ring =to_amdgpu_ring (entity->rq->sched);amdgpu_ring_priority_get (ring, priority);return 0 ;
@@ -167,7 +167,7 @@ int amdgpu_job_submit_direct(struct amdgpu_job *job, struct amdgpu_ring *ring,static struct dma_fence *amdgpu_job_dependency (struct drm_sched_job *sched_job,struct drm_sched_entity *s_entity) { -struct amdgpu_ring *ring =to_amdgpu_ring (s_entity->sched); +struct amdgpu_ring *ring =to_amdgpu_ring (s_entity->rq->sched);struct amdgpu_job *job =to_amdgpu_job (sched_job);struct amdgpu_vm *vm = job->vm;struct dma_fence *fence;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -3
@@ -387,7 +387,7 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev, ats_entries =0 ; } - ring = container_of(vm->entity.sched, struct amdgpu_ring, sched); + ring = container_of(vm->entity.rq->sched, struct amdgpu_ring, sched); r =reservation_object_reserve_shared (bo->tbo.resv);if (r)
@@ -1113,7 +1113,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,struct amdgpu_ring *ring;struct dma_fence *fence; - ring = container_of(vm->entity.sched, struct amdgpu_ring, + ring = container_of(vm->entity.rq->sched, struct amdgpu_ring, sched);amdgpu_ring_pad_ib (ring, params.ib);
@@ -1403,7 +1403,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, addr, flags); } - ring = container_of(vm->entity.sched, struct amdgpu_ring, sched); + ring = container_of(vm->entity.rq->sched, struct amdgpu_ring, sched); nptes = last - start +1 ;
drivers/gpu/drm/scheduler/gpu_scheduler.c +9 -10
@@ -185,7 +185,6 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,memset (entity,0 ,sizeof (struct drm_sched_entity ));INIT_LIST_HEAD (&entity->list); entity->rq = rq_list[0 ]; - entity->sched = rq_list[0 ]->sched; entity->guilty = guilty; entity->last_scheduled =NULL ;
@@ -210,8 +209,8 @@ EXPORT_SYMBOL(drm_sched_entity_init);static bool drm_sched_entity_is_initialized (struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity) { -return entity->sched == sched && - entity->rq !=NULL ; +return entity->rq !=NULL && + entity->rq->sched == sched; }/**
@@ -278,7 +277,7 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)struct drm_gpu_scheduler *sched;long ret = timeout; - sched = entity->sched; + sched = entity->rq->sched;if (!drm_sched_entity_is_initialized (sched, entity))return ret;/**
@@ -317,7 +316,7 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity) {struct drm_gpu_scheduler *sched; - sched = entity->sched; + sched = entity->rq->sched;drm_sched_entity_set_rq (entity,NULL );/* Consumption of existing IBs wasn't completed. Forcefully
@@ -388,7 +387,7 @@ static void drm_sched_entity_wakeup(struct dma_fence *f, struct dma_fence_cb *cb container_of(cb, struct drm_sched_entity, cb); entity->dependency =NULL ;dma_fence_put (f); -drm_sched_wakeup (entity->sched); +drm_sched_wakeup (entity->rq->sched); }static void drm_sched_entity_clear_dep (struct dma_fence *f,struct dma_fence_cb *cb)
@@ -438,7 +437,7 @@ EXPORT_SYMBOL(drm_sched_entity_set_rq);bool drm_sched_dependency_optimized (struct dma_fence * fence,struct drm_sched_entity *entity) { -struct drm_gpu_scheduler *sched = entity->sched; +struct drm_gpu_scheduler *sched = entity->rq->sched;struct drm_sched_fence *s_fence;if (!fence ||dma_fence_is_signaled (fence))
@@ -455,7 +454,7 @@ EXPORT_SYMBOL(drm_sched_dependency_optimized);static bool drm_sched_entity_add_dependency_cb (struct drm_sched_entity *entity) { -struct drm_gpu_scheduler *sched = entity->sched; +struct drm_gpu_scheduler *sched = entity->rq->sched;struct dma_fence * fence = entity->dependency;struct drm_sched_fence *s_fence;
@@ -500,7 +499,7 @@ static bool drm_sched_entity_add_dependency_cb(struct drm_sched_entity *entity)static struct drm_sched_job *drm_sched_entity_pop_job (struct drm_sched_entity *entity) { -struct drm_gpu_scheduler *sched = entity->sched; +struct drm_gpu_scheduler *sched = entity->rq->sched;struct drm_sched_job *sched_job =to_drm_sched_job (spsc_queue_peek (&entity->job_queue));
@@ -744,7 +743,7 @@ int drm_sched_job_init(struct drm_sched_job *job,struct drm_sched_entity *entity, void *owner) { - struct drm_gpu_scheduler *sched = entity->sched; + struct drm_gpu_scheduler *sched = entity->rq->sched; job->sched = sched; job->entity = entity;
drivers/gpu/drm/scheduler/sched_fence.c +1 -1
@@ -172,7 +172,7 @@ struct drm_sched_fence *drm_sched_fence_create(struct drm_sched_entity *entity,return NULL ; fence->owner = owner; - fence->sched = entity->sched; + fence->sched = entity->rq->sched;spin_lock_init (&fence->lock); seq =atomic_inc_return (&entity->fence_seq);
include/drm/gpu_scheduler.h +0 -2
@@ -52,7 +52,6 @@ enum drm_sched_priority {* runqueue. * @rq: runqueue to which this entity belongs. * @rq_lock: lock to modify the runqueue to which this entity belongs. -* @sched: the scheduler instance to which this entity is enqueued. * @job_queue: the list of jobs of this entity. * @fence_seq: a linearly increasing seqno incremented with each * new &drm_sched_fence which is part of the entity.
@@ -76,7 +75,6 @@ struct drm_sched_entity {struct list_head list;struct drm_sched_rq *rq;spinlock_t rq_lock; -struct drm_gpu_scheduler *sched;struct spsc_queue job_queue;
Signature · 6 lines
2.14.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 20.07.2018 um 14:21 schrieb Nayan Deshmukh:
Quoted 4 lines
entity has a scheduler field and we don't need the sched argument in any of the functions where entity is provided.
Signed-off-by Nayan Deshmukh <[email protected]>
Quoted 300 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 ++-- drivers/gpu/drm/scheduler/gpu_scheduler.c | 20 +++++++++++--------- drivers/gpu/drm/v3d/v3d_drv.c | 4 +--- drivers/gpu/drm/v3d/v3d_gem.c | 2 -- include/drm/gpu_scheduler.h | 10 +++------- 13 files changed, 30 insertions(+), 42 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1@@ -1232,7 +1232,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, job = p->job; p->job =NULL ; - r =drm_sched_job_init (&job->base, &ring->sched, entity, p->filp); + r =drm_sched_job_init (&job->base, entity, p->filp);if (r) {amdgpu_job_free (job);amdgpu_mn_unlock (p->mn);drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +5
-8@@ -104,8 +104,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, failed:for (j =0 ; j < i; j++) -drm_sched_entity_destroy (&adev->rings[j]->sched, - &ctx->rings[j].entity); +drm_sched_entity_destroy (&ctx->rings[j].entity);kfree (ctx->fences); ctx->fences =NULL ;return r;@@ -178,8 +177,7 @@ static void amdgpu_ctx_do_release(struct kref *ref)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; -drm_sched_entity_destroy (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_destroy (&ctx->rings[i].entity); }amdgpu_ctx_fini (ref);@@ -466,8 +464,8 @@ void amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; - max_wait =drm_sched_entity_flush (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity, max_wait); + max_wait =drm_sched_entity_flush (&ctx->rings[i].entity, + max_wait); } }mutex_unlock (&mgr->lock);@@ -492,8 +490,7 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ;if (kref_read (&ctx->refcount) ==1 ) -drm_sched_entity_fini (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_fini (&ctx->rings[i].entity);else DRM_ERROR ("ctx %p is still alive\n" , ctx); }drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-1@@ -133,7 +133,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,if (!f)return -EINVAL ; - r =drm_sched_job_init (&job->base, entity->sched, entity, owner); + r =drm_sched_job_init (&job->base, entity, owner);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-2@@ -1925,8 +1925,7 @@ void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable)return ; } }else { -drm_sched_entity_destroy (adev->mman.entity.sched, - &adev->mman.entity); +drm_sched_entity_destroy (&adev->mman.entity); }/* this just adjusts TTM size idea, which sets lpfn to the correct value */ drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1
-2@@ -305,8 +305,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) {int i, j; -drm_sched_entity_destroy (&adev->uvd.inst->ring.sched, - &adev->uvd.entity); +drm_sched_entity_destroy (&adev->uvd.entity);for (j =0 ; j < adev->uvd.num_uvd_inst; ++j) {kfree (adev->uvd.inst[j].saved_bo);drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1
-1@@ -221,7 +221,7 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)if (adev->vce.vcpu_bo ==NULL )return 0 ; -drm_sched_entity_destroy (&adev->vce.ring[0 ].sched, &adev->vce.entity); +drm_sched_entity_destroy (&adev->vce.entity);amdgpu_bo_free_kernel (&adev->vce.vcpu_bo, &adev->vce.gpu_addr, (void **)&adev->vce.cpu_addr);drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2@@ -2642,7 +2642,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, vm->root.base.bo =NULL ; error_free_sched_entity: -drm_sched_entity_destroy (&ring->sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);return r; }@@ -2779,7 +2779,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)spin_unlock_irqrestore (&adev->vm_manager.pasid_lock, flags); } -drm_sched_entity_destroy (vm->entity.sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);if (!RB_EMPTY_ROOT (&vm->va.rb_root)) {dev_err (adev->dev,"still active bo inside vm\n" );drivers/gpu/drm/etnaviv/etnaviv_drv.c +1
-2@@ -78,8 +78,7 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file) gpu->lastctx =NULL ;mutex_unlock (&gpu->lock); -drm_sched_entity_destroy (&gpu->sched, - &ctx->sched_entity[i]); +drm_sched_entity_destroy (&ctx->sched_entity[i]); } }drivers/gpu/drm/etnaviv/etnaviv_sched.c +2
-2@@ -118,8 +118,8 @@ int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity, {int ret; - ret =drm_sched_job_init (&submit->sched_job, &submit->gpu->sched, - sched_entity, submit->cmdbuf.ctx); + ret =drm_sched_job_init (&submit->sched_job, sched_entity, + submit->cmdbuf.ctx);if (ret)return ret;drivers/gpu/drm/scheduler/gpu_scheduler.c +11
-9@@ -273,11 +273,12 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,* * Returns the remaining time in jiffies left from the input timeout */ -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout) +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout) { +struct drm_gpu_scheduler *sched;long ret = timeout; + sched = entity->sched;if (!drm_sched_entity_is_initialized (sched, entity))return ret;/** @@ -312,10 +313,11 @@ EXPORT_SYMBOL(drm_sched_entity_flush);* entity and signals all jobs with an error code if the process was killed. * */ -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_fini (struct drm_sched_entity *entity) { +struct drm_gpu_scheduler *sched; + sched = entity->sched;drm_sched_entity_set_rq (entity,NULL );/* Consumption of existing IBs wasn't completed. Forcefully @@ -373,11 +375,10 @@ EXPORT_SYMBOL(drm_sched_entity_fini);* * Calls drm_sched_entity_do_release() and drm_sched_entity_cleanup() */ -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_destroy (struct drm_sched_entity *entity) { -drm_sched_entity_flush (sched, entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); -drm_sched_entity_fini (sched, entity); +drm_sched_entity_flush (entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); +drm_sched_entity_fini (entity); }EXPORT_SYMBOL (drm_sched_entity_destroy);@@ -740,10 +741,11 @@ EXPORT_SYMBOL(drm_sched_job_recovery);* Returns 0 for success, negative error code otherwise. */ int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner) { +struct drm_gpu_scheduler *sched = entity->sched; + job->sched = sched; job->entity = entity; job->s_priority = entity->rq - sched->sched_rq;drivers/gpu/drm/v3d/v3d_drv.c +1
-3@@ -145,13 +145,11 @@ v3d_open(struct drm_device *dev, struct drm_file *file)static void v3d_postclose (struct drm_device *dev,struct drm_file *file) { -struct v3d_dev *v3d =to_v3d_dev (dev);struct v3d_file_priv *v3d_priv = file->driver_priv;enum v3d_queue q;for (q =0 ; q <V3D_MAX_QUEUES ; q++) { -drm_sched_entity_destroy (&v3d->queue[q].sched, - &v3d_priv->sched_entity[q]); +drm_sched_entity_destroy (&v3d_priv->sched_entity[q]); }kfree (v3d_priv);drivers/gpu/drm/v3d/v3d_gem.c +0
-2@@ -552,7 +552,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,if (exec->bin.start != exec->bin.end) { ret =drm_sched_job_init (&exec->bin.base, - &v3d->queue[V3D_BIN ].sched, &v3d_priv->sched_entity[V3D_BIN ], v3d_priv);if (ret)@@ -567,7 +566,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, } ret =drm_sched_job_init (&exec->render.base, - &v3d->queue[V3D_RENDER ].sched, &v3d_priv->sched_entity[V3D_RENDER ], v3d_priv);if (ret)include/drm/gpu_scheduler.h +3
-6@@ -286,12 +286,9 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,struct drm_sched_rq **rq_list, unsigned int num_rq_list, atomic_t *guilty); -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout); -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout); +void drm_sched_entity_fini (struct drm_sched_entity *entity); +void drm_sched_entity_destroy (struct drm_sched_entity *entity);void drm_sched_entity_push_job (struct drm_sched_job *sched_job,struct drm_sched_entity *entity); void drm_sched_entity_set_rq(struct drm_sched_entity *entity,
include/drm/gpu_scheduler.h struct drm_sched_fence *drm_sched_fence_create( · line 304
Quoted 7 lines
include/drm/gpu_scheduler.h +0
-1@@ -302,7 +299,6 @@ struct drm_sched_fence *drm_sched_fence_create(void drm_sched_fence_scheduled (struct drm_sched_fence *fence);void drm_sched_fence_finished (struct drm_sched_fence *fence);int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner); void drm_sched_hw_job_reset(struct drm_gpu_scheduler *sched,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Eric Anholt
Reviewed-byQuoted 41 lines · Nayan Deshmukh
entity has a scheduler field and we don't need the sched argument in any of the functions where entity is provided.
Signed-off-by Nayan Deshmukh <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 ++-- drivers/gpu/drm/scheduler/gpu_scheduler.c | 20 +++++++++++--------- drivers/gpu/drm/v3d/v3d_drv.c | 4 +--- drivers/gpu/drm/v3d/v3d_gem.c | 2 -- include/drm/gpu_scheduler.h | 10 +++------- 13 files changed, 30 insertions(+), 42 deletions(-)drivers/gpu/drm/scheduler/gpu_scheduler.c +3
-2@@ -273,11 +273,12 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,* * Returns the remaining time in jiffies left from the input timeout */ -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout) +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout) { +struct drm_gpu_scheduler *sched;long ret = timeout; + sched = entity->sched;if (!drm_sched_entity_is_initialized (sched, entity))return ret;/**
drivers/gpu/drm/scheduler/gpu_scheduler.c EXPORT_SYMBOL(drm_sched_entity_flush); · line 320
Quoted 10 lines
drivers/gpu/drm/scheduler/gpu_scheduler.c +3
-2@@ -312,10 +313,11 @@ EXPORT_SYMBOL(drm_sched_entity_flush);* entity and signals all jobs with an error code if the process was killed. * */ -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_fini (struct drm_sched_entity *entity) { +struct drm_gpu_scheduler *sched; + sched = entity->sched;
Maybe fold the initialization into the declaration above, like you did elsewhere?
Regardless, this is a wonderful cleanup of the API.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Eric Anholt
Reviewed-byRe: [PATCH 2/2] drm/scheduler: remove sched field from the entity
In reply to a message not in the archiveQuoted 4 lines · Nayan Deshmukh
The scheduler of the entity is decided by the run queue on which it is queued. This patch avoids us the effort required to maintain a sync between rq and sched field when we start shifting entites among different rqs.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines · Nayan Deshmukh
entity has a scheduler field and we don't need the sched argument in any of the functions where entity is provided.
Signed-off-by Nayan Deshmukh <[email protected]>
This breaks the make htmldocs build a bit:
./drivers/gpu/drm/scheduler/gpu_scheduler.c:262: warning: Excess function parameter 'sched' description in 'drm_sched_entity_flush' ./drivers/gpu/drm/scheduler/gpu_scheduler.c:303: warning: Excess function parameter 'sched' description in 'drm_sched_entity_fini' ./drivers/gpu/drm/scheduler/gpu_scheduler.c:365: warning: Excess function parameter 'sched' description in 'drm_sched_entity_destroy' ./drivers/gpu/drm/scheduler/gpu_scheduler.c:730: warning: Excess function parameter 'sched' description in 'drm_sched_job_init' ./drivers/gpu/drm/scheduler/gpu_scheduler.c:263: warning: Excess function parameter 'sched' description in 'drm_sched_entity_flush' ./drivers/gpu/drm/scheduler/gpu_scheduler.c:304: warning: Excess function parameter 'sched' description in 'drm_sched_entity_fini' ./drivers/gpu/drm/scheduler/gpu_scheduler.c:366: warning: Excess function parameter 'sched' description in 'drm_sched_entity_destroy' ./drivers/gpu/drm/scheduler/gpu_scheduler.c:731: warning: Excess function parameter 'sched' description in 'drm_sched_job_init'
Care to fix it?
Thanks, Daniel
Quoted 314 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 ++-- drivers/gpu/drm/scheduler/gpu_scheduler.c | 20 +++++++++++--------- drivers/gpu/drm/v3d/v3d_drv.c | 4 +--- drivers/gpu/drm/v3d/v3d_gem.c | 2 -- include/drm/gpu_scheduler.h | 10 +++------- 13 files changed, 30 insertions(+), 42 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1@@ -1232,7 +1232,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, job = p->job; p->job =NULL ; - r =drm_sched_job_init (&job->base, &ring->sched, entity, p->filp); + r =drm_sched_job_init (&job->base, entity, p->filp);if (r) {amdgpu_job_free (job);amdgpu_mn_unlock (p->mn);drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +5
-8@@ -104,8 +104,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, failed:for (j =0 ; j < i; j++) -drm_sched_entity_destroy (&adev->rings[j]->sched, - &ctx->rings[j].entity); +drm_sched_entity_destroy (&ctx->rings[j].entity);kfree (ctx->fences); ctx->fences =NULL ;return r;@@ -178,8 +177,7 @@ static void amdgpu_ctx_do_release(struct kref *ref)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; -drm_sched_entity_destroy (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_destroy (&ctx->rings[i].entity); }amdgpu_ctx_fini (ref);@@ -466,8 +464,8 @@ void amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; - max_wait =drm_sched_entity_flush (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity, max_wait); + max_wait =drm_sched_entity_flush (&ctx->rings[i].entity, + max_wait); } }mutex_unlock (&mgr->lock);@@ -492,8 +490,7 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ;if (kref_read (&ctx->refcount) ==1 ) -drm_sched_entity_fini (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_fini (&ctx->rings[i].entity);else DRM_ERROR ("ctx %p is still alive\n" , ctx); }drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-1@@ -133,7 +133,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,if (!f)return -EINVAL ; - r =drm_sched_job_init (&job->base, entity->sched, entity, owner); + r =drm_sched_job_init (&job->base, entity, owner);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-2@@ -1925,8 +1925,7 @@ void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable)return ; } }else { -drm_sched_entity_destroy (adev->mman.entity.sched, - &adev->mman.entity); +drm_sched_entity_destroy (&adev->mman.entity); }/* this just adjusts TTM size idea, which sets lpfn to the correct value */ drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1
-2@@ -305,8 +305,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) {int i, j; -drm_sched_entity_destroy (&adev->uvd.inst->ring.sched, - &adev->uvd.entity); +drm_sched_entity_destroy (&adev->uvd.entity);for (j =0 ; j < adev->uvd.num_uvd_inst; ++j) {kfree (adev->uvd.inst[j].saved_bo);drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1
-1@@ -221,7 +221,7 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)if (adev->vce.vcpu_bo ==NULL )return 0 ; -drm_sched_entity_destroy (&adev->vce.ring[0 ].sched, &adev->vce.entity); +drm_sched_entity_destroy (&adev->vce.entity);amdgpu_bo_free_kernel (&adev->vce.vcpu_bo, &adev->vce.gpu_addr, (void **)&adev->vce.cpu_addr);drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2@@ -2642,7 +2642,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, vm->root.base.bo =NULL ; error_free_sched_entity: -drm_sched_entity_destroy (&ring->sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);return r; }@@ -2779,7 +2779,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)spin_unlock_irqrestore (&adev->vm_manager.pasid_lock, flags); } -drm_sched_entity_destroy (vm->entity.sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);if (!RB_EMPTY_ROOT (&vm->va.rb_root)) {dev_err (adev->dev,"still active bo inside vm\n" );drivers/gpu/drm/etnaviv/etnaviv_drv.c +1
-2@@ -78,8 +78,7 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file) gpu->lastctx =NULL ;mutex_unlock (&gpu->lock); -drm_sched_entity_destroy (&gpu->sched, - &ctx->sched_entity[i]); +drm_sched_entity_destroy (&ctx->sched_entity[i]); } }drivers/gpu/drm/etnaviv/etnaviv_sched.c +2
-2@@ -118,8 +118,8 @@ int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity, {int ret; - ret =drm_sched_job_init (&submit->sched_job, &submit->gpu->sched, - sched_entity, submit->cmdbuf.ctx); + ret =drm_sched_job_init (&submit->sched_job, sched_entity, + submit->cmdbuf.ctx);if (ret)return ret;drivers/gpu/drm/scheduler/gpu_scheduler.c +11
-9@@ -273,11 +273,12 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,* * Returns the remaining time in jiffies left from the input timeout */ -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout) +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout) { +struct drm_gpu_scheduler *sched;long ret = timeout; + sched = entity->sched;if (!drm_sched_entity_is_initialized (sched, entity))return ret;/** @@ -312,10 +313,11 @@ EXPORT_SYMBOL(drm_sched_entity_flush);* entity and signals all jobs with an error code if the process was killed. * */ -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_fini (struct drm_sched_entity *entity) { +struct drm_gpu_scheduler *sched; + sched = entity->sched;drm_sched_entity_set_rq (entity,NULL );/* Consumption of existing IBs wasn't completed. Forcefully @@ -373,11 +375,10 @@ EXPORT_SYMBOL(drm_sched_entity_fini);* * Calls drm_sched_entity_do_release() and drm_sched_entity_cleanup() */ -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_destroy (struct drm_sched_entity *entity) { -drm_sched_entity_flush (sched, entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); -drm_sched_entity_fini (sched, entity); +drm_sched_entity_flush (entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); +drm_sched_entity_fini (entity); }EXPORT_SYMBOL (drm_sched_entity_destroy);@@ -740,10 +741,11 @@ EXPORT_SYMBOL(drm_sched_job_recovery);* Returns 0 for success, negative error code otherwise. */ int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner) { +struct drm_gpu_scheduler *sched = entity->sched; + job->sched = sched; job->entity = entity; job->s_priority = entity->rq - sched->sched_rq;drivers/gpu/drm/v3d/v3d_drv.c +1
-3@@ -145,13 +145,11 @@ v3d_open(struct drm_device *dev, struct drm_file *file)static void v3d_postclose (struct drm_device *dev,struct drm_file *file) { -struct v3d_dev *v3d =to_v3d_dev (dev);struct v3d_file_priv *v3d_priv = file->driver_priv;enum v3d_queue q;for (q =0 ; q <V3D_MAX_QUEUES ; q++) { -drm_sched_entity_destroy (&v3d->queue[q].sched, - &v3d_priv->sched_entity[q]); +drm_sched_entity_destroy (&v3d_priv->sched_entity[q]); }kfree (v3d_priv);drivers/gpu/drm/v3d/v3d_gem.c +0
-2@@ -552,7 +552,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,if (exec->bin.start != exec->bin.end) { ret =drm_sched_job_init (&exec->bin.base, - &v3d->queue[V3D_BIN ].sched, &v3d_priv->sched_entity[V3D_BIN ], v3d_priv);if (ret)@@ -567,7 +566,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, } ret =drm_sched_job_init (&exec->render.base, - &v3d->queue[V3D_RENDER ].sched, &v3d_priv->sched_entity[V3D_RENDER ], v3d_priv);if (ret)include/drm/gpu_scheduler.h +3
-8@@ -286,12 +286,9 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,struct drm_sched_rq **rq_list, unsigned int num_rq_list, atomic_t *guilty); -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout); -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout); +void drm_sched_entity_fini (struct drm_sched_entity *entity); +void drm_sched_entity_destroy (struct drm_sched_entity *entity);void drm_sched_entity_push_job (struct drm_sched_job *sched_job,struct drm_sched_entity *entity); void drm_sched_entity_set_rq(struct drm_sched_entity *entity,@@ -302,7 +299,6 @@ struct drm_sched_fence *drm_sched_fence_create(void drm_sched_fence_scheduled (struct drm_sched_fence *fence);void drm_sched_fence_finished (struct drm_sched_fence *fence);int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner); void drm_sched_hw_job_reset(struct drm_gpu_scheduler *sched, --2.14.3
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi Daniel,
Quoted 27 lines · Daniel Vetter
Quoted 4 lines · Nayan Deshmukh
entity has a scheduler field and we don't need the sched argument in any of the functions where entity is provided.
Signed-off-by Nayan Deshmukh <[email protected]>This breaks the make htmldocs build a bit:
./drivers/gpu/drm/scheduler/gpu_scheduler.c:262: warning: Excess function parameter 'sched' description in 'drm_sched_entity_flush'./drivers/gpu/drm/scheduler/gpu_scheduler.c:303: warning: Excess function parameter 'sched' description in 'drm_sched_entity_fini'./drivers/gpu/drm/scheduler/gpu_scheduler.c:365: warning: Excess function parameter 'sched' description in 'drm_sched_entity_destroy'./drivers/gpu/drm/scheduler/gpu_scheduler.c:730: warning: Excess function parameter 'sched' description in 'drm_sched_job_init'./drivers/gpu/drm/scheduler/gpu_scheduler.c:263: warning: Excess function parameter 'sched' description in 'drm_sched_entity_flush'./drivers/gpu/drm/scheduler/gpu_scheduler.c:304: warning: Excess function parameter 'sched' description in 'drm_sched_entity_fini'./drivers/gpu/drm/scheduler/gpu_scheduler.c:366: warning: Excess function parameter 'sched' description in 'drm_sched_entity_destroy'./drivers/gpu/drm/scheduler/gpu_scheduler.c:731: warning: Excess function parameter 'sched' description in 'drm_sched_job_init'
Quoted 1 line
Care to fix it?
My Bad thanks for pointing it out. I will send in a patch to fix it.
Cheers,
Nayan
Quoted 312 lines
Thanks, Daniel
Quoted 310 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 13 +++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++-- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 3 +-- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 ++-- drivers/gpu/drm/scheduler/gpu_scheduler.c | 20 +++++++++++--------- drivers/gpu/drm/v3d/v3d_drv.c | 4 +--- drivers/gpu/drm/v3d/v3d_gem.c | 2 -- include/drm/gpu_scheduler.h | 10 +++------- 13 files changed, 30 insertions(+), 42 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1@@ -1232,7 +1232,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, job = p->job; p->job =NULL ; - r =drm_sched_job_init (&job->base, &ring->sched, entity, p->filp); + r =drm_sched_job_init (&job->base, entity, p->filp);if (r) {amdgpu_job_free (job);amdgpu_mn_unlock (p->mn);drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +5
-8@@ -104,8 +104,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, failed:for (j =0 ; j < i; j++) -drm_sched_entity_destroy (&adev->rings[j]->sched, - &ctx->rings[j].entity); +drm_sched_entity_destroy (&ctx->rings[j].entity);kfree (ctx->fences); ctx->fences =NULL ;return r;@@ -178,8 +177,7 @@ static void amdgpu_ctx_do_release(struct kref *ref)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; -drm_sched_entity_destroy (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_destroy (&ctx->rings[i].entity); }amdgpu_ctx_fini (ref);@@ -466,8 +464,8 @@ void amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr)if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)continue ; - max_wait =drm_sched_entity_flush (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity, max_wait); + max_wait =drm_sched_entity_flush (&ctx->rings[i].entity, + max_wait); } }mutex_unlock (&mgr->lock);@@ -492,8 +490,7 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)continue ;if (kref_read (&ctx->refcount) ==1 ) -drm_sched_entity_fini (&ctx->adev->rings[i]->sched, - &ctx->rings[i].entity); +drm_sched_entity_fini (&ctx->rings[i].entity);else DRM_ERROR ("ctx %p is still alive\n" , ctx); }drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-1@@ -133,7 +133,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,if (!f)return -EINVAL ; - r =drm_sched_job_init (&job->base, entity->sched, entity, owner); + r =drm_sched_job_init (&job->base, entity, owner);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-2@@ -1925,8 +1925,7 @@ void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable)return ; } }else { -drm_sched_entity_destroy (adev->mman.entity.sched, - &adev->mman.entity); +drm_sched_entity_destroy (&adev->mman.entity); }/* this just adjusts TTM size idea, which sets lpfn to the correct value */ drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1
-2@@ -305,8 +305,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) {int i, j; -drm_sched_entity_destroy (&adev->uvd.inst->ring.sched, - &adev->uvd.entity); +drm_sched_entity_destroy (&adev->uvd.entity);for (j =0 ; j < adev->uvd.num_uvd_inst; ++j) {kfree (adev->uvd.inst[j].saved_bo);drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1
-1@@ -221,7 +221,7 @@ int amdgpu_vce_sw_fini(struct amdgpu_device *adev)if (adev->vce.vcpu_bo ==NULL )return 0 ; -drm_sched_entity_destroy (&adev->vce.ring[0 ].sched, &adev->vce.entity); +drm_sched_entity_destroy (&adev->vce.entity);amdgpu_bo_free_kernel (&adev->vce.vcpu_bo, &adev->vce.gpu_addr, (void **)&adev->vce.cpu_addr);drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2@@ -2642,7 +2642,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, vm->root.base.bo =NULL ; error_free_sched_entity: -drm_sched_entity_destroy (&ring->sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);return r; }@@ -2779,7 +2779,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)spin_unlock_irqrestore (&adev->vm_manager.pasid_lock, flags); } -drm_sched_entity_destroy (vm->entity.sched, &vm->entity); +drm_sched_entity_destroy (&vm->entity);if (!RB_EMPTY_ROOT (&vm->va.rb_root)) {dev_err (adev->dev,"still active bo inside vm\n" );drivers/gpu/drm/etnaviv/etnaviv_drv.c +1
-2@@ -78,8 +78,7 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file) gpu->lastctx =NULL ;mutex_unlock (&gpu->lock); -drm_sched_entity_destroy (&gpu->sched, - &ctx->sched_entity[i]); +drm_sched_entity_destroy (&ctx->sched_entity[i]); } }drivers/gpu/drm/etnaviv/etnaviv_sched.c +2
-2@@ -118,8 +118,8 @@ int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity, {int ret; - ret =drm_sched_job_init (&submit->sched_job, &submit->gpu->sched, - sched_entity, submit->cmdbuf.ctx); + ret =drm_sched_job_init (&submit->sched_job, sched_entity, + submit->cmdbuf.ctx);if (ret)return ret;drivers/gpu/drm/scheduler/gpu_scheduler.c +11
-9@@ -273,11 +273,12 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,* * Returns the remaining time in jiffies left from the input timeout */ -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout) +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout) { +struct drm_gpu_scheduler *sched;long ret = timeout; + sched = entity->sched;if (!drm_sched_entity_is_initialized (sched, entity))return ret;/** @@ -312,10 +313,11 @@ EXPORT_SYMBOL(drm_sched_entity_flush);* entity and signals all jobs with an error code if the process was killed. * */ -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_fini (struct drm_sched_entity *entity) { +struct drm_gpu_scheduler *sched; + sched = entity->sched;drm_sched_entity_set_rq (entity,NULL );/* Consumption of existing IBs wasn't completed. Forcefully @@ -373,11 +375,10 @@ EXPORT_SYMBOL(drm_sched_entity_fini);* * Calls drm_sched_entity_do_release() and drm_sched_entity_cleanup() */ -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity) +void drm_sched_entity_destroy (struct drm_sched_entity *entity) { -drm_sched_entity_flush (sched, entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); -drm_sched_entity_fini (sched, entity); +drm_sched_entity_flush (entity,MAX_WAIT_SCHED_ENTITY_Q_EMPTY ); +drm_sched_entity_fini (entity); }EXPORT_SYMBOL (drm_sched_entity_destroy);@@ -740,10 +741,11 @@ EXPORT_SYMBOL(drm_sched_job_recovery);* Returns 0 for success, negative error code otherwise. */ int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner) { +struct drm_gpu_scheduler *sched = entity->sched; + job->sched = sched; job->entity = entity; job->s_priority = entity->rq - sched->sched_rq;drivers/gpu/drm/v3d/v3d_drv.c +1
-3@@ -145,13 +145,11 @@ v3d_open(struct drm_device *dev, struct drm_file *file)static void v3d_postclose (struct drm_device *dev,struct drm_file *file) { -struct v3d_dev *v3d =to_v3d_dev (dev);struct v3d_file_priv *v3d_priv = file->driver_priv;enum v3d_queue q;for (q =0 ; q <V3D_MAX_QUEUES ; q++) { -drm_sched_entity_destroy (&v3d->queue[q].sched, - &v3d_priv->sched_entity[q]); +drm_sched_entity_destroy (&v3d_priv->sched_entity[q]); }kfree (v3d_priv);drivers/gpu/drm/v3d/v3d_gem.c +0
-2@@ -552,7 +552,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,if (exec->bin.start != exec->bin.end) { ret =drm_sched_job_init (&exec->bin.base, - &v3d->queue[V3D_BIN ].sched, &v3d_priv->sched_entity[V3D_BIN ], v3d_priv);if (ret)@@ -567,7 +566,6 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, } ret =drm_sched_job_init (&exec->render.base, - &v3d->queue[V3D_RENDER ].sched, &v3d_priv->sched_entity[V3D_RENDER ], v3d_priv);if (ret)include/drm/gpu_scheduler.h +3
-8@@ -286,12 +286,9 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,struct drm_sched_rq **rq_list, unsigned int num_rq_list, atomic_t *guilty); -long drm_sched_entity_flush (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity,long timeout); -void drm_sched_entity_fini (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); -void drm_sched_entity_destroy (struct drm_gpu_scheduler *sched, -struct drm_sched_entity *entity); +long drm_sched_entity_flush (struct drm_sched_entity *entity,long timeout); +void drm_sched_entity_fini (struct drm_sched_entity *entity); +void drm_sched_entity_destroy (struct drm_sched_entity *entity);void drm_sched_entity_push_job (struct drm_sched_job *sched_job,struct drm_sched_entity *entity); void drm_sched_entity_set_rq(struct drm_sched_entity *entity,@@ -302,7 +299,6 @@ struct drm_sched_fence *drm_sched_fence_create(void drm_sched_fence_scheduled (struct drm_sched_fence *fence);void drm_sched_fence_finished (struct drm_sched_fence *fence);int drm_sched_job_init (struct drm_sched_job *job, -struct drm_gpu_scheduler *sched,struct drm_sched_entity *entity,void *owner); void drm_sched_hw_job_reset(struct drm_gpu_scheduler *sched, --2.14.3
Quoted 11 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx