drm/sched: adding a new scheduling policy
Subsystems (11)
PATCH 1/2 drm/sched: adding a new scheduling policy
From: "[email protected]" <[email protected]>
Added ring ID scheduling.
In some cases, userspace needs to run a job on a specific ring. Instead of selecting the best ring to run based on the ring score. For example, The user want to run a bad job on a specific ring to check whether the ring can recover from a queue reset.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +- drivers/gpu/drm/imagination/pvr_queue.c | 2 +- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 11 +++++++++-- drivers/gpu/drm/scheduler/sched_main.c | 4 ++-- drivers/gpu/drm/v3d/v3d_submit.c | 2 +- include/drm/gpu_scheduler.h | 4 ++-- 12 files changed, 22 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -1286,7 +1286,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,int r;for (i =0 ; i < p->gang_size; ++i) -drm_sched_job_arm (&p->jobs[i]->base); +drm_sched_job_arm (&p->jobs[i]->base,-1 );for (i =0 ; i < p->gang_size; ++i) {struct dma_fence *fence;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -1
@@ -320,7 +320,7 @@ struct dma_fence *amdgpu_job_submit(struct amdgpu_job *job) {struct dma_fence *f; -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); f =dma_fence_get (&job->base.s_fence->finished);amdgpu_job_free_resources (job);drm_sched_entity_push_job (&job->base);
drivers/gpu/drm/etnaviv/etnaviv_sched.c +1 -1
@@ -107,7 +107,7 @@ int etnaviv_sched_push_job(struct etnaviv_gem_submit *submit)*/ mutex_lock (&gpu->sched_lock); -drm_sched_job_arm (&submit->sched_job); +drm_sched_job_arm (&submit->sched_job,-1 ); submit->out_fence =dma_fence_get (&submit->sched_job.s_fence->finished); ret = xa_alloc_cyclic(&gpu->user_fences, &submit->out_fence_id,
drivers/gpu/drm/imagination/pvr_queue.c +1 -1
@@ -1115,7 +1115,7 @@ int pvr_queue_job_init(struct pvr_job *job)*/ struct dma_fence *pvr_queue_job_arm (struct pvr_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 );return &job->base.s_fence->finished; }
drivers/gpu/drm/lima/lima_sched.c +1 -1
@@ -130,7 +130,7 @@ int lima_sched_task_init(struct lima_sched_task *task,return err; } -drm_sched_job_arm (&task->base); +drm_sched_job_arm (&task->base,-1 ); task->num_bos = num_bos; task->vm =lima_vm_get (vm);
drivers/gpu/drm/msm/msm_gem_submit.c +1 -1
@@ -831,7 +831,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, goto out; } -drm_sched_job_arm (&submit->base); +drm_sched_job_arm (&submit->base,-1 ); submit->user_fence =dma_fence_get (&submit->base.s_fence->finished);
drivers/gpu/drm/nouveau/nouveau_sched.c +1 -1
@@ -309,7 +309,7 @@ nouveau_job_submit(struct nouveau_job *job)list_add (&job->entry, &sched->job.list.head);spin_unlock (&sched->job.list.lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);if (job->sync) done_fence =dma_fence_get (job->done_fence);
drivers/gpu/drm/panfrost/panfrost_job.c +1 -1
@@ -301,7 +301,7 @@ int panfrost_job_push(struct panfrost_job *job)return ret;mutex_lock (&pfdev->sched_lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->render_done_fence =dma_fence_get (&job->base.s_fence->finished);
drivers/gpu/drm/scheduler/sched_entity.c +9 -2
@@ -525,7 +525,7 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity *entity)return sched_job; } -void drm_sched_entity_select_rq (struct drm_sched_entity *entity) +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int ring) {struct dma_fence *fence;struct drm_gpu_scheduler *sched;
@@ -554,7 +554,14 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)return ;spin_lock (&entity->rq_lock); - sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); +if (ring >=0 ) { +if (entity->sched_list[ring] && entity->sched_list[ring]->ready) + sched = entity->sched_list[ring]; +else + sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); + } +else + sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); rq = sched ? sched->sched_rq[entity->priority] :NULL ;if (rq != entity->rq) {drm_sched_rq_remove_entity (entity->rq, entity);
drivers/gpu/drm/scheduler/sched_main.c +2 -2
@@ -833,13 +833,13 @@ EXPORT_SYMBOL(drm_sched_job_init);* * This can only be called if drm_sched_job_init() succeeded. */ -void drm_sched_job_arm (struct drm_sched_job *job) +void drm_sched_job_arm (struct drm_sched_job *job,int ring) {struct drm_gpu_scheduler *sched;struct drm_sched_entity *entity = job->entity;BUG_ON (!entity); -drm_sched_entity_select_rq (entity); +drm_sched_entity_select_rq (entity, ring); sched = entity->rq->sched; job->sched = sched;
drivers/gpu/drm/v3d/v3d_submit.c +1 -1
@@ -211,7 +211,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,static void v3d_push_job (struct v3d_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);
include/drm/gpu_scheduler.h +2 -2
@@ -553,7 +553,7 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched);int drm_sched_job_init (struct drm_sched_job *job,struct drm_sched_entity *entity,u32 credits,void *owner); -void drm_sched_job_arm (struct drm_sched_job *job); +void drm_sched_job_arm (struct drm_sched_job *job,int ring);int drm_sched_job_add_dependency (struct drm_sched_job *job,struct dma_fence *fence); int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job,
@@ -603,7 +603,7 @@ int drm_sched_entity_init(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_select_rq (struct drm_sched_entity *entity); +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int ring);struct drm_sched_job *drm_sched_entity_pop_job (struct drm_sched_entity *entity);void drm_sched_entity_push_job (struct drm_sched_job *sched_job); void drm_sched_entity_set_priority(struct drm_sched_entity *entity,
Signature · 1 line
2.25.1
PATCH 2/2 drm/amdgpu: add the ring id schedule module parameter for amdgpu
From: "[email protected]" <[email protected]>
Added ring id schedule to switch scheduling policy when cs submits. Schedule the ring by setting the ring id.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -227,6 +227,7 @@ extern int amdgpu_noretry;extern int amdgpu_force_asic_type;extern int amdgpu_smartshift_bias;extern int amdgpu_use_xgmi_p2p; +extern int amdgpu_ring_id_schedule;extern int amdgpu_mtype_local;extern bool enforce_isolation;#ifdef CONFIG_HSA_AMD
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +7 -2
@@ -1276,6 +1276,7 @@ static void amdgpu_cs_post_dependencies(struct amdgpu_cs_parser *p)static int amdgpu_cs_submit (struct amdgpu_cs_parser *p,union drm_amdgpu_cs *cs) { +struct drm_amdgpu_cs_chunk_ib *chunk_ib = p->chunks[0 ].kdata;struct amdgpu_fpriv *fpriv = p->filp->driver_priv;struct amdgpu_job *leader = p->gang_leader;struct amdgpu_bo_list_entry *e;
@@ -1285,8 +1286,12 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,uint64_t seq;int r; -for (i =0 ; i < p->gang_size; ++i) -drm_sched_job_arm (&p->jobs[i]->base,-1 ); +for (i =0 ; i < p->gang_size; ++i) { +if (amdgpu_ring_id_schedule) +drm_sched_job_arm (&p->jobs[i]->base, chunk_ib->ring); +else +drm_sched_job_arm (&p->jobs[i]->base,-1 ); + }for (i =0 ; i < p->gang_size; ++i) {struct dma_fence *fence;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
@@ -221,6 +221,7 @@ int amdgpu_reset_method = -1; /* auto */int amdgpu_num_kcq =-1 ;int amdgpu_smartshift_bias;int amdgpu_use_xgmi_p2p =1 ; +int amdgpu_ring_id_schedule =0 ;int amdgpu_vcnfw_log;int amdgpu_sg_display =-1 ;/* auto */ int amdgpu_user_partt_mode =AMDGPU_AUTO_COMPUTE_PARTITION_MODE ;
@@ -740,6 +741,13 @@ MODULE_PARM_DESC(use_xgmi_p2p, "Enable XGMI P2P interface (0 = disable; 1 = enable (default))");module_param_named (use_xgmi_p2p, amdgpu_use_xgmi_p2p, int,0444 ); +/** +* DOC: ring_id_schedule (int) +* Enables/disables ring id schedule interface (0 = disable, 1 = enable, -1 auto (default)) +*/ +MODULE_PARM_DESC (ring_id_schedule, +"Enable ring id schedule interface(0 = disable, 1 = enable, -1 auto (default))" ); +module_param_named (ring_id_schedule, amdgpu_ring_id_schedule, int,0644 );#ifdef CONFIG_HSA_AMD /**
Signature · 1 line
2.25.1
Christian König
maintainerAm 11.10.24 um 08:21 schrieb [email protected]:
Quoted 7 lines
From: "[email protected]" <[email protected]>
Added ring ID scheduling.
In some cases, userspace needs to run a job on a specific ring. Instead of selecting the best ring to run based on the ring score. For example, The user want to run a bad job on a specific ring to check whether the ring can recover from a queue reset.
Absolutely clearly a NAK, we don't want to expose the different HW rings directly to userspace.
Regards,
Christian.
Quoted 205 lines
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +- drivers/gpu/drm/imagination/pvr_queue.c | 2 +- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 11 +++++++++-- drivers/gpu/drm/scheduler/sched_main.c | 4 ++-- drivers/gpu/drm/v3d/v3d_submit.c | 2 +- include/drm/gpu_scheduler.h | 4 ++-- 12 files changed, 22 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1@@ -1286,7 +1286,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,int r;for (i =0 ; i < p->gang_size; ++i) -drm_sched_job_arm (&p->jobs[i]->base); +drm_sched_job_arm (&p->jobs[i]->base,-1 );for (i =0 ; i < p->gang_size; ++i) {struct dma_fence *fence;drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-1@@ -320,7 +320,7 @@ struct dma_fence *amdgpu_job_submit(struct amdgpu_job *job) {struct dma_fence *f; -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); f =dma_fence_get (&job->base.s_fence->finished);amdgpu_job_free_resources (job);drm_sched_entity_push_job (&job->base);drivers/gpu/drm/etnaviv/etnaviv_sched.c +1
-1@@ -107,7 +107,7 @@ int etnaviv_sched_push_job(struct etnaviv_gem_submit *submit)*/ mutex_lock (&gpu->sched_lock); -drm_sched_job_arm (&submit->sched_job); +drm_sched_job_arm (&submit->sched_job,-1 ); submit->out_fence =dma_fence_get (&submit->sched_job.s_fence->finished); ret = xa_alloc_cyclic(&gpu->user_fences, &submit->out_fence_id,drivers/gpu/drm/imagination/pvr_queue.c +1
-1@@ -1115,7 +1115,7 @@ int pvr_queue_job_init(struct pvr_job *job)*/ struct dma_fence *pvr_queue_job_arm (struct pvr_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 );return &job->base.s_fence->finished; }drivers/gpu/drm/lima/lima_sched.c +1
-1@@ -130,7 +130,7 @@ int lima_sched_task_init(struct lima_sched_task *task,return err; } -drm_sched_job_arm (&task->base); +drm_sched_job_arm (&task->base,-1 ); task->num_bos = num_bos; task->vm =lima_vm_get (vm);drivers/gpu/drm/msm/msm_gem_submit.c +1
-1@@ -831,7 +831,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, goto out; } -drm_sched_job_arm (&submit->base); +drm_sched_job_arm (&submit->base,-1 ); submit->user_fence =dma_fence_get (&submit->base.s_fence->finished);drivers/gpu/drm/nouveau/nouveau_sched.c +1
-1@@ -309,7 +309,7 @@ nouveau_job_submit(struct nouveau_job *job)list_add (&job->entry, &sched->job.list.head);spin_unlock (&sched->job.list.lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);if (job->sync) done_fence =dma_fence_get (job->done_fence);drivers/gpu/drm/panfrost/panfrost_job.c +1
-1@@ -301,7 +301,7 @@ int panfrost_job_push(struct panfrost_job *job)return ret;mutex_lock (&pfdev->sched_lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->render_done_fence =dma_fence_get (&job->base.s_fence->finished);drivers/gpu/drm/scheduler/sched_entity.c +9
-2@@ -525,7 +525,7 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity *entity)return sched_job; } -void drm_sched_entity_select_rq (struct drm_sched_entity *entity) +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int ring) {struct dma_fence *fence;struct drm_gpu_scheduler *sched;@@ -554,7 +554,14 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)return ;spin_lock (&entity->rq_lock); - sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); +if (ring >=0 ) { +if (entity->sched_list[ring] && entity->sched_list[ring]->ready) + sched = entity->sched_list[ring]; +else + sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); + } +else + sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); rq = sched ? sched->sched_rq[entity->priority] :NULL ;if (rq != entity->rq) {drm_sched_rq_remove_entity (entity->rq, entity);drivers/gpu/drm/scheduler/sched_main.c +2
-2@@ -833,13 +833,13 @@ EXPORT_SYMBOL(drm_sched_job_init);* * This can only be called if drm_sched_job_init() succeeded. */ -void drm_sched_job_arm (struct drm_sched_job *job) +void drm_sched_job_arm (struct drm_sched_job *job,int ring) {struct drm_gpu_scheduler *sched;struct drm_sched_entity *entity = job->entity;BUG_ON (!entity); -drm_sched_entity_select_rq (entity); +drm_sched_entity_select_rq (entity, ring); sched = entity->rq->sched; job->sched = sched;drivers/gpu/drm/v3d/v3d_submit.c +1
-1@@ -211,7 +211,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,static void v3d_push_job (struct v3d_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);include/drm/gpu_scheduler.h +2
-2@@ -553,7 +553,7 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched);int drm_sched_job_init (struct drm_sched_job *job,struct drm_sched_entity *entity,u32 credits,void *owner); -void drm_sched_job_arm (struct drm_sched_job *job); +void drm_sched_job_arm (struct drm_sched_job *job,int ring);int drm_sched_job_add_dependency (struct drm_sched_job *job,struct dma_fence *fence); int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job,@@ -603,7 +603,7 @@ int drm_sched_entity_init(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_select_rq (struct drm_sched_entity *entity); +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int ring);struct drm_sched_job *drm_sched_entity_pop_job (struct drm_sched_entity *entity);void drm_sched_entity_push_job (struct drm_sched_job *sched_job); void drm_sched_entity_set_priority(struct drm_sched_entity *entity,
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Christian,
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Friday, October 11, 2024 4:40 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/sched: adding a new scheduling policy
Am 11.10.24 um 08:21 schrieb [email protected]:
Quoted 7 lines
From: "[email protected]" <[email protected]>
Added ring ID scheduling.
In some cases, userspace needs to run a job on a specific ring. Instead of selecting the best ring to run based on the ring score. For example, The user want to run a bad job on a specific ring to check whether the ring can recover from a queue reset.
Absolutely clearly a NAK, we don't want to expose the different HW rings directly to userspace.
Thanks for the confirmation. It was a bit confusing.
But now userspace can get the number of hardware rings directly via amdgpu info ioctl.
Regards
Jesse
Regards,
Christian.
Quoted 221 lines
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +- drivers/gpu/drm/imagination/pvr_queue.c | 2 +- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 11 +++++++++-- drivers/gpu/drm/scheduler/sched_main.c | 4 ++-- drivers/gpu/drm/v3d/v3d_submit.c | 2 +- include/drm/gpu_scheduler.h | 4 ++-- 12 files changed, 22 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1@@ -1286,7 +1286,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,int r;for (i =0 ; i < p->gang_size; ++i) -drm_sched_job_arm (&p->jobs[i]->base); +drm_sched_job_arm (&p->jobs[i]->base,-1 );for (i =0 ; i < p->gang_size; ++i) {struct dma_fence *fence;drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-1@@ -320,7 +320,7 @@ struct dma_fence *amdgpu_job_submit(struct amdgpu_job *job) {struct dma_fence *f; -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); f =dma_fence_get (&job->base.s_fence->finished);amdgpu_job_free_resources (job);drm_sched_entity_push_job (&job->base);drivers/gpu/drm/etnaviv/etnaviv_sched.c +1
-1@@ -107,7 +107,7 @@ int etnaviv_sched_push_job(struct etnaviv_gem_submit *submit)*/ mutex_lock (&gpu->sched_lock); -drm_sched_job_arm (&submit->sched_job); +drm_sched_job_arm (&submit->sched_job,-1 ); submit->out_fence =dma_fence_get (&submit->sched_job.s_fence->finished); ret = xa_alloc_cyclic(&gpu->user_fences, &submit->out_fence_id,drivers/gpu/drm/imagination/pvr_queue.c +1
-1@@ -1115,7 +1115,7 @@ int pvr_queue_job_init(struct pvr_job *job)*/ struct dma_fence *pvr_queue_job_arm (struct pvr_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 );return &job->base.s_fence->finished; }drivers/gpu/drm/lima/lima_sched.c +1
-1@@ -130,7 +130,7 @@ int lima_sched_task_init(struct lima_sched_task *task,return err; } -drm_sched_job_arm (&task->base); +drm_sched_job_arm (&task->base,-1 ); task->num_bos = num_bos; task->vm =lima_vm_get (vm);drivers/gpu/drm/msm/msm_gem_submit.c +1
-1@@ -831,7 +831,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, goto out; } -drm_sched_job_arm (&submit->base); +drm_sched_job_arm (&submit->base,-1 ); submit->user_fence =dma_fence_get (&submit->base.s_fence->finished);drivers/gpu/drm/nouveau/nouveau_sched.c +1
-1@@ -309,7 +309,7 @@ nouveau_job_submit(struct nouveau_job *job)list_add (&job->entry, &sched->job.list.head);spin_unlock (&sched->job.list.lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);if (job->sync) done_fence = dma_fence_get(job->done_fence); diff --git
a/drivers/gpu/drm/panfrost/panfrost_job.cb/drivers/gpu/drm/panfrost/panfrost_job.c
indexa61ef0af9a4e..cc937420cd35100644drivers/gpu/drm/panfrost/panfrost_job.c +1
-1@@ -301,7 +301,7 @@ int panfrost_job_push(struct panfrost_job *job)return ret;mutex_lock (&pfdev->sched_lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->render_done_fence =dma_fence_get (&job->base.s_fence->finished);drivers/gpu/drm/scheduler/sched_entity.c +11
-2@@ -525,7 +525,7 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity *entity)return sched_job; } -void drm_sched_entity_select_rq (struct drm_sched_entity *entity) +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int +ring) {struct dma_fence *fence;struct drm_gpu_scheduler *sched;@@ -554,7 +554,14 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)return ;spin_lock (&entity->rq_lock); - sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); +if (ring >=0 ) { +if (entity->sched_list[ring] && entity->sched_list[ring]->ready) + sched = entity->sched_list[ring]; +else + sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); + } +else + sched =drm_sched_pick_best (entity->sched_list, +entity->num_sched_list); rq = sched ? sched->sched_rq[entity->priority] :NULL ;if (rq != entity->rq) { drm_sched_rq_remove_entity(entity->rq, entity); diff --git
a/drivers/gpu/drm/scheduler/sched_main.cb/drivers/gpu/drm/scheduler/sched_main.c
index7e90c9f95611..356adf510670100644drivers/gpu/drm/scheduler/sched_main.c +2
-2@@ -833,13 +833,13 @@ EXPORT_SYMBOL(drm_sched_job_init);* * This can only be called if drm_sched_job_init() succeeded. */ -void drm_sched_job_arm (struct drm_sched_job *job) +void drm_sched_job_arm (struct drm_sched_job *job,int ring) {struct drm_gpu_scheduler *sched;struct drm_sched_entity *entity = job->entity;BUG_ON (!entity); -drm_sched_entity_select_rq (entity); +drm_sched_entity_select_rq (entity, ring); sched = entity->rq->sched; job->sched = sched;drivers/gpu/drm/v3d/v3d_submit.c +1
-1@@ -211,7 +211,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,static void v3d_push_job (struct v3d_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);include/drm/gpu_scheduler.h +3
-2@@ -553,7 +553,7 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched);int drm_sched_job_init (struct drm_sched_job *job,struct drm_sched_entity *entity,u32 credits,void *owner); -void drm_sched_job_arm (struct drm_sched_job *job); +void drm_sched_job_arm (struct drm_sched_job *job,int ring);int drm_sched_job_add_dependency (struct drm_sched_job *job,struct dma_fence *fence); int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job,@@ -603,7 +603,7 @@ int drm_sched_entity_init(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_select_rq (struct drm_sched_entity *entity); +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int +ring);struct drm_sched_job *drm_sched_entity_pop_job (struct drm_sched_entity *entity);void drm_sched_entity_push_job (struct drm_sched_job *sched_job); void drm_sched_entity_set_priority(struct drm_sched_entity *entity,
Deucher, Alexander
maintainer[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 29 lines
-----Original Message-----
From: Zhang, Jesse(Jie) <[email protected]>
Sent: Friday, October 11, 2024 9:45 PM
To: Koenig, Christian <[email protected]>; dri- [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 1/2] drm/sched: adding a new scheduling policy[AMD Official Use Only - AMD Internal Distribution Only]
Hi Christian,
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Friday, October 11, 2024 4:40 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/sched: adding a new scheduling policyAm 11.10.24 um 08:21 schrieb [email protected]:
Quoted 7 lines
From: "[email protected]" <[email protected]>
Added ring ID scheduling.
In some cases, userspace needs to run a job on a specific ring. Instead of selecting the best ring to run based on the ring score. For example, The user want to run a bad job on a specific ring to check whether the ring can recover from a queue reset.
Quoted 6 lines
Absolutely clearly a NAK, we don't want to expose the different HW rings directly to userspace.
Thanks for the confirmation. It was a bit confusing.
But now userspace can get the number of hardware rings directly via amdgpu info ioctl.
That number does not align with the actual number of rings on the IP. It's just used for allowing userspace to schedule things in parallel. The kernel driver still decides which actual rings to use based on load. If you want to target specific rings, you might want to consider doing something like this:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/08c517d5a923628de50f93e8a9fedd647d3eefbb
Alex
Quoted 236 lines
Regards
JesseRegards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_submit(struct amdgpu_cs_parser
Quoted 23 lines
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +- drivers/gpu/drm/imagination/pvr_queue.c | 2 +- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 11 +++++++++-- drivers/gpu/drm/scheduler/sched_main.c | 4 ++-- drivers/gpu/drm/v3d/v3d_submit.c | 2 +- include/drm/gpu_scheduler.h | 4 ++-- 12 files changed, 22 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0@@ -1286,7 +1286,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser*p,
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c struct dma_fence *amdgpu_job_submit(struct
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1int r;for (i =0 ; i < p->gang_size; ++i) -drm_sched_job_arm (&p->jobs[i]->base); +drm_sched_job_arm (&p->jobs[i]->base,-1 );for (i =0 ; i < p->gang_size; ++i) { struct dma_fence *fence; diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index717adcedf096..8d75ffa9a097100644drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0
-0@@ -320,7 +320,7 @@ struct dma_fence *amdgpu_job_submit(struct
amdgpu_job*job)drivers/gpu/drm/etnaviv/etnaviv_sched.c int etnaviv_sched_push_job(struct etnaviv_gem_submit
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-1{struct dma_fence *f; -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); f =dma_fence_get (&job->base.s_fence->finished);amdgpu_job_free_resources (job);drm_sched_entity_push_job (&job->base);drivers/gpu/drm/etnaviv/etnaviv_sched.c +0
-0@@ -107,7 +107,7 @@ int etnaviv_sched_push_job(struct etnaviv_gem_submit*submit)
drivers/gpu/drm/msm/msm_gem_submit.c int msm_ioctl_gem_submit(struct drm_device *dev, void
Quoted 42 lines
drivers/gpu/drm/etnaviv/etnaviv_sched.c +1
-1*/ mutex_lock (&gpu->sched_lock); -drm_sched_job_arm (&submit->sched_job); +drm_sched_job_arm (&submit->sched_job,-1 ); submit->out_fence =dma_fence_get (&submit->sched_job.s_fence->finished); ret = xa_alloc_cyclic(&gpu->user_fences, &submit->out_fence_id,drivers/gpu/drm/imagination/pvr_queue.c +1
-1@@ -1115,7 +1115,7 @@ int pvr_queue_job_init(struct pvr_job *job)*/ struct dma_fence *pvr_queue_job_arm (struct pvr_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 );return &job->base.s_fence->finished; }drivers/gpu/drm/lima/lima_sched.c +1
-1@@ -130,7 +130,7 @@ int lima_sched_task_init(struct lima_sched_task *task,return err; } -drm_sched_job_arm (&task->base); +drm_sched_job_arm (&task->base,-1 ); task->num_bos = num_bos; task->vm =lima_vm_get (vm);drivers/gpu/drm/msm/msm_gem_submit.c +0
-0@@ -831,7 +831,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void*data,
drivers/gpu/drm/scheduler/sched_entity.c struct drm_sched_job *drm_sched_entity_pop_job(struct
Quoted 44 lines
drivers/gpu/drm/msm/msm_gem_submit.c +1
-1goto out; } -drm_sched_job_arm (&submit->base); +drm_sched_job_arm (&submit->base,-1 ); submit->user_fence =dma_fence_get (&submit->base.s_fence->finished);drivers/gpu/drm/nouveau/nouveau_sched.c +1
-1@@ -309,7 +309,7 @@ nouveau_job_submit(struct nouveau_job *job)list_add (&job->entry, &sched->job.list.head);spin_unlock (&sched->job.list.lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);if (job->sync) done_fence = dma_fence_get(job->done_fence); diff --git
a/drivers/gpu/drm/panfrost/panfrost_job.cb/drivers/gpu/drm/panfrost/panfrost_job.c
indexa61ef0af9a4e..cc937420cd35100644drivers/gpu/drm/panfrost/panfrost_job.c +1
-1@@ -301,7 +301,7 @@ int panfrost_job_push(struct panfrost_job *job)return ret;mutex_lock (&pfdev->sched_lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->render_done_fence =dma_fence_get (&job->base.s_fence->finished);drivers/gpu/drm/scheduler/sched_entity.c +0
-0@@ -525,7 +525,7 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct
drm_sched_entity*entity)Quoted 76 lines
drivers/gpu/drm/scheduler/sched_entity.c +2
-1return sched_job; } -void drm_sched_entity_select_rq (struct drm_sched_entity *entity) +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int +ring) {struct dma_fence *fence; struct drm_gpu_scheduler *sched; @@ -554,7 +554,14 @@ void
drm_sched_entity_select_rq(struct drm_sched_entity *entity)return; spin_lock(&entity->rq_lock);drivers/gpu/drm/scheduler/sched_entity.c +5
-1- sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); +if (ring >=0 ) { +if (entity->sched_list[ring] && entity->sched_list[ring]->ready) + sched = entity->sched_list[ring]; +else + sched = drm_sched_pick_best(entity->sched_list, entity-
num_sched_list);drivers/gpu/drm/scheduler/sched_entity.c +4
-1+ } +else + sched =drm_sched_pick_best (entity->sched_list, +entity->num_sched_list); rq = sched ? sched->sched_rq[entity->priority] :NULL ;if (rq != entity->rq) {drm_sched_rq_remove_entity (entity->rq, entity); diff --git a/drivers/gpu/drm/scheduler/sched_main.c
b/drivers/gpu/drm/scheduler/sched_main.c
index7e90c9f95611..356adf510670100644drivers/gpu/drm/scheduler/sched_main.c +2
-2@@ -833,13 +833,13 @@ EXPORT_SYMBOL(drm_sched_job_init);* * This can only be called if drm_sched_job_init() succeeded. */ -void drm_sched_job_arm (struct drm_sched_job *job) +void drm_sched_job_arm (struct drm_sched_job *job,int ring) {struct drm_gpu_scheduler *sched;struct drm_sched_entity *entity = job->entity;BUG_ON (!entity); -drm_sched_entity_select_rq (entity); +drm_sched_entity_select_rq (entity, ring); sched = entity->rq->sched; job->sched = sched;drivers/gpu/drm/v3d/v3d_submit.c +1
-1@@ -211,7 +211,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,static void v3d_push_job (struct v3d_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);include/drm/gpu_scheduler.h +1
-0@@ -553,7 +553,7 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched);int drm_sched_job_init (struct drm_sched_job *job,struct drm_sched_entity *entity, u32 credits, void *owner); -void drm_sched_job_arm(struct drm_sched_job *job); +void drm_sched_job_arm (struct drm_sched_job *job,int ring);int drm_sched_job_add_dependency (struct drm_sched_job *job,struct dma_fence *fence); int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job,include/drm/gpu_scheduler.h int drm_sched_entity_init(struct drm_sched_entity *entity, · line 608
Quoted 7 lines
include/drm/gpu_scheduler.h +2
-1@@ -603,7 +603,7 @@ int drm_sched_entity_init(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_select_rq (struct drm_sched_entity *entity); +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int +ring); struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity*entity);
Quoted 2 lines
include/drm/gpu_scheduler.h +0
-0void drm_sched_entity_push_job (struct drm_sched_job *sched_job); void drm_sched_entity_set_priority(struct drm_sched_entity *entity,
Christian König
maintainerAm 14.10.24 um 23:56 schrieb Deucher, Alexander:
Quoted 30 lines
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 28 lines
-----Original Message-----
From: Zhang, Jesse(Jie) <[email protected]>
Sent: Friday, October 11, 2024 9:45 PM
To: Koenig, Christian <[email protected]>; dri- [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 1/2] drm/sched: adding a new scheduling policy[AMD Official Use Only - AMD Internal Distribution Only]
Hi Christian,
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Friday, October 11, 2024 4:40 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/sched: adding a new scheduling policyAm 11.10.24 um 08:21 schrieb [email protected]:
Quoted 7 lines
From: "[email protected]" <[email protected]>
Added ring ID scheduling.
In some cases, userspace needs to run a job on a specific ring. Instead of selecting the best ring to run based on the ring score. For example, The user want to run a bad job on a specific ring to check whether the ring can recover from a queue reset.
Quoted 8 lines
Quoted 6 lines
Absolutely clearly a NAK, we don't want to expose the different HW rings directly to userspace.
Thanks for the confirmation. It was a bit confusing.
But now userspace can get the number of hardware rings directly via amdgpu info ioctl.That number does not align with the actual number of rings on the IP. It's just used for allowing userspace to schedule things in parallel. The kernel driver still decides which actual rings to use based on load. If you want to target specific rings, you might want to consider doing something like this:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/08c517d5a923628de50f93e8a9fedd647d3eefbb
Yeah that looks like a good solution to me as well.
Christian.
Quoted 236 lines
Alex
Quoted 233 lines
Regards
JesseRegards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_submit(struct amdgpu_cs_parser
Quoted 22 lines
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +- drivers/gpu/drm/imagination/pvr_queue.c | 2 +- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 11 +++++++++-- drivers/gpu/drm/scheduler/sched_main.c | 4 ++-- drivers/gpu/drm/v3d/v3d_submit.c | 2 +- include/drm/gpu_scheduler.h | 4 ++-- 12 files changed, 22 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0@@ -1286,7 +1286,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser*p,
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c struct dma_fence *amdgpu_job_submit(struct
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-1int r;for (i =0 ; i < p->gang_size; ++i) -drm_sched_job_arm (&p->jobs[i]->base); +drm_sched_job_arm (&p->jobs[i]->base,-1 );for (i =0 ; i < p->gang_size; ++i) { struct dma_fence *fence; diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index717adcedf096..8d75ffa9a097100644drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0
-0@@ -320,7 +320,7 @@ struct dma_fence *amdgpu_job_submit(struct
amdgpu_job*job)drivers/gpu/drm/etnaviv/etnaviv_sched.c int etnaviv_sched_push_job(struct etnaviv_gem_submit
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-1{struct dma_fence *f; -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); f =dma_fence_get (&job->base.s_fence->finished);amdgpu_job_free_resources (job);drm_sched_entity_push_job (&job->base);drivers/gpu/drm/etnaviv/etnaviv_sched.c +0
-0@@ -107,7 +107,7 @@ int etnaviv_sched_push_job(struct etnaviv_gem_submit*submit)
drivers/gpu/drm/msm/msm_gem_submit.c int msm_ioctl_gem_submit(struct drm_device *dev, void
Quoted 42 lines
drivers/gpu/drm/etnaviv/etnaviv_sched.c +1
-1*/ mutex_lock (&gpu->sched_lock); -drm_sched_job_arm (&submit->sched_job); +drm_sched_job_arm (&submit->sched_job,-1 ); submit->out_fence =dma_fence_get (&submit->sched_job.s_fence->finished); ret = xa_alloc_cyclic(&gpu->user_fences, &submit->out_fence_id,drivers/gpu/drm/imagination/pvr_queue.c +1
-1@@ -1115,7 +1115,7 @@ int pvr_queue_job_init(struct pvr_job *job)*/ struct dma_fence *pvr_queue_job_arm (struct pvr_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 );return &job->base.s_fence->finished; }drivers/gpu/drm/lima/lima_sched.c +1
-1@@ -130,7 +130,7 @@ int lima_sched_task_init(struct lima_sched_task *task,return err; } -drm_sched_job_arm (&task->base); +drm_sched_job_arm (&task->base,-1 ); task->num_bos = num_bos; task->vm =lima_vm_get (vm);drivers/gpu/drm/msm/msm_gem_submit.c +0
-0@@ -831,7 +831,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void*data,
drivers/gpu/drm/scheduler/sched_entity.c struct drm_sched_job *drm_sched_entity_pop_job(struct
Quoted 44 lines
drivers/gpu/drm/msm/msm_gem_submit.c +1
-1goto out; } -drm_sched_job_arm (&submit->base); +drm_sched_job_arm (&submit->base,-1 ); submit->user_fence =dma_fence_get (&submit->base.s_fence->finished);drivers/gpu/drm/nouveau/nouveau_sched.c +1
-1@@ -309,7 +309,7 @@ nouveau_job_submit(struct nouveau_job *job)list_add (&job->entry, &sched->job.list.head);spin_unlock (&sched->job.list.lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);if (job->sync) done_fence = dma_fence_get(job->done_fence); diff --git
a/drivers/gpu/drm/panfrost/panfrost_job.cb/drivers/gpu/drm/panfrost/panfrost_job.c
indexa61ef0af9a4e..cc937420cd35100644drivers/gpu/drm/panfrost/panfrost_job.c +1
-1@@ -301,7 +301,7 @@ int panfrost_job_push(struct panfrost_job *job)return ret;mutex_lock (&pfdev->sched_lock); -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->render_done_fence =dma_fence_get (&job->base.s_fence->finished);drivers/gpu/drm/scheduler/sched_entity.c +0
-0@@ -525,7 +525,7 @@ struct drm_sched_job *drm_sched_entity_pop_job(struct
drm_sched_entity*entity)Quoted 76 lines
drivers/gpu/drm/scheduler/sched_entity.c +2
-1return sched_job; } -void drm_sched_entity_select_rq (struct drm_sched_entity *entity) +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int +ring) {struct dma_fence *fence; struct drm_gpu_scheduler *sched; @@ -554,7 +554,14 @@ void
drm_sched_entity_select_rq(struct drm_sched_entity *entity)return; spin_lock(&entity->rq_lock);drivers/gpu/drm/scheduler/sched_entity.c +5
-1- sched =drm_sched_pick_best (entity->sched_list, entity->num_sched_list); +if (ring >=0 ) { +if (entity->sched_list[ring] && entity->sched_list[ring]->ready) + sched = entity->sched_list[ring]; +else + sched = drm_sched_pick_best(entity->sched_list, entity-
num_sched_list);drivers/gpu/drm/scheduler/sched_entity.c +4
-1+ } +else + sched =drm_sched_pick_best (entity->sched_list, +entity->num_sched_list); rq = sched ? sched->sched_rq[entity->priority] :NULL ;if (rq != entity->rq) {drm_sched_rq_remove_entity (entity->rq, entity); diff --git a/drivers/gpu/drm/scheduler/sched_main.c
b/drivers/gpu/drm/scheduler/sched_main.c
index7e90c9f95611..356adf510670100644drivers/gpu/drm/scheduler/sched_main.c +2
-2@@ -833,13 +833,13 @@ EXPORT_SYMBOL(drm_sched_job_init);* * This can only be called if drm_sched_job_init() succeeded. */ -void drm_sched_job_arm (struct drm_sched_job *job) +void drm_sched_job_arm (struct drm_sched_job *job,int ring) {struct drm_gpu_scheduler *sched;struct drm_sched_entity *entity = job->entity;BUG_ON (!entity); -drm_sched_entity_select_rq (entity); +drm_sched_entity_select_rq (entity, ring); sched = entity->rq->sched; job->sched = sched;drivers/gpu/drm/v3d/v3d_submit.c +1
-1@@ -211,7 +211,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,static void v3d_push_job (struct v3d_job *job) { -drm_sched_job_arm (&job->base); +drm_sched_job_arm (&job->base,-1 ); job->done_fence =dma_fence_get (&job->base.s_fence->finished);include/drm/gpu_scheduler.h +1
-0@@ -553,7 +553,7 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched);int drm_sched_job_init (struct drm_sched_job *job,struct drm_sched_entity *entity, u32 credits, void *owner); -void drm_sched_job_arm(struct drm_sched_job *job); +void drm_sched_job_arm (struct drm_sched_job *job,int ring);int drm_sched_job_add_dependency (struct drm_sched_job *job,struct dma_fence *fence); int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job,include/drm/gpu_scheduler.h int drm_sched_entity_init(struct drm_sched_entity *entity, · line 608
Quoted 7 lines
include/drm/gpu_scheduler.h +2
-1@@ -603,7 +603,7 @@ int drm_sched_entity_init(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_select_rq (struct drm_sched_entity *entity); +void drm_sched_entity_select_rq (struct drm_sched_entity *entity,int +ring); struct drm_sched_job *drm_sched_entity_pop_job(struct drm_sched_entity*entity);
Quoted 2 lines
include/drm/gpu_scheduler.h +0
-0void drm_sched_entity_push_job (struct drm_sched_job *sched_job); void drm_sched_entity_set_priority(struct drm_sched_entity *entity,
kernel test robot
build botkernel test robot noticed the following build errors:
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-exynos/exynos-drm-next]
[also build test ERROR on drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master v6.12-rc2 next-20241011] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/jesse-zhang-amd-com/drm-amdgpu-add-the-ring-id-schedule-module-parameter-for-amdgpu/20241011-142247 base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next patch link: https://lore.kernel.org/r/20241011062136.1019695-1-jesse.zhang%40amd.com patch subject: [PATCH 1/2] drm/sched: adding a new scheduling policy config: sparc64-randconfig-r073-20241012 (https://download.01.org/0day-ci/archive/20241012/[email protected]/config) compiler: sparc64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241012/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
drivers/gpu/drm/panthor/panthor_drv.c: In function 'panthor_submit_ctx_add_deps_and_arm_jobs':
>> drivers/gpu/drm/panthor/panthor_drv.c:674:17: error: too few arguments to function 'drm_sched_job_arm'
674 | drm_sched_job_arm(ctx->jobs[i].job);
| ^~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/panthor/panthor_drv.c:20:
include/drm/gpu_scheduler.h:556:6: note: declared here
556 | void drm_sched_job_arm(struct drm_sched_job *job, int ring);
| ^~~~~~~~~~~~~~~~~
--
drivers/gpu/drm/scheduler/sched_main.c:405: warning: Function parameter or struct member 'result' not described in 'drm_sched_job_done'
>> drivers/gpu/drm/scheduler/sched_main.c:828: warning: Function parameter or struct member 'ring' not described in 'drm_sched_job_arm'vim +/drm_sched_job_arm +674 drivers/gpu/drm/panthor/panthor_drv.c
4bdca11507928a Boris Brezillon 2024-02-29 655
4bdca11507928a Boris Brezillon 2024-02-29 656 /**
4bdca11507928a Boris Brezillon 2024-02-29 657 * panthor_submit_ctx_add_deps_and_arm_jobs() - Add jobs dependencies and arm jobs
4bdca11507928a Boris Brezillon 2024-02-29 658 * @ctx: Submit context.
4bdca11507928a Boris Brezillon 2024-02-29 659 *
4bdca11507928a Boris Brezillon 2024-02-29 660 * Must be called after the resv preparation has been taken care of.
4bdca11507928a Boris Brezillon 2024-02-29 661 *
4bdca11507928a Boris Brezillon 2024-02-29 662 * Return: 0 on success, a negative error code otherwise.
4bdca11507928a Boris Brezillon 2024-02-29 663 */
4bdca11507928a Boris Brezillon 2024-02-29 664 static int
4bdca11507928a Boris Brezillon 2024-02-29 665 panthor_submit_ctx_add_deps_and_arm_jobs(struct panthor_submit_ctx *ctx)
4bdca11507928a Boris Brezillon 2024-02-29 666 {
4bdca11507928a Boris Brezillon 2024-02-29 667 for (u32 i = 0; i < ctx->job_count; i++) {
4bdca11507928a Boris Brezillon 2024-02-29 668 int ret;
4bdca11507928a Boris Brezillon 2024-02-29 669
4bdca11507928a Boris Brezillon 2024-02-29 670 ret = panthor_submit_ctx_add_sync_deps_to_job(ctx, i);
4bdca11507928a Boris Brezillon 2024-02-29 671 if (ret)
4bdca11507928a Boris Brezillon 2024-02-29 672 return ret;
4bdca11507928a Boris Brezillon 2024-02-29 673
4bdca11507928a Boris Brezillon 2024-02-29 @674 drm_sched_job_arm(ctx->jobs[i].job);
4bdca11507928a Boris Brezillon 2024-02-29 675
4bdca11507928a Boris Brezillon 2024-02-29 676 ret = panthor_submit_ctx_update_job_sync_signal_fences(ctx, i);
4bdca11507928a Boris Brezillon 2024-02-29 677 if (ret)
4bdca11507928a Boris Brezillon 2024-02-29 678 return ret;
4bdca11507928a Boris Brezillon 2024-02-29 679 }
4bdca11507928a Boris Brezillon 2024-02-29 680
4bdca11507928a Boris Brezillon 2024-02-29 681 return 0;
4bdca11507928a Boris Brezillon 2024-02-29 682 }
4bdca11507928a Boris Brezillon 2024-02-29 683 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-exynos/exynos-drm-next]
[also build test ERROR on drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master v6.12-rc2 next-20241011] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/jesse-zhang-amd-com/drm-amdgpu-add-the-ring-id-schedule-module-parameter-for-amdgpu/20241011-142247 base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next patch link: https://lore.kernel.org/r/20241011062136.1019695-1-jesse.zhang%40amd.com patch subject: [PATCH 1/2] drm/sched: adding a new scheduling policy config: i386-randconfig-141-20241012 (https://download.01.org/0day-ci/archive/20241012/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241012/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/gpu/drm/xe/xe_sched_job.c: In function 'xe_sched_job_arm':
>> drivers/gpu/drm/xe/xe_sched_job.c:284:9: error: too few arguments to function 'drm_sched_job_arm'
284 | drm_sched_job_arm(&job->drm);
| ^~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/xe/xe_sched_job_types.h:11,
from drivers/gpu/drm/xe/xe_sched_job.h:9,
from drivers/gpu/drm/xe/xe_sched_job.c:6:
include/drm/gpu_scheduler.h:556:6: note: declared here
556 | void drm_sched_job_arm(struct drm_sched_job *job, int ring);
| ^~~~~~~~~~~~~~~~~vim +/drm_sched_job_arm +284 drivers/gpu/drm/xe/xe_sched_job.c
dd08ebf6c3525a Matthew Brost 2023-03-30 239
dd08ebf6c3525a Matthew Brost 2023-03-30 240 void xe_sched_job_arm(struct xe_sched_job *job)
dd08ebf6c3525a Matthew Brost 2023-03-30 241 {
4fc4899e86f7af Thomas Hellström 2024-03-27 242 struct xe_exec_queue *q = job->q;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 243 struct dma_fence *fence, *prev;
4fc4899e86f7af Thomas Hellström 2024-03-27 244 struct xe_vm *vm = q->vm;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 245 u64 seqno = 0;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 246 int i;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 247
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 248 /* Migration and kernel engines have their own locking */
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 249 if (IS_ENABLED(CONFIG_LOCKDEP) &&
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 250 !(q->flags & (EXEC_QUEUE_FLAG_KERNEL | EXEC_QUEUE_FLAG_VM))) {
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 251 lockdep_assert_held(&q->vm->lock);
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 252 if (!xe_vm_in_lr_mode(q->vm))
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 253 xe_vm_assert_held(q->vm);
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 254 }
4fc4899e86f7af Thomas Hellström 2024-03-27 255
4fc4899e86f7af Thomas Hellström 2024-03-27 256 if (vm && !xe_sched_job_is_migration(q) && !xe_vm_in_lr_mode(vm) &&
4fc4899e86f7af Thomas Hellström 2024-03-27 257 (vm->batch_invalidate_tlb || vm->tlb_flush_seqno != q->tlb_flush_seqno)) {
4fc4899e86f7af Thomas Hellström 2024-03-27 258 xe_vm_assert_held(vm);
4fc4899e86f7af Thomas Hellström 2024-03-27 259 q->tlb_flush_seqno = vm->tlb_flush_seqno;
4fc4899e86f7af Thomas Hellström 2024-03-27 260 job->ring_ops_flush_tlb = true;
4fc4899e86f7af Thomas Hellström 2024-03-27 261 }
4fc4899e86f7af Thomas Hellström 2024-03-27 262
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 263 /* Arm the pre-allocated fences */
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 264 for (i = 0; i < q->width; prev = fence, ++i) {
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 265 struct dma_fence_chain *chain;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 266
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 267 fence = job->ptrs[i].lrc_fence;
264eecdba211bb Niranjana Vishwanathapura 2024-05-29 268 xe_lrc_init_seqno_fence(q->lrc[i], fence);
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 269 job->ptrs[i].lrc_fence = NULL;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 270 if (!i) {
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 271 job->lrc_seqno = fence->seqno;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 272 continue;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 273 } else {
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 274 xe_assert(gt_to_xe(q->gt), job->lrc_seqno == fence->seqno);
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 275 }
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 276
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 277 chain = job->ptrs[i - 1].chain_fence;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 278 dma_fence_chain_init(chain, prev, fence, seqno++);
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 279 job->ptrs[i - 1].chain_fence = NULL;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 280 fence = &chain->base;
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 281 }
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 282
0ac7a2c745e8a4 Thomas Hellström 2024-05-27 283 job->fence = fence;
dd08ebf6c3525a Matthew Brost 2023-03-30 @284 drm_sched_job_arm(&job->drm);
dd08ebf6c3525a Matthew Brost 2023-03-30 285 }
dd08ebf6c3525a Matthew Brost 2023-03-30 286 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki