From: Christian König Date: Fri, 21 Aug 2015 13:18:47 +0000 (+0200) Subject: drm/amdgpu: remove entity reference from sched fence X-Git-Tag: v4.14-rc1~4701^2~18^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c14692f0a728a9d79fb03c7ce521eb07ec0e2b23;p=platform%2Fkernel%2Flinux-rpi.git drm/amdgpu: remove entity reference from sched fence Entity don't live as long as scheduler fences. Signed-off-by: Christian König Reviewed-by: Chunming Zhou --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index 26b1793..b925253 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c @@ -146,7 +146,7 @@ static uint32_t amdgpu_sa_get_ring_from_fence(struct fence *f) s_fence = to_amd_sched_fence(f); if (s_fence) - return s_fence->entity->scheduler->ring_id; + return s_fence->scheduler->ring_id; a_fence = to_amdgpu_fence(f); if (a_fence) return a_fence->ring->idx; @@ -437,7 +437,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, if (s_fence) seq_printf(m, " protected by 0x%016x on ring %d", s_fence->base.seqno, - s_fence->entity->scheduler->ring_id); + s_fence->scheduler->ring_id); } seq_printf(m, "\n"); diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 29c45ed..d747f82 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c @@ -109,8 +109,6 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, struct amd_sched_rq *rq, uint32_t jobs) { - char name[20]; - if (!(sched && entity && rq)) return -EINVAL; @@ -119,8 +117,6 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, entity->scheduler = sched; init_waitqueue_head(&entity->wait_queue); entity->fence_context = fence_context_alloc(1); - snprintf(name, sizeof(name), "c_entity[%llu]", entity->fence_context); - memcpy(entity->name, name, 20); if(kfifo_alloc(&entity->job_queue, jobs * sizeof(void *), GFP_KERNEL)) @@ -347,7 +343,6 @@ struct amd_gpu_scheduler *amd_sched_create(struct amd_sched_backend_ops *ops, unsigned ring, unsigned hw_submission) { struct amd_gpu_scheduler *sched; - char name[20]; sched = kzalloc(sizeof(struct amd_gpu_scheduler), GFP_KERNEL); if (!sched) @@ -356,14 +351,14 @@ struct amd_gpu_scheduler *amd_sched_create(struct amd_sched_backend_ops *ops, sched->ops = ops; sched->ring_id = ring; sched->hw_submission_limit = hw_submission; - snprintf(name, sizeof(name), "gpu_sched[%d]", ring); + snprintf(sched->name, sizeof(sched->name), "amdgpu[%d]", ring); amd_sched_rq_init(&sched->sched_rq); amd_sched_rq_init(&sched->kernel_rq); init_waitqueue_head(&sched->wait_queue); atomic_set(&sched->hw_rq_count, 0); /* Each scheduler will run on a seperate kernel thread */ - sched->thread = kthread_run(amd_sched_main, sched, name); + sched->thread = kthread_run(amd_sched_main, sched, sched->name); if (IS_ERR(sched->thread)) { DRM_ERROR("Failed to create scheduler for id %d.\n", ring); kfree(sched); diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 46b528d..62655f4 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h @@ -48,7 +48,6 @@ struct amd_sched_entity { struct amd_gpu_scheduler *scheduler; wait_queue_head_t wait_queue; uint64_t fence_context; - char name[20]; }; /** @@ -64,8 +63,7 @@ struct amd_sched_rq { struct amd_sched_fence { struct fence base; - struct fence_cb cb; - struct amd_sched_entity *entity; + struct amd_gpu_scheduler *scheduler; spinlock_t lock; }; @@ -111,6 +109,7 @@ struct amd_gpu_scheduler { uint32_t ring_id; wait_queue_head_t wait_queue; uint32_t hw_submission_limit; + char name[20]; }; struct amd_gpu_scheduler * diff --git a/drivers/gpu/drm/amd/scheduler/sched_fence.c b/drivers/gpu/drm/amd/scheduler/sched_fence.c index 266ed7b..7f0f578 100644 --- a/drivers/gpu/drm/amd/scheduler/sched_fence.c +++ b/drivers/gpu/drm/amd/scheduler/sched_fence.c @@ -36,7 +36,7 @@ struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *s_entity if (fence == NULL) return NULL; - fence->entity = s_entity; + fence->scheduler = s_entity->scheduler; spin_lock_init(&fence->lock); seq = atomic_inc_return(&s_entity->fence_seq); @@ -63,7 +63,7 @@ static const char *amd_sched_fence_get_driver_name(struct fence *fence) static const char *amd_sched_fence_get_timeline_name(struct fence *f) { struct amd_sched_fence *fence = to_amd_sched_fence(f); - return (const char *)fence->entity->name; + return (const char *)fence->scheduler->name; } static bool amd_sched_fence_enable_signaling(struct fence *f)