Commit 93f8b367 authored by Andres Rodriguez's avatar Andres Rodriguez Committed by Alex Deucher

drm/amd/sched: add a unique job id to amd_sched_job

A unique id is useful for debugging and tracing. Intended to replace
pointers in ftrace output.
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAndres Rodriguez <andresx7@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8fb6e528
...@@ -460,6 +460,7 @@ int amd_sched_job_init(struct amd_sched_job *job, ...@@ -460,6 +460,7 @@ int amd_sched_job_init(struct amd_sched_job *job,
job->sched = sched; job->sched = sched;
job->s_entity = entity; job->s_entity = entity;
job->s_fence = amd_sched_fence_create(entity, owner); job->s_fence = amd_sched_fence_create(entity, owner);
job->id = atomic64_inc_return(&sched->job_id_count);
if (!job->s_fence) if (!job->s_fence)
return -ENOMEM; return -ENOMEM;
...@@ -617,6 +618,7 @@ int amd_sched_init(struct amd_gpu_scheduler *sched, ...@@ -617,6 +618,7 @@ int amd_sched_init(struct amd_gpu_scheduler *sched,
INIT_LIST_HEAD(&sched->ring_mirror_list); INIT_LIST_HEAD(&sched->ring_mirror_list);
spin_lock_init(&sched->job_list_lock); spin_lock_init(&sched->job_list_lock);
atomic_set(&sched->hw_rq_count, 0); atomic_set(&sched->hw_rq_count, 0);
atomic64_set(&sched->job_id_count, 0);
/* Each scheduler will run on a seperate kernel thread */ /* Each scheduler will run on a seperate kernel thread */
sched->thread = kthread_run(amd_sched_main, sched, sched->name); sched->thread = kthread_run(amd_sched_main, sched, sched->name);
......
...@@ -80,6 +80,7 @@ struct amd_sched_job { ...@@ -80,6 +80,7 @@ struct amd_sched_job {
struct work_struct finish_work; struct work_struct finish_work;
struct list_head node; struct list_head node;
struct delayed_work work_tdr; struct delayed_work work_tdr;
uint64_t id;
}; };
extern const struct dma_fence_ops amd_sched_fence_ops_scheduled; extern const struct dma_fence_ops amd_sched_fence_ops_scheduled;
...@@ -124,6 +125,7 @@ struct amd_gpu_scheduler { ...@@ -124,6 +125,7 @@ struct amd_gpu_scheduler {
wait_queue_head_t wake_up_worker; wait_queue_head_t wake_up_worker;
wait_queue_head_t job_scheduled; wait_queue_head_t job_scheduled;
atomic_t hw_rq_count; atomic_t hw_rq_count;
atomic64_t job_id_count;
struct task_struct *thread; struct task_struct *thread;
struct list_head ring_mirror_list; struct list_head ring_mirror_list;
spinlock_t job_list_lock; spinlock_t job_list_lock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment